Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Paolo G. Giarrusso
examples
Commits
e9cfcda6
Commit
e9cfcda6
authored
Jun 16, 2018
by
Robbert Krebbers
Committed by
Ralf Jung
Jun 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `iAsimpl` more widely.
parent
45fa0a9c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
35 deletions
+35
-35
theories/logrel/F_mu_ref_conc/examples/counter.v
theories/logrel/F_mu_ref_conc/examples/counter.v
+6
-6
theories/logrel/F_mu_ref_conc/examples/lock.v
theories/logrel/F_mu_ref_conc/examples/lock.v
+4
-4
theories/logrel/F_mu_ref_conc/examples/stack/CG_stack.v
theories/logrel/F_mu_ref_conc/examples/stack/CG_stack.v
+12
-12
theories/logrel/F_mu_ref_conc/examples/stack/refinement.v
theories/logrel/F_mu_ref_conc/examples/stack/refinement.v
+0
-12
theories/logrel/F_mu_ref_conc/rules_binary.v
theories/logrel/F_mu_ref_conc/rules_binary.v
+12
-0
theories/logrel/F_mu_ref_conc/soundness_binary.v
theories/logrel/F_mu_ref_conc/soundness_binary.v
+1
-1
No files found.
theories/logrel/F_mu_ref_conc/examples/counter.v
View file @
e9cfcda6
...
...
@@ -165,7 +165,7 @@ Section CG_Counter.
Proof
.
intros
HNE
.
iIntros
"[#Hspec [Hx Hj]]"
.
unfold
counter_read
.
iMod
(
step_rec
_
_
j
K
_
Unit
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
iA
simpl
.
iMod
(
step_load
_
_
j
K
with
"[Hj Hx]"
)
as
"[Hj Hx]"
;
eauto
.
{
by
iFrame
"Hspec Hj"
.
}
iModIntro
.
by
iFrame
"Hj Hx"
.
...
...
@@ -264,12 +264,12 @@ Section CG_Counter.
iMod
(
steps_newlock
_
_
j
((
AppRCtx
(
RecV
_
))
::
K
)
_
with
"[Hj]"
)
as
(
l
)
"[Hj Hl]"
;
eauto
.
iMod
(
step_rec
_
_
j
K
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
rewrite
CG_locked_increment_subst
/=.
iA
simpl
.
rewrite
CG_locked_increment_subst
/=.
rewrite
counter_read_subst
/=.
iMod
(
step_alloc
_
_
j
((
AppRCtx
(
RecV
_
))
::
K
)
_
_
_
_
with
"[Hj]"
)
as
(
cnt'
)
"[Hj Hcnt']"
;
eauto
.
iMod
(
step_rec
_
_
j
K
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
rewrite
CG_locked_increment_subst
/=.
iA
simpl
.
rewrite
CG_locked_increment_subst
/=.
rewrite
counter_read_subst
/=.
Unshelve
.
all
:
try
match
goal
with
|-
to_val
_
=
_
=>
auto
using
to_of_val
end
.
...
...
@@ -284,7 +284,7 @@ Section CG_Counter.
iApply
fupd_wp
.
iMod
(
inv_alloc
counterN
with
"[Hinv]"
)
as
"#Hinv"
;
[
iNext
;
iExact
"Hinv"
|].
(* splitting increment and read *)
iApply
wp_pure_step_later
;
trivial
.
iModIntro
.
iNext
.
a
simpl
.
iApply
wp_pure_step_later
;
trivial
.
iModIntro
.
iNext
.
iA
simpl
.
rewrite
counter_read_subst
/=.
iApply
wp_value
;
auto
.
iExists
(
PairV
(
CG_locked_incrementV
_
_
)
(
counter_readV
_
))
;
simpl
.
...
...
@@ -296,7 +296,7 @@ Section CG_Counter.
rewrite
CG_locked_increment_of_val
/=.
destruct
v
;
iDestruct
"Heq"
as
"[% %]"
;
simplify_eq
/=.
iL
ö
b
as
"Hlat"
.
iApply
wp_pure_step_later
;
trivial
.
a
simpl
.
iNext
.
iApply
wp_pure_step_later
;
trivial
.
iA
simpl
.
iNext
.
(* fine-grained reads the counter *)
iApply
(
wp_bind
(
fill
[
AppRCtx
(
RecV
_
)]))
;
iApply
wp_wand_l
;
iSplitR
;
[
iIntros
(
v
)
"Hv"
;
iExact
"Hv"
|].
...
...
@@ -306,7 +306,7 @@ Section CG_Counter.
iModIntro
.
iNext
.
iIntros
"Hcnt"
.
iMod
(
"Hclose"
with
"[Hl Hcnt Hcnt']"
).
{
iNext
.
iExists
_
.
iFrame
"Hl Hcnt Hcnt'"
.
}
iApply
wp_pure_step_later
;
trivial
.
a
simpl
.
iModIntro
.
iNext
.
iApply
wp_pure_step_later
;
trivial
.
iA
simpl
.
iModIntro
.
iNext
.
(* fine-grained performs increment *)
iApply
(
wp_bind
(
fill
[
CasRCtx
(
LocV
_
)
(
NatV
_
)
;
IfCtx
_
_
]))
;
iApply
wp_wand_l
;
iSplitR
;
[
iIntros
(
v
)
"Hv"
;
iExact
"Hv"
|].
...
...
theories/logrel/F_mu_ref_conc/examples/lock.v
View file @
e9cfcda6
...
...
@@ -135,24 +135,24 @@ Section proof.
Proof
.
iIntros
(
HNE
H1
H2
)
"[#Hspec [HP [Hl Hj]]]"
.
iMod
(
step_rec
_
_
j
K
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
rewrite
H1
.
iA
simpl
.
rewrite
H1
.
iMod
(
steps_acquire
_
_
j
((
AppRCtx
(
RecV
_
))
::
K
)
_
_
with
"[Hj Hl]"
)
as
"[Hj Hl]"
;
eauto
.
{
simpl
.
iFrame
"Hspec Hj Hl"
;
eauto
.
}
simpl
.
iMod
(
step_rec
_
_
j
K
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
rewrite
H1
.
iA
simpl
.
rewrite
H1
.
iMod
(
H2
((
AppRCtx
(
RecV
_
))
::
K
)
with
"[Hj HP]"
)
as
"[Hj HQ]"
;
eauto
.
{
simpl
.
iFrame
"Hspec Hj HP"
;
eauto
.
}
simpl
.
iMod
(
step_rec
_
_
j
K
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
iA
simpl
.
iMod
(
steps_release
_
_
j
((
AppRCtx
(
RecV
_
))
::
K
)
_
_
with
"[Hj Hl]"
)
as
"[Hj Hl]"
;
eauto
.
{
simpl
.
by
iFrame
.
}
rewrite
?fill_app
/=.
iMod
(
step_rec
_
_
j
K
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
iModIntro
;
by
iFrame
.
iA
simpl
.
iModIntro
;
by
iFrame
.
Unshelve
.
all
:
try
match
goal
with
|-
to_val
_
=
_
=>
auto
using
to_of_val
end
.
trivial
.
...
...
theories/logrel/F_mu_ref_conc/examples/stack/CG_stack.v
View file @
e9cfcda6
...
...
@@ -83,7 +83,7 @@ Section CG_Stack.
Proof
.
intros
HNE
.
iIntros
"[#Hspec [Hx Hj]]"
.
unfold
CG_push
.
iMod
(
step_rec
_
_
j
K
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
iA
simpl
.
iMod
(
step_load
_
_
j
(
PairRCtx
_
::
InjRCtx
::
FoldCtx
::
StoreRCtx
(
LocV
_
)
::
K
)
_
_
_
with
"[Hj Hx]"
)
as
"[Hj Hx]"
;
eauto
.
simpl
.
iFrame
"Hspec Hj"
;
trivial
.
simpl
.
...
...
@@ -177,7 +177,7 @@ Section CG_Stack.
Proof
.
intros
HNE
.
iIntros
"[#Hspec [Hx Hj]]"
.
unfold
CG_pop
.
iMod
(
step_rec
_
_
j
K
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
iA
simpl
.
iMod
(
step_load
_
_
j
(
UnfoldCtx
::
CaseCtx
_
_
::
K
)
_
_
_
with
"[Hj Hx]"
)
as
"[Hj Hx]"
;
eauto
.
rewrite
?fill_app
.
simpl
.
...
...
@@ -187,7 +187,7 @@ Section CG_Stack.
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
simpl
.
iMod
(
step_case_inr
_
_
j
K
_
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
iA
simpl
.
iMod
(
step_snd
_
_
j
(
StoreRCtx
(
LocV
_
)
::
AppRCtx
(
RecV
_
)
::
K
)
_
_
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
simpl
.
...
...
@@ -197,7 +197,7 @@ Section CG_Stack.
iFrame
"Hspec Hj"
;
trivial
.
rewrite
?fill_app
.
simpl
.
iMod
(
step_rec
_
_
j
K
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
iA
simpl
.
iMod
(
step_fst
_
_
j
(
InjRCtx
::
K
)
_
_
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
simpl
.
...
...
@@ -215,14 +215,14 @@ Section CG_Stack.
Proof
.
iIntros
(
HNE
)
"[#Hspec [Hx Hj]]"
.
unfold
CG_pop
.
iMod
(
step_rec
_
_
j
K
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
iA
simpl
.
iMod
(
step_load
_
_
j
(
UnfoldCtx
::
CaseCtx
_
_
::
K
)
_
_
_
with
"[Hj Hx]"
)
as
"[Hj Hx]"
;
eauto
.
simpl
.
iFrame
"Hspec Hj"
;
trivial
.
simpl
.
iMod
(
step_Fold
_
_
j
(
CaseCtx
_
_
::
K
)
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
iMod
(
step_case_inl
_
_
j
K
_
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
iA
simpl
.
iModIntro
.
iFrame
"Hj Hx"
;
trivial
.
Unshelve
.
all
:
try
match
goal
with
|-
to_val
_
=
_
=>
simpl
;
by
rewrite
?to_of_val
end
.
...
...
@@ -336,7 +336,7 @@ Section CG_Stack.
with
"[Hj Hx Hl]"
)
as
"Hj"
;
last
done
;
[|
iFrame
;
iFrame
"#"
].
iIntros
(
K'
)
"[#Hspec [Hx Hj]]"
.
iMod
(
step_rec
_
_
j
K'
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
iA
simpl
.
iMod
(
step_load
_
_
j
K'
_
_
_
_
with
"[Hj Hx]"
)
as
"[Hj Hx]"
;
eauto
.
-
iFrame
"#"
;
iFrame
.
...
...
@@ -405,12 +405,12 @@ Section CG_Stack.
Proof
.
iIntros
(
HNE
)
"[#Hspec Hj]"
.
unfold
CG_iter
.
iMod
(
step_rec
_
_
j
K
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
rewrite
-
CG_iter_folding
.
Opaque
CG_iter
.
a
simpl
.
rewrite
-
CG_iter_folding
.
Opaque
CG_iter
.
iA
simpl
.
iMod
(
step_Fold
_
_
j
(
CaseCtx
_
_
::
K
)
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
iA
simpl
.
iMod
(
step_case_inr
_
_
j
K
_
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
iA
simpl
.
iMod
(
step_fst
_
_
j
(
AppRCtx
f
::
AppRCtx
(
RecV
_
)
::
K
)
_
_
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
Unshelve
.
...
...
@@ -426,10 +426,10 @@ Section CG_Stack.
Proof
.
iIntros
(
HNE
)
"[#Hspec Hj]"
.
unfold
CG_iter
.
iMod
(
step_rec
_
_
j
K
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
rewrite
-
CG_iter_folding
.
Opaque
CG_iter
.
a
simpl
.
rewrite
-
CG_iter_folding
.
Opaque
CG_iter
.
iA
simpl
.
iMod
(
step_Fold
_
_
j
(
CaseCtx
_
_
::
K
)
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
a
simpl
.
iA
simpl
.
iMod
(
step_case_inl
_
_
j
K
_
_
_
_
_
with
"[Hj]"
)
as
"Hj"
;
eauto
.
Unshelve
.
all
:
try
match
goal
with
|-
to_val
_
=
_
=>
simpl
;
by
rewrite
?to_of_val
end
.
...
...
theories/logrel/F_mu_ref_conc/examples/stack/refinement.v
View file @
e9cfcda6
...
...
@@ -8,18 +8,6 @@ From iris.proofmode Require Import tactics.
Definition
stackN
:
namespace
:
=
nroot
.@
"stack"
.
Ltac
iAsimpl
:
=
repeat
match
goal
with
|
|-
context
[
(
_
⤇
?e
)%
I
]
=>
progress
(
let
e'
:
=
fresh
"feed"
in
evar
(
e'
:
expr
)
;
assert
(
e
=
e'
)
as
->
;
[
asimpl
;
unfold
e'
;
reflexivity
|]
;
unfold
e'
;
clear
e'
)
|
|-
context
[
WP
?e
@
_
{{
_
}}%
I
]
=>
progress
(
let
e'
:
=
fresh
"feed"
in
evar
(
e'
:
expr
)
;
assert
(
e
=
e'
)
as
->
;
[
asimpl
;
unfold
e'
;
reflexivity
|]
;
unfold
e'
;
clear
e'
)
end
.
Section
Stack_refinement
.
Context
`
{
heapIG
Σ
,
cfgSG
Σ
,
inG
Σ
(
authR
stackUR
)}.
Notation
D
:
=
(
prodC
valC
valC
-
n
>
iProp
Σ
).
...
...
theories/logrel/F_mu_ref_conc/rules_binary.v
View file @
e9cfcda6
...
...
@@ -48,6 +48,18 @@ Notation "l ↦ₛ{ q } v" := (heapS_mapsto l q v)
Notation
"l ↦ₛ v"
:
=
(
heapS_mapsto
l
1
v
)
(
at
level
20
)
:
uPred_scope
.
Notation
"j ⤇ e"
:
=
(
tpool_mapsto
j
e
)
(
at
level
20
)
:
uPred_scope
.
Ltac
iAsimpl
:
=
repeat
match
goal
with
|
|-
context
[
(
_
⤇
?e
)%
I
]
=>
progress
(
let
e'
:
=
fresh
in
evar
(
e'
:
expr
)
;
assert
(
e
=
e'
)
as
->
;
[
asimpl
;
unfold
e'
;
reflexivity
|]
;
unfold
e'
;
clear
e'
)
|
|-
context
[
WP
?e
@
_
{{
_
}}%
I
]
=>
progress
(
let
e'
:
=
fresh
in
evar
(
e'
:
expr
)
;
assert
(
e
=
e'
)
as
->
;
[
asimpl
;
unfold
e'
;
reflexivity
|]
;
unfold
e'
;
clear
e'
)
end
.
Section
conversions
.
Context
`
{
cfgSG
Σ
}.
...
...
theories/logrel/F_mu_ref_conc/soundness_binary.v
View file @
e9cfcda6
...
...
@@ -31,7 +31,7 @@ Proof.
{
iApply
(@
logrel_binary
.
interp_env_nil
Σ
Heap
Σ
).
}
simpl
.
rewrite
empty_env_subst
empty_env_subst
.
iApply
(
"Hrel"
$!
0
[]).
{
rewrite
/
tpool_mapsto
.
a
simpl
.
by
iFrame
.
}
{
rewrite
/
tpool_mapsto
.
iA
simpl
.
by
iFrame
.
}
iModIntro
.
iIntros
(
v1
)
;
iDestruct
1
as
(
v2
)
"[Hj #Hinterp]"
.
iInv
specN
as
(
tp
σ
)
">[Hown Hsteps]"
"Hclose"
;
iDestruct
"Hsteps"
as
%
Hsteps'
.
rewrite
/
tpool_mapsto
/=.
...
...
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