Module CAMPSize
Section
CAMPSize
.
Require
Import
Omega
.
Require
Import
BasicRuntime
CAMP
.
Context
{
fruntime
:
foreign_runtime
}.
Fixpoint
camp_size
(
p
:
camp
) :
nat
:=
match
p
with
|
pconst
d
' => 1
|
punop
op
p
₁ =>
S
(
camp_size
p
₁)
|
pbinop
op
p
₁
p
₂ =>
S
(
camp_size
p
₁ +
camp_size
p
₂)
|
pmap
p
₁ =>
S
(
camp_size
p
₁)
|
passert
p
₁ =>
S
(
camp_size
p
₁)
|
porElse
p
₁
p
₂ =>
S
(
camp_size
p
₁ +
camp_size
p
₂)
|
pit
=> 1
|
pletIt
p
₁
p
₂ =>
S
(
camp_size
p
₁ +
camp_size
p
₂)
|
pgetConstant
_
=> 1
|
penv
=> 1
|
pletEnv
p
₁
p
₂ =>
S
(
camp_size
p
₁ +
camp_size
p
₂)
|
pleft
=> 1
|
pright
=> 1
end
.
Lemma
camp_size_nzero
(
a
:
camp
) :
camp_size
a
<> 0.
Proof.
induction
a
;
simpl
;
omega
.
Qed.
End
CAMPSize
.