Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
ReLoC-v1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dan Frumin
ReLoC-v1
Commits
413a7d9c
Commit
413a7d9c
authored
Sep 28, 2017
by
Dan Frumin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some useful instances for the language
parent
f73cd1e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
9 deletions
+95
-9
theories/F_mu_ref_conc/binder.v
theories/F_mu_ref_conc/binder.v
+5
-0
theories/F_mu_ref_conc/lang.v
theories/F_mu_ref_conc/lang.v
+90
-7
theories/examples/stack/helping.v
theories/examples/stack/helping.v
+0
-2
No files found.
theories/F_mu_ref_conc/binder.v
View file @
413a7d9c
...
...
@@ -12,6 +12,11 @@ Definition cons_binder (mx : binder) (X : stringset) : stringset :=
Infix
":b:"
:=
cons_binder
(
at
level
60
,
right
associativity
).
Instance
binder_eq_dec_eq
:
EqDecision
binder
.
Proof
.
solve_decision
.
Defined
.
Instance
binder_countable
:
Countable
binder
.
Proof
.
refine
(
inj_countable
'
(
λ
b
,
match
b
with
BNamed
s
=>
Some
s
|
BAnon
=>
None
end
)
(
λ
b
,
match
b
with
Some
s
=>
BNamed
s
|
None
=>
BAnon
end
)
_
);
by
intros
[].
Qed
.
Instance
set_unfold_cons_binder
x
mx
X
P
:
SetUnfold
(
x
∈
X
)
P
→
SetUnfold
(
x
∈
mx
:
b
:
X
)
(
BNamed
x
=
mx
∨
P
).
...
...
theories/F_mu_ref_conc/lang.v
View file @
413a7d9c
...
...
@@ -8,12 +8,12 @@ Module lang.
(
**
*
Syntax
and
syntactic
categories
*
)
Definition
loc
:=
positive
.
Instance
loc_dec_eq
(
l
l
'
:
loc
)
:
Decision
(
l
=
l
'
)
:=
_.
Instance
loc_dec_eq
:
EqDecision
loc
:=
_.
(
**
**
Expressions
*
)
Inductive
binop
:=
Add
|
Sub
|
Eq
|
Le
|
Lt
|
Xor
.
Instance
binop_dec_eq
(
op
op
'
:
binop
)
:
Decision
(
op
=
op
'
)
.
Instance
binop_dec_eq
:
EqDecision
binop
.
Proof
.
solve_decision
.
Defined
.
Inductive
literal
:=
Unit
|
Nat
(
n
:
nat
)
|
Bool
(
b
:
bool
)
|
Loc
(
l
:
loc
).
...
...
@@ -55,10 +55,10 @@ Module lang.
|
CAS
(
e0
:
expr
)
(
e1
:
expr
)
(
e2
:
expr
).
Bind
Scope
expr_scope
with
expr
.
Instance
literal_dec_eq
(
l
l
'
:
literal
)
:
Decision
(
l
=
l
'
)
.
Instance
literal_dec_eq
:
EqDecision
literal
.
Proof
.
solve_decision
.
Defined
.
Instance
expr_dec_eq
(
e
e
'
:
expr
)
:
Decision
(
e
=
e
'
)
.
Instance
expr_dec_eq
:
EqDecision
expr
.
Proof
.
solve_decision
.
Defined
.
(
**
**
Closed
expressions
*
)
...
...
@@ -160,11 +160,92 @@ Module lang.
Instance
of_val_inj
:
Inj
(
=
)
(
=
)
of_val
.
Proof
.
by
intros
??
Hv
;
apply
(
inj
Some
);
rewrite
-!
to_of_val
Hv
.
Qed
.
Instance
val_dec_eq
(
v
v
'
:
val
)
:
Decision
(
v
=
v
'
)
.
Instance
val_dec_eq
:
EqDecision
val
.
Proof
.
refine
(
cast_if
(
decide
(
of_val
v
=
of_val
v
'
)));
abstract
naive_solver
.
refine
(
fun
v
v
'
=>
cast_if
(
decide
(
of_val
v
=
of_val
v
'
)));
abstract
naive_solver
.
Defined
.
Instance
literal_countable
:
Countable
literal
.
Proof
.
refine
(
inj_countable
'
(
λ
l
,
match
l
with
|
Nat
n
=>
inl
(
inl
n
)
|
Bool
b
=>
inl
(
inr
b
)
|
Unit
=>
inr
(
inl
())
|
Loc
l
=>
inr
(
inr
l
)
end
)
(
λ
l
,
match
l
with
|
inl
(
inl
n
)
=>
Nat
n
|
inl
(
inr
b
)
=>
Bool
b
|
inr
(
inl
())
=>
Unit
|
inr
(
inr
l
)
=>
Loc
l
end
)
_
);
by
intros
[].
Qed
.
Instance
binop_countable
:
Countable
binop
.
Proof
.
refine
(
inj_countable
'
(
λ
op
,
match
op
with
|
Add
=>
0
|
Sub
=>
1
|
Eq
=>
2
|
Le
=>
3
|
Lt
=>
4
|
Xor
=>
5
end
)
(
λ
n
,
match
n
with
|
0
=>
Add
|
1
=>
Sub
|
2
=>
Eq
|
3
=>
Le
|
4
=>
Lt
|
_
=>
Xor
end
)
_
);
by
intros
[].
Qed
.
Instance
expr_countable
:
Countable
expr
.
Proof
.
set
(
enc
:=
fix
go
e
:=
match
e
with
|
Var
x
=>
GenLeaf
(
inl
(
inl
x
))
|
Rec
f
x
e
=>
GenNode
0
[
GenLeaf
(
inl
(
inr
f
));
GenLeaf
(
inl
(
inr
x
));
go
e
]
|
App
e1
e2
=>
GenNode
1
[
go
e1
;
go
e2
]
|
Lit
l
=>
GenLeaf
(
inr
(
inl
l
))
|
Fold
e
=>
GenNode
2
[
go
e
]
|
BinOp
op
e1
e2
=>
GenNode
3
[
GenLeaf
(
inr
(
inr
op
));
go
e1
;
go
e2
]
|
If
e0
e1
e2
=>
GenNode
4
[
go
e0
;
go
e1
;
go
e2
]
|
Pair
e1
e2
=>
GenNode
5
[
go
e1
;
go
e2
]
|
Fst
e
=>
GenNode
6
[
go
e
]
|
Snd
e
=>
GenNode
7
[
go
e
]
|
InjL
e
=>
GenNode
8
[
go
e
]
|
InjR
e
=>
GenNode
9
[
go
e
]
|
Case
e0
e1
e2
=>
GenNode
10
[
go
e0
;
go
e1
;
go
e2
]
|
Fork
e
=>
GenNode
11
[
go
e
]
|
Alloc
e
=>
GenNode
12
[
go
e
]
|
Load
e
=>
GenNode
13
[
go
e
]
|
Store
e1
e2
=>
GenNode
14
[
go
e1
;
go
e2
]
|
CAS
e0
e1
e2
=>
GenNode
15
[
go
e0
;
go
e1
;
go
e2
]
|
Unfold
e
=>
GenNode
16
[
go
e
]
|
TLam
e
=>
GenNode
17
[
go
e
]
|
TApp
e
=>
GenNode
18
[
go
e
]
|
Pack
e
=>
GenNode
19
[
go
e
]
|
Unpack
e1
e2
=>
GenNode
20
[
go
e1
;
go
e2
]
end
).
set
(
dec
:=
fix
go
e
:=
match
e
with
|
GenLeaf
(
inl
(
inl
x
))
=>
Var
x
|
GenNode
0
[
GenLeaf
(
inl
(
inr
f
));
GenLeaf
(
inl
(
inr
x
));
e
]
=>
Rec
f
x
(
go
e
)
|
GenNode
1
[
e1
;
e2
]
=>
App
(
go
e1
)
(
go
e2
)
|
GenLeaf
(
inr
(
inl
l
))
=>
Lit
l
|
GenNode
2
[
e
]
=>
Fold
(
go
e
)
|
GenNode
3
[
GenLeaf
(
inr
(
inr
op
));
e1
;
e2
]
=>
BinOp
op
(
go
e1
)
(
go
e2
)
|
GenNode
4
[
e0
;
e1
;
e2
]
=>
If
(
go
e0
)
(
go
e1
)
(
go
e2
)
|
GenNode
5
[
e1
;
e2
]
=>
Pair
(
go
e1
)
(
go
e2
)
|
GenNode
6
[
e
]
=>
Fst
(
go
e
)
|
GenNode
7
[
e
]
=>
Snd
(
go
e
)
|
GenNode
8
[
e
]
=>
InjL
(
go
e
)
|
GenNode
9
[
e
]
=>
InjR
(
go
e
)
|
GenNode
10
[
e0
;
e1
;
e2
]
=>
Case
(
go
e0
)
(
go
e1
)
(
go
e2
)
|
GenNode
11
[
e
]
=>
Fork
(
go
e
)
|
GenNode
12
[
e
]
=>
Alloc
(
go
e
)
|
GenNode
13
[
e
]
=>
Load
(
go
e
)
|
GenNode
14
[
e1
;
e2
]
=>
Store
(
go
e1
)
(
go
e2
)
|
GenNode
15
[
e0
;
e1
;
e2
]
=>
CAS
(
go
e0
)
(
go
e1
)
(
go
e2
)
|
GenNode
16
[
e
]
=>
Unfold
(
go
e
)
|
GenNode
17
[
e
]
=>
TLam
(
go
e
)
|
GenNode
18
[
e
]
=>
TApp
(
go
e
)
|
GenNode
19
[
e
]
=>
Pack
(
go
e
)
|
GenNode
20
[
e1
;
e2
]
=>
Unpack
(
go
e1
)
(
go
e2
)
|
_
=>
Lit
Unit
(
*
dummy
*
)
end
).
refine
(
inj_countable
'
enc
dec
_
).
intros
e
.
induction
e
;
f_equal
/=
;
auto
.
Qed
.
Instance
val_countable
:
Countable
val
.
Proof
.
refine
(
inj_countable
of_val
to_val
_
);
auto
using
to_of_val
.
Qed
.
(
**
**
Evaluation
contexts
*
)
Inductive
ectx_item
:=
|
AppLCtx
(
e2
:
expr
)
...
...
@@ -344,6 +425,8 @@ Module lang.
Canonical
Structure
stateC
:=
leibnizC
state
.
Canonical
Structure
valC
:=
leibnizC
val
.
Canonical
Structure
exprC
:=
leibnizC
expr
.
Canonical
Structure
locC
:=
leibnizC
loc
.
Canonical
Structure
ectx_itemC
:=
leibnizC
ectx_item
.
Lemma
fill_item_val
Ki
e
:
is_Some
(
to_val
(
fill_item
Ki
e
))
→
is_Some
(
to_val
e
).
...
...
theories/examples/stack/helping.v
View file @
413a7d9c
...
...
@@ -52,8 +52,6 @@ Section refinement.
let:
"st"
:=
ref
Nile
in
(
CG_locked_pop
"st"
"l"
,
CG_locked_push
"st"
"l"
).
Canonical
Structure
ectx_itemC
:=
leibnizC
ectx_item
.
Canonical
Structure
locC
:=
leibnizC
loc
.
Canonical
Structure
gnameC
:=
leibnizC
gname
.
Definition
offerReg
:=
gmap
loc
(
val
*
gname
*
nat
*
(
list
ectx_item
)).
...
...
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