Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tej Chajed
iris
Commits
3a4e0b14
Commit
3a4e0b14
authored
9 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
define a function from expressions to values; use it to define the stepping relation
parent
8af06c17
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
autosubst
+1
-1
1 addition, 1 deletion
autosubst
channel/heap_lang.v
+58
-7
58 additions, 7 deletions
channel/heap_lang.v
with
59 additions
and
8 deletions
autosubst
@
cbb6e209
Compare
4f8dc592
...
cbb6e209
Subproject commit
4f8dc59286388e169f5c47c4f224a284202e52e7
Subproject commit
cbb6e2095acb1bdb5e311d5b61cbedcc969df0cf
This diff is collapsed.
Click to expand it.
channel/heap_lang.v
+
58
−
7
View file @
3a4e0b14
Require
Import
Autosubst
.
Autosubst
.
Require
Import
Autosubst
.
Autosubst
.
Require
Import
prelude
.
option
.
Inductive
expr
:=
Inductive
expr
:=
|
Var
(
x
:
var
)
|
Var
(
x
:
var
)
...
@@ -24,7 +25,7 @@ Inductive value :=
...
@@ -24,7 +25,7 @@ Inductive value :=
|
InjLV
(
v
:
value
)
|
InjLV
(
v
:
value
)
|
InjRV
(
v
:
value
)
.
|
InjRV
(
v
:
value
)
.
Fixpoint
v2e
(
v
:
value
):
expr
:=
Fixpoint
v2e
(
v
:
value
)
:
expr
:=
match
v
with
match
v
with
|
LitV
T
t
=>
Lit
T
t
|
LitV
T
t
=>
Lit
T
t
|
LamV
e
=>
Lam
e
|
LamV
e
=>
Lam
e
...
@@ -33,6 +34,34 @@ Fixpoint v2e (v : value): expr :=
...
@@ -33,6 +34,34 @@ Fixpoint v2e (v : value): expr :=
|
InjRV
v
=>
InjR
(
v2e
v
)
|
InjRV
v
=>
InjR
(
v2e
v
)
end
.
end
.
Fixpoint
e2v
(
e
:
expr
)
:
option
value
:=
match
e
with
|
Var
_
=>
None
|
Lit
T
t
=>
Some
(
LitV
T
t
)
|
App
_
_
=>
None
|
Lam
e
=>
Some
(
LamV
e
)
|
Pair
e1
e2
=>
v1
←
e2v
e1
;
v2
←
e2v
e2
;
Some
(
PairV
v1
v2
)
|
Fst
e
=>
None
|
Snd
e
=>
None
|
InjL
e
=>
InjLV
<$>
e2v
e
|
InjR
e
=>
InjRV
<$>
e2v
e
|
Case
e0
e1
e2
=>
None
end
.
Lemma
v2v
v
:
e2v
(
v2e
v
)
=
Some
v
.
Proof
.
induction
v
;
simpl
;
rewrite
?IHv
,
?IHv1
;
simpl
;
rewrite
?IHv2
;
reflexivity
.
Qed
.
Lemma
e2e
e
v
:
e2v
e
=
Some
v
->
v2e
v
=
e
.
Proof
.
(* TODO: First figure out how to best state this. *)
Abort
.
Inductive
ectx
:=
Inductive
ectx
:=
|
EmptyCtx
|
EmptyCtx
|
AppLCtx
(
K1
:
ectx
)
(
e2
:
expr
)
|
AppLCtx
(
K1
:
ectx
)
(
e2
:
expr
)
...
@@ -92,9 +121,31 @@ Proof.
...
@@ -92,9 +121,31 @@ Proof.
intros
Heq
;
try
apply
IHK
;
inversion
Heq
;
reflexivity
.
intros
Heq
;
try
apply
IHK
;
inversion
Heq
;
reflexivity
.
Qed
.
Qed
.
Inductive
step
:
expr
->
expr
->
Prop
:=
Definition
state
:=
unit
.
|
Beta
e
v
:
step
(
App
(
Lam
e
)
(
v2e
v
))
(
e
.[(
v2e
v
)
/
])
Definition
prim_cfg
:
Type
:=
(
expr
*
state
)
%
type
.
|
FstS
v1
v2
:
step
(
Fst
(
Pair
(
v2e
v1
)
(
v2e
v2
)))
(
v2e
v1
)
|
SndS
v1
v2
:
step
(
Fst
(
Pair
(
v2e
v1
)
(
v2e
v2
)))
(
v2e
v2
)
Inductive
prim_step
:
prim_cfg
->
prim_cfg
->
option
expr
->
Prop
:=
|
CaseL
v0
e1
e2
:
step
(
Case
(
InjL
(
v2e
v0
))
e1
e2
)
(
e1
.[(
v2e
v0
)
/
])
|
Beta
e1
e2
v2
σ
:
e2v
e2
=
Some
v2
->
|
CaseR
v0
e1
e2
:
step
(
Case
(
InjR
(
v2e
v0
))
e1
e2
)
(
e2
.[(
v2e
v0
)
/
])
.
prim_step
(
App
(
Lam
e1
)
e2
,
σ
)
(
e1
.[
e2
/
],
σ
)
None
|
FstS
e1
v1
e2
v2
σ
:
e2v
e1
=
Some
v1
->
e2v
e2
=
Some
v2
->
prim_step
(
Fst
(
Pair
e1
e2
),
σ
)
(
e1
,
σ
)
None
|
SndS
e1
v1
e2
v2
σ
:
e2v
e1
=
Some
v1
->
e2v
e2
=
Some
v2
->
prim_step
(
Fst
(
Pair
e1
e2
),
σ
)
(
e2
,
σ
)
None
|
CaseL
e0
v0
e1
e2
σ
:
e2v
e0
=
Some
v0
->
prim_step
(
Case
(
InjL
e0
)
e1
e2
,
σ
)
(
e1
.[
e0
/
],
σ
)
None
|
CaseR
e0
v0
e1
e2
σ
:
e2v
e0
=
Some
v0
->
prim_step
(
Case
(
InjR
e0
)
e1
e2
,
σ
)
(
e2
.[
e0
/
],
σ
)
None
.
Definition
reducible
e
:
Prop
:=
exists
σ
cfg'
ef
,
prim_step
(
e
,
σ
)
cfg'
ef
.
Definition
stuck
(
e
:
expr
)
:
Prop
:=
forall
K
e'
,
e
=
fill
K
e'
->
~reducible
e'
.
Lemma
values_stuck
v
:
stuck
(
v2e
v
)
.
Proof
.
(* TODO this seems like a rather ugly proof. *)
Abort
.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment