Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
cpdt
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
research
cpdt
Commits
e0801cbe
Commit
e0801cbe
authored
Sep 03, 2008
by
Adam Chlipala
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Source language examples
parent
627773fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
StackMachine.v
src/StackMachine.v
+19
-0
No files found.
src/StackMachine.v
View file @
e0801cbe
...
...
@@ -93,6 +93,12 @@ Fixpoint expDenote (e : exp) : nat :=
(
**
We
declare
explicitly
that
this
is
a
recursive
definition
,
using
the
keyword
[
Fixpoint
]
.
The
rest
should
be
old
hat
for
functional
programmers
.
*
)
(
**
It
is
convenient
to
be
able
to
test
definitions
before
starting
to
prove
things
about
them
.
We
can
verify
that
our
semantics
is
sensible
by
evaluating
some
sample
uses
.
*
)
Eval
simpl
in
expDenote
(
Const
42
)
.
Eval
simpl
in
expDenote
(
Binop
Plus
(
Const
2
)
(
Const
2
))
.
Eval
simpl
in
expDenote
(
Binop
Times
(
Binop
Plus
(
Const
2
)
(
Const
2
))
(
Const
7
))
.
(
**
**
Target
language
*
)
...
...
@@ -145,6 +151,19 @@ Fixpoint compile (e : exp) : prog :=
end
.
(
**
Before
we
set
about
proving
that
this
compiler
is
correct
,
we
can
try
a
few
test
runs
,
using
our
sample
programs
from
earlier
.
*
)
Eval
simpl
in
compile
(
Const
42
)
.
Eval
simpl
in
compile
(
Binop
Plus
(
Const
2
)
(
Const
2
))
.
Eval
simpl
in
compile
(
Binop
Times
(
Binop
Plus
(
Const
2
)
(
Const
2
))
(
Const
7
))
.
(
**
We
can
also
run
our
compiled
programs
and
chedk
that
they
give
the
right
results
.
*
)
Eval
simpl
in
progDenote
(
compile
(
Const
42
))
nil
.
Eval
simpl
in
progDenote
(
compile
(
Binop
Plus
(
Const
2
)
(
Const
2
)))
nil
.
Eval
simpl
in
progDenote
(
compile
(
Binop
Times
(
Binop
Plus
(
Const
2
)
(
Const
2
))
(
Const
7
)))
nil
.
(
**
**
Translation
correctness
*
)
(
**
We
are
ready
to
prove
that
our
compiler
is
implemented
correctly
.
We
can
use
a
new
vernacular
command
[
Theorem
]
to
start
a
correctness
proof
,
in
terms
of
the
semantics
we
defined
earlier
:
*
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment