Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dan Frumin
ReLoC-v1
Commits
a8c7557d
Commit
a8c7557d
authored
Sep 12, 2017
by
Dan Frumin
Browse files
Notation for MAYBE
parent
04bc3235
Changes
5
Hide whitespace changes
Inline
Side-by-side
theories/F_mu_ref_conc/notation.v
View file @
a8c7557d
...
...
@@ -100,3 +100,16 @@ Notation "'let:' x := e1 'in' e2" := (Lam x%bind e2%E e1%E)
Notation
"e1 ;; e2"
:=
(
Lam
BAnon
e2
%
E
e1
%
E
)
(
at
level
100
,
e2
at
level
200
,
format
"'[' '[' e1 ']' ;; '/' e2 ']'"
)
:
expr_scope
.
Notation
NONE
:=
(
InjL
#())
(
only
parsing
).
Notation
SOME
x
:=
(
InjR
x
)
(
only
parsing
).
Notation
NONEV
:=
(
InjLV
#())
(
only
parsing
).
Notation
SOMEV
x
:=
(
InjRV
x
)
(
only
parsing
).
Notation
"'match:' e0 'with' 'NONE' => e1 | 'SOME' x => e2 'end'"
:=
(
Match
e0
BAnon
e1
x
%
bind
e2
)
(
e0
,
e1
,
x
,
e2
at
level
200
,
only
parsing
)
:
expr_scope
.
Notation
"'match:' e0 'with' 'SOME' x => e2 | 'NONE' => e1 'end'"
:=
(
Match
e0
BAnon
e1
x
%
bind
e2
)
(
e0
,
e1
,
x
,
e2
at
level
200
,
only
parsing
)
:
expr_scope
.
theories/F_mu_ref_conc/typing.v
View file @
a8c7557d
...
...
@@ -198,3 +198,6 @@ Proof.
*
by
eapply
IHHt1
.
*
eapply
IHHt2
.
by
apply
map_fmap_mono
.
Qed
.
(
*
Type
synonyms
*
)
Notation
MAYBE
τ
:=
(
TSum
TUnit
τ
)
(
only
parsing
).
theories/examples/stack/CG_stack.v
View file @
a8c7557d
...
...
@@ -7,8 +7,8 @@ Import uPred.
Definition
CG_StackType
τ
:=
TRec
(
TSum
TUnit
(
TProd
τ
.[
ren
(
+
1
)]
(
TVar
0
))).
Notation
Conse
h
t
:=
(
Fold
(
InjR
(
Pair
h
t
))).
Notation
Nile
:=
(
Fold
(
InjL
#())
).
Notation
Conse
h
t
:=
(
Fold
(
SOME
(
Pair
h
t
))).
Notation
Nile
:=
(
Fold
NONE
).
(
*
Coarse
-
grained
push
*
)
Program
Definition
CG_push
:
val
:=
λ
:
"st"
"x"
,
...
...
@@ -23,8 +23,8 @@ Definition CG_locked_push : val := λ: "st" "l" "x",
end
*
)
Definition
CG_pop
:
val
:=
λ
:
"st"
<>
,
match:
Unfold
!
"st"
with
InjL
<>
=>
InjL
#()
|
InjR
"y"
=>
"st"
<-
(
Snd
"y"
);;
InjR
(
Fst
"y"
)
NONE
=>
NONE
|
SOME
"y"
=>
"st"
<-
(
Snd
"y"
);;
SOME
(
Fst
"y"
)
end
.
...
...
@@ -41,8 +41,8 @@ Definition CG_snap : val := λ: "st" "l" <>,
end
*
)
Definition
CG_iter
:
val
:=
rec
:
"iter"
"f"
:=
λ
:
"s"
,
match:
(
Unfold
"s"
)
with
InjL
<>
=>
#()
|
InjR
"x"
=>
"f"
(
Fst
"x"
);;
"iter"
"f"
(
Snd
"x"
)
NONE
=>
#()
|
SOME
"x"
=>
"f"
(
Fst
"x"
);;
"iter"
"f"
(
Snd
"x"
)
end
.
(
*
snap_iter
st
l
:=
λ
f
.
iter
f
(
snap
st
l
#())
*
)
...
...
@@ -155,7 +155,7 @@ Section CG_Stack.
Lemma
CG_push_r
st
'
(
v
w
:
val
)
l
E1
E2
Δ
Γ
t
K
τ
:
nclose
logrelN
⊆
E1
→
st
'
↦ₛ
v
-
∗
l
↦ₛ
#
false
-
∗
(
st
'
↦ₛ
FoldV
(
InjR
V
(
w
,
v
))
-
∗
l
↦ₛ
#
false
(
st
'
↦ₛ
FoldV
(
SOME
V
(
w
,
v
))
-
∗
l
↦ₛ
#
false
-
∗
{
E1
,
E2
;
Δ
;
Γ
}
⊨
t
≤
log
≤
fill
K
#()
:
τ
)
-
∗
{
E1
,
E2
;
Δ
;
Γ
}
⊨
t
≤
log
≤
fill
K
((
CG_locked_push
$
/
(
LitV
(
Loc
st
'
))
$
/
(
LitV
(
Loc
l
)))
w
)
:
τ
.
Proof
.
...
...
@@ -199,10 +199,10 @@ Section CG_Stack.
Lemma
CG_pop_suc_r
st
'
l
(
w
v
:
val
)
E1
E2
Δ
Γ
t
K
τ
:
nclose
logrelN
⊆
E1
→
st
'
↦ₛ
FoldV
(
InjR
V
(
w
,
v
))
-
∗
st
'
↦ₛ
FoldV
(
SOME
V
(
w
,
v
))
-
∗
l
↦ₛ
#
false
-
∗
(
st
'
↦ₛ
v
-
∗
l
↦ₛ
#
false
-
∗
{
E1
,
E2
;
Δ
;
Γ
}
⊨
t
≤
log
≤
fill
K
(
InjR
w
)
:
τ
)
-
∗
-
∗
{
E1
,
E2
;
Δ
;
Γ
}
⊨
t
≤
log
≤
fill
K
(
SOME
w
)
:
τ
)
-
∗
{
E1
,
E2
;
Δ
;
Γ
}
⊨
t
≤
log
≤
fill
K
((
CG_locked_pop
$
/
LitV
(
Loc
st
'
)
$
/
LitV
(
Loc
l
))
#())
:
τ
.
Proof
.
iIntros
(
?
)
"Hst' Hl Hlog"
.
...
...
@@ -230,10 +230,10 @@ Section CG_Stack.
Lemma
CG_pop_fail_r
st
'
l
E1
E2
Δ
Γ
t
K
τ
:
nclose
logrelN
⊆
E1
→
st
'
↦ₛ
FoldV
(
InjLV
#())
-
∗
st
'
↦ₛ
FoldV
NONEV
-
∗
l
↦ₛ
#
false
-
∗
(
st
'
↦ₛ
FoldV
(
InjLV
#())
-
∗
l
↦ₛ
#
false
-
∗
{
E1
,
E2
;
Δ
;
Γ
}
⊨
t
≤
log
≤
fill
K
(
InjL
#())
:
τ
)
-
∗
(
st
'
↦ₛ
FoldV
NONEV
-
∗
l
↦ₛ
#
false
-
∗
{
E1
,
E2
;
Δ
;
Γ
}
⊨
t
≤
log
≤
fill
K
NONE
:
τ
)
-
∗
{
E1
,
E2
;
Δ
;
Γ
}
⊨
t
≤
log
≤
fill
K
((
CG_locked_pop
$
/
LitV
(
Loc
st
'
)
$
/
LitV
(
Loc
l
))
#())
:
τ
.
Proof
.
iIntros
(
?
)
"Hst' Hl Hlog"
.
...
...
theories/examples/stack/helping.v
View file @
a8c7557d
...
...
@@ -5,8 +5,8 @@ From iris_logrel Require Export logrel examples.stack.mailbox.
Definition
LIST
τ
:=
TRec
(
TSum
TUnit
(
TProd
τ
.[
ren
(
+
1
)]
(
TVar
0
))).
Notation
Conse
h
t
:=
(
Fold
(
InjR
(
Pair
h
t
))).
Notation
Nile
:=
(
Fold
(
InjL
#())
).
Notation
Conse
h
t
:=
(
Fold
(
SOME
(
Pair
h
t
))).
Notation
Nile
:=
(
Fold
NONE
).
Definition
pop_st
:
val
:=
λ
:
"r"
"get"
,
rec
:
"pop"
<>
:=
match:
"get"
#()
with
...
...
theories/examples/stack/mailbox.v
View file @
a8c7557d
...
...
@@ -2,20 +2,6 @@ From iris.proofmode Require Import tactics.
From
iris
.
algebra
Require
Import
excl
.
From
iris_logrel
Require
Export
logrel
.
Notation
MAYBE
τ
:=
(
TSum
TUnit
τ
)
(
only
parsing
).
Notation
NONE
:=
(
InjL
#())
(
only
parsing
).
Notation
SOME
x
:=
(
InjR
x
)
(
only
parsing
).
Notation
NONEV
:=
(
InjLV
#())
(
only
parsing
).
Notation
SOMEV
x
:=
(
InjRV
x
)
(
only
parsing
).
Notation
"'match:' e0 'with' 'NONE' => e1 | 'SOME' x => e2 'end'"
:=
(
Match
e0
BAnon
e1
x
%
bind
e2
)
(
e0
,
e1
,
x
,
e2
at
level
200
,
only
parsing
)
:
expr_scope
.
Notation
"'match:' e0 'with' 'SOME' x => e2 | 'NONE' => e1 'end'"
:=
(
Match
e0
BAnon
e1
x
%
bind
e2
)
(
e0
,
e1
,
x
,
e2
at
level
200
,
only
parsing
)
:
expr_scope
.
Definition
mk_offer
:
val
:=
λ
:
"v"
,
(
"v"
,
ref
#
0
).
Definition
revoke_offer
:
val
:=
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment