Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
examples
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
Iris
examples
Commits
917d7705
Commit
917d7705
authored
Jun 24, 2019
by
Ralf Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bump Iris for CmpXchg change, and port everyting
parent
4223390a
Changes
17
Hide whitespace changes
Inline
Sidebyside
Showing
17 changed files
with
159 additions
and
151 deletions
+159
151
opam
opam
+1
1
concurrent_stack1.v
theories/concurrent_stacks/concurrent_stack1.v
+9
9
concurrent_stack2.v
theories/concurrent_stacks/concurrent_stack2.v
+17
17
concurrent_stack3.v
theories/concurrent_stacks/concurrent_stack3.v
+9
9
concurrent_stack4.v
theories/concurrent_stacks/concurrent_stack4.v
+18
18
fg_bag.v
theories/hocap/fg_bag.v
+10
10
coq_intro_example_2.v
theories/lecture_notes/coq_intro_example_2.v
+15
15
lock.v
theories/lecture_notes/lock.v
+6
4
lock_unary_spec.v
theories/lecture_notes/lock_unary_spec.v
+10
6
modular_incr.v
theories/lecture_notes/modular_incr.v
+5
5
cinc.v
theories/logatom/conditional_increment/cinc.v
+19
19
peritem.v
theories/logatom/flat_combiner/peritem.v
+5
5
atomic_snapshot.v
theories/logatom/snapshot/atomic_snapshot.v
+5
5
treiber.v
theories/logatom/treiber.v
+10
10
treiber2.v
theories/logatom/treiber2.v
+11
11
ltyping.v
theories/logrel_heaplang/ltyping.v
+4
3
spanning.v
theories/spanning_tree/spanning.v
+5
4
No files found.
opam
View file @
917d7705
...
@@ 9,6 +9,6 @@ build: [make "j%{jobs}%"]
...
@@ 9,6 +9,6 @@ build: [make "j%{jobs}%"]
install: [make "install"]
install: [make "install"]
remove: ["rm" "rf" "%{lib}%/coq/usercontrib/iris_examples"]
remove: ["rm" "rf" "%{lib}%/coq/usercontrib/iris_examples"]
depends: [
depends: [
"coqiris" { (= "dev.2019062
0.3.4f0c1046
")  (= "dev") }
"coqiris" { (= "dev.2019062
4.3.5ef58527
")  (= "dev") }
"coqautosubst" { = "dev.coq86" }
"coqautosubst" { = "dev.coq86" }
]
]
theories/concurrent_stacks/concurrent_stack1.v
View file @
917d7705
...
@@ 111,23 +111,23 @@ Section stacks.
...
@@ 111,23 +111,23 @@ Section stacks.
wp_load
.
wp_load
.
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
{
iNext
;
iExists
_,
_;
by
iFrame
.
}
{
iNext
;
iExists
_,
_;
by
iFrame
.
}
iModIntro
.
wp_let
.
wp_alloc
ℓ
'
as
"Hl'"
.
wp_pures
.
wp_bind
(
C
AS
_
_
_).
iModIntro
.
wp_let
.
wp_alloc
ℓ
'
as
"Hl'"
.
wp_pures
.
wp_bind
(
C
mpXchg
_
_
_).
iInv
N
as
(
ℓ
''
v''
)
"(>% & >Hl & Hlist)"
"Hclose"
;
simplify_eq
.
iInv
N
as
(
ℓ
''
v''
)
"(>% & >Hl & Hlist)"
"Hclose"
;
simplify_eq
.
destruct
(
decide
(
v'
=
v''
))
as
[>
Hne
].
destruct
(
decide
(
v'
=
v''
))
as
[>
Hne
].

wp_c
as
_suc
.
{
destruct
v''
;
left
;
done
.
}

wp_c
mpxchg
_suc
.
{
destruct
v''
;
left
;
done
.
}
iMod
(
"Hclose"
with
"[HP Hl Hl' Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[HP Hl Hl' Hlist]"
)
as
"_"
.
{
iNext
;
iExists
_,
(
Some
ℓ
'
);
iFrame
;
iSplit
;
first
done
;
{
iNext
;
iExists
_,
(
Some
ℓ
'
);
iFrame
;
iSplit
;
first
done
;
rewrite
(
is_list_unfold
_
(
Some
_)).
iExists
_,
_;
iFrame
;
eauto
.
}
rewrite
(
is_list_unfold
_
(
Some
_)).
iExists
_,
_;
iFrame
;
eauto
.
}
iModIntro
.
iModIntro
.
wp_
if
.
wp_
pures
.
by
iApply
"HΦ"
.
by
iApply
"HΦ"
.

wp_c
as
_fail
.

wp_c
mpxchg
_fail
.
{
destruct
v'
,
v''
;
simpl
;
congruence
.
}
{
destruct
v'
,
v''
;
simpl
;
congruence
.
}
{
destruct
v''
;
left
;
done
.
}
{
destruct
v''
;
left
;
done
.
}
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
{
iNext
;
iExists
_,
_;
by
iFrame
.
}
{
iNext
;
iExists
_,
_;
by
iFrame
.
}
iModIntro
.
iModIntro
.
wp_
if
.
wp_
pures
.
iApply
(
"IH"
with
"HP HΦ"
).
iApply
(
"IH"
with
"HP HΦ"
).
Qed
.
Qed
.
...
@@ 153,25 +153,25 @@ Section stacks.
...
@@ 153,25 +153,25 @@ Section stacks.
iMod
(
"Hclose"
with
"[Hl' Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl' Hlist]"
)
as
"_"
.
{
iNext
;
iExists
_,
_;
by
iFrame
.
}
{
iNext
;
iExists
_,
_;
by
iFrame
.
}
iModIntro
.
iModIntro
.
wp_pures
.
wp_bind
(
C
AS
_
_
_).
wp_pures
.
wp_bind
(
C
mpXchg
_
_
_).
iInv
N
as
(
ℓ
''
v''
)
"(>% & Hl' & Hlist)"
"Hclose"
.
simplify_eq
.
iInv
N
as
(
ℓ
''
v''
)
"(>% & Hl' & Hlist)"
"Hclose"
.
simplify_eq
.
destruct
(
decide
(
v''
=
(
Some
l
)))
as
[>
].
destruct
(
decide
(
v''
=
(
Some
l
)))
as
[>
].
*
rewrite
is_list_unfold
.
*
rewrite
is_list_unfold
.
iDestruct
"Hlist"
as
(
h'
t'
)
"(Hl'' & HP & Hlist)"
.
iDestruct
"Hlist"
as
(
h'
t'
)
"(Hl'' & HP & Hlist)"
.
iDestruct
"Hl''"
as
(
q'
)
"Hl''"
.
iDestruct
"Hl''"
as
(
q'
)
"Hl''"
.
simpl
.
simpl
.
wp_c
as
_suc
.
wp_c
mpxchg
_suc
.
iDestruct
(
mapsto_agree
with
"Hl'' Hl"
)
as
%[=
<
<%
oloc_to_val_inj
].
iDestruct
(
mapsto_agree
with
"Hl'' Hl"
)
as
%[=
<
<%
oloc_to_val_inj
].
iMod
(
"Hclose"
with
"[Hl' Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl' Hlist]"
)
as
"_"
.
{
iNext
;
iExists
ℓ
''
,
_;
by
iFrame
.
}
{
iNext
;
iExists
ℓ
''
,
_;
by
iFrame
.
}
iModIntro
.
iModIntro
.
wp_pures
.
wp_pures
.
iApply
(
"HΦ"
with
"[HP]"
);
iRight
;
iExists
_;
by
iFrame
.
iApply
(
"HΦ"
with
"[HP]"
);
iRight
;
iExists
_;
by
iFrame
.
*
wp_c
as
_fail
.
{
destruct
v''
;
simpl
;
congruence
.
}
*
wp_c
mpxchg
_fail
.
{
destruct
v''
;
simpl
;
congruence
.
}
iMod
(
"Hclose"
with
"[Hl' Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl' Hlist]"
)
as
"_"
.
{
iNext
;
iExists
ℓ
''
,
_;
by
iFrame
.
}
{
iNext
;
iExists
ℓ
''
,
_;
by
iFrame
.
}
iModIntro
.
iModIntro
.
wp_
if
.
wp_
pures
.
iApply
(
"IH"
with
"HΦ"
).
iApply
(
"IH"
with
"HΦ"
).
Qed
.
Qed
.
End
stacks
.
End
stacks
.
...
...
theories/concurrent_stacks/concurrent_stack2.v
View file @
917d7705
...
@@ 97,22 +97,22 @@ Section side_channel.
...
@@ 97,22 +97,22 @@ Section side_channel.
{{{
v'
,
RET
v'
;
(
∃
v''
:
val
,
⌜
v'
=
InjRV
v''
⌝
∗
P
v''
)
∨
⌜
v'
=
InjLV
#()
⌝
}}}.
{{{
v'
,
RET
v'
;
(
∃
v''
:
val
,
⌜
v'
=
InjRV
v''
⌝
∗
P
v''
)
∨
⌜
v'
=
InjLV
#()
⌝
}}}.
Proof
.
Proof
.
iIntros
(
Φ
)
"[Hinv Hγ] HΦ"
.
iDestruct
"Hinv"
as
(
v'
l
)
"[> #Hinv]"
.
iIntros
(
Φ
)
"[Hinv Hγ] HΦ"
.
iDestruct
"Hinv"
as
(
v'
l
)
"[> #Hinv]"
.
wp_lam
.
wp_bind
(
C
AS
_
_
_).
wp_pures
.
wp_lam
.
wp_bind
(
C
mpXchg
_
_
_).
wp_pures
.
iInv
N
as
"Hstages"
"Hclose"
.
iInv
N
as
"Hstages"
"Hclose"
.
iDestruct
"Hstages"
as
"[[Hl HP]  [H  [Hl H]]]"
.
iDestruct
"Hstages"
as
"[[Hl HP]  [H  [Hl H]]]"
.

wp_c
as
_suc
.

wp_c
mpxchg
_suc
.
iMod
(
"Hclose"
with
"[Hl Hγ]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl Hγ]"
)
as
"_"
.
{
iRight
;
iRight
;
iFrame
.
}
{
iRight
;
iRight
;
iFrame
.
}
iModIntro
.
iModIntro
.
wp_pures
.
wp_pures
.
by
iApply
"HΦ"
;
iLeft
;
iExists
_;
iSplit
.
by
iApply
"HΦ"
;
iLeft
;
iExists
_;
iSplit
.

wp_c
as
_fail
.

wp_c
mpxchg
_fail
.
iMod
(
"Hclose"
with
"[H]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[H]"
)
as
"_"
.
{
iRight
;
iLeft
;
auto
.
}
{
iRight
;
iLeft
;
auto
.
}
iModIntro
.
iModIntro
.
wp_pures
.
wp_pures
.
by
iApply
"HΦ"
;
iRight
.
by
iApply
"HΦ"
;
iRight
.

wp_c
as
_fail
.

wp_c
mpxchg
_fail
.
iDestruct
(
own_valid_2
with
"H Hγ"
)
as
%[].
iDestruct
(
own_valid_2
with
"H Hγ"
)
as
%[].
Qed
.
Qed
.
...
@@ 123,22 +123,22 @@ Section side_channel.
...
@@ 123,22 +123,22 @@ Section side_channel.
{{{
v'
,
RET
v'
;
(
∃
v''
:
val
,
⌜
v'
=
InjRV
v''
⌝
∗
P
v''
)
∨
⌜
v'
=
InjLV
#()
⌝
}}}.
{{{
v'
,
RET
v'
;
(
∃
v''
:
val
,
⌜
v'
=
InjRV
v''
⌝
∗
P
v''
)
∨
⌜
v'
=
InjLV
#()
⌝
}}}.
Proof
.
Proof
.
iIntros
(
Φ
)
"H HΦ"
;
iDestruct
"H"
as
(
v
l
)
"[> #Hinv]"
.
iIntros
(
Φ
)
"H HΦ"
;
iDestruct
"H"
as
(
v
l
)
"[> #Hinv]"
.
wp_lam
.
wp_proj
.
wp_bind
(
C
AS
_
_
_).
wp_lam
.
wp_proj
.
wp_bind
(
C
mpXchg
_
_
_).
iInv
N
as
"Hstages"
"Hclose"
.
iInv
N
as
"Hstages"
"Hclose"
.
iDestruct
"Hstages"
as
"[[H HP]  [H  [Hl Hγ]]]"
.
iDestruct
"Hstages"
as
"[[H HP]  [H  [Hl Hγ]]]"
.

wp_c
as
_suc
.

wp_c
mpxchg
_suc
.
iMod
(
"Hclose"
with
"[H]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[H]"
)
as
"_"
.
{
by
iRight
;
iLeft
.
}
{
by
iRight
;
iLeft
.
}
iModIntro
.
iModIntro
.
wp_pures
.
wp_pures
.
iApply
"HΦ"
;
iLeft
;
auto
.
iApply
"HΦ"
;
iLeft
;
auto
.

wp_c
as
_fail
.

wp_c
mpxchg
_fail
.
iMod
(
"Hclose"
with
"[H]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[H]"
)
as
"_"
.
{
by
iRight
;
iLeft
.
}
{
by
iRight
;
iLeft
.
}
iModIntro
.
iModIntro
.
wp_pures
.
wp_pures
.
iApply
"HΦ"
;
auto
.
iApply
"HΦ"
;
auto
.

wp_c
as
_fail
.

wp_c
mpxchg
_fail
.
iMod
(
"Hclose"
with
"[Hl Hγ]"
).
iMod
(
"Hclose"
with
"[Hl Hγ]"
).
{
iRight
;
iRight
;
iFrame
.
}
{
iRight
;
iRight
;
iFrame
.
}
iModIntro
.
iModIntro
.
...
@@ 326,23 +326,23 @@ Section stack_works.
...
@@ 326,23 +326,23 @@ Section stack_works.
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
{
iNext
;
iExists
_;
iFrame
.
}
{
iNext
;
iExists
_;
iFrame
.
}
iModIntro
.
iModIntro
.
wp_let
.
wp_alloc
l'
as
"Hl'"
.
wp_pures
.
wp_bind
(
C
AS
_
_
_).
wp_let
.
wp_alloc
l'
as
"Hl'"
.
wp_pures
.
wp_bind
(
C
mpXchg
_
_
_).
iInv
N
as
(
list
)
"(Hl & Hlist)"
"Hclose"
.
iInv
N
as
(
list
)
"(Hl & Hlist)"
"Hclose"
.
destruct
(
decide
(
v''
=
list
))
as
[
>
].
destruct
(
decide
(
v''
=
list
))
as
[
>
].
*
wp_c
as
_suc
.
{
destruct
list
;
left
;
done
.
}
*
wp_c
mpxchg
_suc
.
{
destruct
list
;
left
;
done
.
}
iMod
(
"Hclose"
with
"[HP Hl Hl' Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[HP Hl Hl' Hlist]"
)
as
"_"
.
{
iNext
;
iExists
(
Some
_);
iFrame
.
{
iNext
;
iExists
(
Some
_);
iFrame
.
rewrite
(
is_list_unfold
_
(
Some
_)).
iExists
_,
_;
iFrame
;
eauto
.
}
rewrite
(
is_list_unfold
_
(
Some
_)).
iExists
_,
_;
iFrame
;
eauto
.
}
iModIntro
.
iModIntro
.
wp_
if
.
wp_
pures
.
by
iApply
"HΦ"
.
by
iApply
"HΦ"
.
*
wp_c
as
_fail
.
*
wp_c
mpxchg
_fail
.
{
destruct
list
,
v''
;
simpl
;
congruence
.
}
{
destruct
list
,
v''
;
simpl
;
congruence
.
}
{
destruct
list
;
left
;
done
.
}
{
destruct
list
;
left
;
done
.
}
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
{
iNext
;
iExists
_;
by
iFrame
.
}
{
iNext
;
iExists
_;
by
iFrame
.
}
iModIntro
.
iModIntro
.
wp_
if
.
wp_
pures
.
iApply
(
"IH"
with
"HP HΦ"
).
iApply
(
"IH"
with
"HP HΦ"
).

wp_match
.

wp_match
.
by
iApply
"HΦ"
.
by
iApply
"HΦ"
.
...
@@ 373,24 +373,24 @@ Section stack_works.
...
@@ 373,24 +373,24 @@ Section stack_works.
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
{
iNext
;
iExists
_;
by
iFrame
.
}
{
iNext
;
iExists
_;
by
iFrame
.
}
iModIntro
.
iModIntro
.
wp_let
.
wp_proj
.
wp_bind
(
C
AS
_
_
_).
wp_pures
.
wp_let
.
wp_proj
.
wp_bind
(
C
mpXchg
_
_
_).
wp_pures
.
iInv
N
as
(
v''
)
"[Hl Hlist]"
"Hclose"
.
iInv
N
as
(
v''
)
"[Hl Hlist]"
"Hclose"
.
destruct
(
decide
(
v''
=
Some
list
))
as
[>
].
destruct
(
decide
(
v''
=
Some
list
))
as
[>
].
+
rewrite
is_list_unfold
.
+
rewrite
is_list_unfold
.
iDestruct
"Hlist"
as
(
h'
t'
)
"(Hl'' & HP & Hlist)"
.
iDestruct
"Hlist"
as
(
h'
t'
)
"(Hl'' & HP & Hlist)"
.
iDestruct
"Hl''"
as
(
q'
)
"Hl''"
.
iDestruct
"Hl''"
as
(
q'
)
"Hl''"
.
wp_c
as
_suc
.
wp_c
mpxchg
_suc
.
iDestruct
(
mapsto_agree
with
"Hl'' Hl'"
)
as
"%"
;
simplify_eq
.
iDestruct
(
mapsto_agree
with
"Hl'' Hl'"
)
as
"%"
;
simplify_eq
.
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
{
iNext
;
iExists
_;
by
iFrame
.
}
{
iNext
;
iExists
_;
by
iFrame
.
}
iModIntro
.
iModIntro
.
wp_pures
.
wp_pures
.
iApply
(
"HΦ"
with
"[HP]"
);
iRight
;
iExists
_;
by
iFrame
.
iApply
(
"HΦ"
with
"[HP]"
);
iRight
;
iExists
_;
by
iFrame
.
+
wp_c
as
_fail
.
{
destruct
v''
;
simpl
;
congruence
.
}
+
wp_c
mpxchg
_fail
.
{
destruct
v''
;
simpl
;
congruence
.
}
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl Hlist]"
)
as
"_"
.
{
iNext
;
iExists
_;
by
iFrame
.
}
{
iNext
;
iExists
_;
by
iFrame
.
}
iModIntro
.
iModIntro
.
wp_
if
.
wp_
pures
.
iApply
(
"IH"
with
"HΦ"
).
iApply
(
"IH"
with
"HΦ"
).

iDestruct
"HSome"
as
(
v
)
"[> HP]"
.

iDestruct
"HSome"
as
(
v
)
"[> HP]"
.
wp_pures
.
wp_pures
.
...
...
theories/concurrent_stacks/concurrent_stack3.v
View file @
917d7705
...
@@ 118,23 +118,23 @@ Section stack_works.
...
@@ 118,23 +118,23 @@ Section stack_works.
{
iNext
;
iExists
_,
_;
iFrame
.
}
{
iNext
;
iExists
_,
_;
iFrame
.
}
clear
xs
.
clear
xs
.
iModIntro
.
iModIntro
.
wp_let
.
wp_alloc
l'
as
"Hl'"
.
wp_pures
.
wp_bind
(
C
AS
_
_
_).
wp_let
.
wp_alloc
l'
as
"Hl'"
.
wp_pures
.
wp_bind
(
C
mpXchg
_
_
_).
iInv
N
as
(
list'
xs
)
"(Hl & Hlist & HP)"
"Hclose"
.
iInv
N
as
(
list'
xs
)
"(Hl & Hlist & HP)"
"Hclose"
.
destruct
(
decide
(
list
=
list'
))
as
[
>
].
destruct
(
decide
(
list
=
list'
))
as
[
>
].

wp_c
as
_suc
.
{
destruct
list'
;
left
;
done
.
}

wp_c
mpxchg
_suc
.
{
destruct
list'
;
left
;
done
.
}
iMod
(
"Hupd"
with
"HP"
)
as
"[HP HΨ]"
.
iMod
(
"Hupd"
with
"HP"
)
as
"[HP HΨ]"
.
iMod
(
"Hclose"
with
"[Hl Hl' HP Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl Hl' HP Hlist]"
)
as
"_"
.
{
iNext
;
iExists
(
Some
_),
(
v
::
xs
);
iFrame
;
iExists
_;
iFrame
;
auto
.
}
{
iNext
;
iExists
(
Some
_),
(
v
::
xs
);
iFrame
;
iExists
_;
iFrame
;
auto
.
}
iModIntro
.
iModIntro
.
wp_
if
.
wp_
pures
.
by
iApply
(
"HΦ"
with
"HΨ"
).
by
iApply
(
"HΦ"
with
"HΨ"
).

wp_c
as
_fail
.

wp_c
mpxchg
_fail
.
{
destruct
list
,
list'
;
simpl
;
congruence
.
}
{
destruct
list
,
list'
;
simpl
;
congruence
.
}
{
destruct
list'
;
left
;
done
.
}
{
destruct
list'
;
left
;
done
.
}
iMod
(
"Hclose"
with
"[Hl HP Hlist]"
).
iMod
(
"Hclose"
with
"[Hl HP Hlist]"
).
{
iExists
_,
_;
iFrame
.
}
{
iExists
_,
_;
iFrame
.
}
iModIntro
.
iModIntro
.
wp_
if
.
wp_
pures
.
iApply
(
"IH"
with
"Hupd HΦ"
).
iApply
(
"IH"
with
"Hupd HΦ"
).
Qed
.
Qed
.
...
@@ 172,10 +172,10 @@ Section stack_works.
...
@@ 172,10 +172,10 @@ Section stack_works.
iMod
(
"Hclose"
with
"[Hlist Hl HP]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hlist Hl HP]"
)
as
"_"
.
{
iNext
;
iExists
_,
_;
iFrame
.
}
{
iNext
;
iExists
_,
_;
iFrame
.
}
iModIntro
.
iModIntro
.
wp_let
.
wp_proj
.
wp_bind
(
C
AS
_
_
_).
wp_pures
.
wp_let
.
wp_proj
.
wp_bind
(
C
mpXchg
_
_
_).
wp_pures
.
iInv
N
as
(
v'
xs''
)
"(Hl & Hlist & HP)"
"Hclose"
.
iInv
N
as
(
v'
xs''
)
"(Hl & Hlist & HP)"
"Hclose"
.
destruct
(
decide
(
v'
=
(
Some
l'
)))
as
[
>
].
destruct
(
decide
(
v'
=
(
Some
l'
)))
as
[
>
].
*
wp_c
as
_suc
.
*
wp_c
mpxchg
_suc
.
iDestruct
(
is_list_cons
with
"[Hl'] Hlist"
)
as
(
ys
)
"%"
;
first
by
iExists
_.
iDestruct
(
is_list_cons
with
"[Hl'] Hlist"
)
as
(
ys
)
"%"
;
first
by
iExists
_.
simplify_eq
.
simplify_eq
.
iDestruct
"Hupd"
as
"[Hupdcons _]"
.
iDestruct
"Hupd"
as
"[Hupdcons _]"
.
...
@@ 188,11 +188,11 @@ Section stack_works.
...
@@ 188,11 +188,11 @@ Section stack_works.
iModIntro
.
iModIntro
.
wp_pures
.
wp_pures
.
iApply
(
"HΦ"
with
"HΨ"
).
iApply
(
"HΦ"
with
"HΨ"
).
*
wp_c
as
_fail
.
{
destruct
v'
;
simpl
;
congruence
.
}
*
wp_c
mpxchg
_fail
.
{
destruct
v'
;
simpl
;
congruence
.
}
iMod
(
"Hclose"
with
"[Hlist Hl HP]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hlist Hl HP]"
)
as
"_"
.
{
iNext
;
iExists
_,
_;
iFrame
.
}
{
iNext
;
iExists
_,
_;
iFrame
.
}
iModIntro
.
iModIntro
.
wp_
if
.
wp_
pures
.
iApply
(
"IH"
with
"Hupd HΦ"
).
iApply
(
"IH"
with
"Hupd HΦ"
).
Qed
.
Qed
.
End
stack_works
.
End
stack_works
.
...
...
theories/concurrent_stacks/concurrent_stack4.v
View file @
917d7705
...
@@ 119,24 +119,24 @@ Section proofs.
...
@@ 119,24 +119,24 @@ Section proofs.
{{{
v'
,
RET
v'
;
(
∃
v''
:
val
,
⌜
v'
=
InjRV
v''
⌝
∗
can_push
P
Q
v''
)
∨
(
⌜
v'
=
InjLV
#()
⌝
∗
(
Q
#()))
}}}.
{{{
v'
,
RET
v'
;
(
∃
v''
:
val
,
⌜
v'
=
InjRV
v''
⌝
∗
can_push
P
Q
v''
)
∨
(
⌜
v'
=
InjLV
#()
⌝
∗
(
Q
#()))
}}}.
Proof
.
Proof
.
iIntros
(
Φ
)
"[Hinv Hγ] HΦ"
.
iDestruct
"Hinv"
as
(
v'
l
)
"[> #Hinv]"
.
iIntros
(
Φ
)
"[Hinv Hγ] HΦ"
.
iDestruct
"Hinv"
as
(
v'
l
)
"[> #Hinv]"
.
wp_lam
.
wp_pures
.
wp_bind
(
C
AS
_
_
_).
wp_lam
.
wp_pures
.
wp_bind
(
C
mpXchg
_
_
_).
iInv
Nside_channel
as
"Hstages"
"Hclose"
.
iInv
Nside_channel
as
"Hstages"
"Hclose"
.
iDestruct
"Hstages"
as
"[[Hl HP]  [[Hl HQ]  [[Hl H]  [Hl H]]]]"
.
iDestruct
"Hstages"
as
"[[Hl HP]  [[Hl HQ]  [[Hl H]  [Hl H]]]]"
.

wp_c
as
_suc
.

wp_c
mpxchg
_suc
.
iMod
(
"Hclose"
with
"[Hl Hγ]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl Hγ]"
)
as
"_"
.
{
iNext
;
iRight
;
iRight
;
iFrame
.
}
{
iNext
;
iRight
;
iRight
;
iFrame
.
}
iModIntro
.
iModIntro
.
wp_pures
.
wp_pures
.
by
iApply
"HΦ"
;
iLeft
;
iExists
_;
iFrame
.
by
iApply
"HΦ"
;
iLeft
;
iExists
_;
iFrame
.

wp_c
as
_fail
.

wp_c
mpxchg
_fail
.
iMod
(
"Hclose"
with
"[Hl Hγ]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl Hγ]"
)
as
"_"
.
{
iNext
;
iRight
;
iRight
;
iLeft
;
iFrame
.
}
{
iNext
;
iRight
;
iRight
;
iLeft
;
iFrame
.
}
iModIntro
.
iModIntro
.
wp_pures
.
wp_pures
.
iApply
(
"HΦ"
with
"[HQ]"
);
iRight
;
auto
.
iApply
(
"HΦ"
with
"[HQ]"
);
iRight
;
auto
.

wp_c
as
_fail
.

wp_c
mpxchg
_fail
.
iDestruct
(
own_valid_2
with
"H Hγ"
)
as
%[].
iDestruct
(
own_valid_2
with
"H Hγ"
)
as
%[].

wp_c
as
_fail
.

wp_c
mpxchg
_fail
.
iDestruct
(
own_valid_2
with
"H Hγ"
)
as
%[].
iDestruct
(
own_valid_2
with
"H Hγ"
)
as
%[].
Qed
.
Qed
.
...
@@ 149,11 +149,11 @@ Section proofs.
...
@@ 149,11 +149,11 @@ Section proofs.
(
∃
v''
:
val
,
⌜
v'
=
InjRV
v''
⌝
∗
Ψ
v'
)
∨
(
⌜
v'
=
InjLV
#()
⌝
∗
(
do_pop
∧
Q'
))
}}}.
(
∃
v''
:
val
,
⌜
v'
=
InjRV
v''
⌝
∗
Ψ
v'
)
∨
(
⌜
v'
=
InjLV
#()
⌝
∗
(
do_pop
∧
Q'
))
}}}.
Proof
.
Proof
.
simpl
;
iIntros
(
Φ
)
"[H [Hopener Hupd]] HΦ"
;
iDestruct
"H"
as
(
v
l
)
"[> #Hinv]"
.
simpl
;
iIntros
(
Φ
)
"[H [Hopener Hupd]] HΦ"
;
iDestruct
"H"
as
(
v
l
)
"[> #Hinv]"
.
wp_lam
.
wp_proj
.
wp_bind
(
C
AS
_
_
_).
wp_lam
.
wp_proj
.
wp_bind
(
C
mpXchg
_
_
_).
iInv
Nside_channel
as
"Hstages"
"Hclose"
.
iInv
Nside_channel
as
"Hstages"
"Hclose"
.
iDestruct
"Hstages"
as
"[[Hl Hpush]  [[Hl HQ]  [[Hl Hγ]  [Hl Hγ]]]]"
.
iDestruct
"Hstages"
as
"[[Hl Hpush]  [[Hl HQ]  [[Hl Hγ]  [Hl Hγ]]]]"
.

iMod
"Hopener"
as
(
xs
)
"[HP Hcloser]"
.

iMod
"Hopener"
as
(
xs
)
"[HP Hcloser]"
.
wp_c
as
_suc
.
wp_c
mpxchg
_suc
.
iMod
(
"Hpush"
with
"HP"
)
as
"[HP HQ]"
.
iMod
(
"Hpush"
with
"HP"
)
as
"[HP HQ]"
.
iMod
(
"Hupd"
with
"HP"
)
as
"[HP HΨ]"
.
iMod
(
"Hupd"
with
"HP"
)
as
"[HP HΨ]"
.
iMod
(
"Hcloser"
with
"HP"
)
as
"_"
.
iMod
(
"Hcloser"
with
"HP"
)
as
"_"
.
...
@@ 162,19 +162,19 @@ Section proofs.
...
@@ 162,19 +162,19 @@ Section proofs.
iApply
fupd_intro_mask
;
first
done
.
iApply
fupd_intro_mask
;
first
done
.
wp_pures
.
wp_pures
.
iApply
"HΦ"
;
iLeft
;
auto
.
iApply
"HΦ"
;
iLeft
;
auto
.

wp_c
as
_fail
.

wp_c
mpxchg
_fail
.
iMod
(
"Hclose"
with
"[Hl HQ]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl HQ]"
)
as
"_"
.
{
iRight
;
iLeft
;
iFrame
.
}
{
iRight
;
iLeft
;
iFrame
.
}
iModIntro
.
iModIntro
.
wp_pures
.
wp_pures
.
iApply
"HΦ"
;
auto
.
iApply
"HΦ"
;
auto
.

wp_c
as
_fail
.

wp_c
mpxchg
_fail
.
iMod
(
"Hclose"
with
"[Hl Hγ]"
).
iMod
(
"Hclose"
with
"[Hl Hγ]"
).
{
iRight
;
iRight
;
iFrame
.
}
{
iRight
;
iRight
;
iFrame
.
}
iModIntro
.
iModIntro
.
wp_pures
.
wp_pures
.
iApply
"HΦ"
;
auto
.
iApply
"HΦ"
;
auto
.

wp_c
as
_fail
.

wp_c
mpxchg
_fail
.
iMod
(
"Hclose"
with
"[Hl Hγ]"
).
iMod
(
"Hclose"
with
"[Hl Hγ]"
).
{
iRight
;
iRight
;
iFrame
.
}
{
iRight
;
iRight
;
iFrame
.
}
iModIntro
.
iModIntro
.
...
@@ 350,25 +350,25 @@ Section proofs.
...
@@ 350,25 +350,25 @@ Section proofs.
{
iNext
;
iExists
_,
_;
iFrame
.
}
{
iNext
;
iExists
_,
_;
iFrame
.
}
clear
xs
.
clear
xs
.
iModIntro
.
iModIntro
.
wp_let
.
wp_alloc
l'
as
"Hl'"
.
wp_pures
.
wp_bind
(
C
AS
_
_
_).
wp_let
.
wp_alloc
l'
as
"Hl'"
.
wp_pures
.
wp_bind
(
C
mpXchg
_
_
_).
iInv
Nstack
as
(
list'
xs
)
"(Hl & Hlist & HP)"
"Hclose"
.
iInv
Nstack
as
(
list'
xs
)
"(Hl & Hlist & HP)"
"Hclose"
.
destruct
(
decide
(
list
=
list'
))
as
[
>
].
destruct
(
decide
(
list
=
list'
))
as
[
>
].
*
wp_c
as
_suc
.
{
destruct
list'
;
left
;
done
.
}
*
wp_c
mpxchg
_suc
.
{
destruct
list'
;
left
;
done
.
}
iMod
(
fupd_intro_mask'
(
⊤
∖
↑
Nstack
)
inner_mask
)
as
"Hupd'"
;
first
solve_ndisj
.
iMod
(
fupd_intro_mask'
(
⊤
∖
↑
Nstack
)
inner_mask
)
as
"Hupd'"
;
first
solve_ndisj
.
iMod
(
"Hupd"
with
"HP"
)
as
"[HP HΨ]"
.
iMod
(
"Hupd"
with
"HP"
)
as
"[HP HΨ]"
.
iMod
"Hupd'"
as
"_"
.
iMod
"Hupd'"
as
"_"
.
iMod
(
"Hclose"
with
"[Hl Hl' HP Hlist]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hl Hl' HP Hlist]"
)
as
"_"
.
{
iNext
;
iExists
(
Some
_),
(
v'
::
xs
);
iFrame
;
iExists
_;
iFrame
;
auto
.
}
{
iNext
;
iExists
(
Some
_),
(
v'
::
xs
);
iFrame
;
iExists
_;
iFrame
;
auto
.
}
iModIntro
.
iModIntro
.
wp_
if
.
wp_
pures
.
by
iApply
(
"HΦ"
with
"HΨ"
).
by
iApply
(
"HΦ"
with
"HΨ"
).
*
wp_c
as
_fail
.
*
wp_c
mpxchg
_fail
.
{
destruct
list
,
list'
;
simpl
;
congruence
.
}
{
destruct
list
,
list'
;
simpl
;
congruence
.
}
{
destruct
list'
;
left
;
done
.
}
{
destruct
list'
;
left
;
done
.
}
iMod
(
"Hclose"
with
"[Hl HP Hlist]"
).
iMod
(
"Hclose"
with
"[Hl HP Hlist]"
).
{
iExists
_,
_;
iFrame
.
}
{
iExists
_,
_;
iFrame
.
}
iModIntro
.
iModIntro
.
wp_
if
.
wp_
pures
.
iApply
(
"IH"
with
"HΦ Hupd"
).
iApply
(
"IH"
with
"HΦ Hupd"
).

wp_match
.
iApply
(
"HΦ"
with
"HΨ"
).

wp_match
.
iApply
(
"HΦ"
with
"HΨ"
).
Qed
.
Qed
.
...
@@ 426,10 +426,10 @@ Section proofs.
...
@@ 426,10 +426,10 @@ Section proofs.
iMod
(
"Hclose"
with
"[Hlist Hl HP]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hlist Hl HP]"
)
as
"_"
.
{
iNext
;
iExists
_,
_;
iFrame
.
}
{
iNext
;
iExists
_,
_;
iFrame
.
}
iModIntro
.
iModIntro
.
wp_pures
.
wp_bind
(
C
AS
_
_
_).
wp_pures
.
wp_bind
(
C
mpXchg
_
_
_).
iInv
Nstack
as
(
v'
xs''
)
"(Hl & Hlist & HP)"
"Hclose"
.
iInv
Nstack
as
(
v'
xs''
)
"(Hl & Hlist & HP)"
"Hclose"
.
destruct
(
decide
(
v'
=
(
Some
l'
)))
as
[
>
].
destruct
(
decide
(
v'
=
(
Some
l'
)))
as
[
>
].
+
wp_c
as
_suc
.
+
wp_c
mpxchg
_suc
.
iDestruct
(
is_list_cons
with
"[Hl'] Hlist"
)
as
(
ys
)
"%"
;
first
by
iExists
_.
iDestruct
(
is_list_cons
with
"[Hl'] Hlist"
)
as
(
ys
)
"%"
;
first
by
iExists
_.
simplify_eq
.
simplify_eq
.
iMod
(
fupd_intro_mask'
(
⊤
∖
↑
Nstack
)
inner_mask
)
as
"Hupd'"
;
first
solve_ndisj
.
iMod
(
fupd_intro_mask'
(
⊤
∖
↑
Nstack
)
inner_mask
)
as
"Hupd'"
;
first
solve_ndisj
.
...
@@ 444,7 +444,7 @@ Section proofs.
...
@@ 444,7 +444,7 @@ Section proofs.
iModIntro
.
iModIntro
.
wp_pures
.
wp_pures
.
iApply
(
"HΦ"
with
"HΨ"
).
iApply
(
"HΦ"
with
"HΨ"
).
+
wp_c
as
_fail
.
{
destruct
v'
;
simpl
;
congruence
.
}
+
wp_c
mpxchg
_fail
.
{
destruct
v'
;
simpl
;
congruence
.
}
iMod
(
"Hclose"
with
"[Hlist Hl HP]"
)
as
"_"
.
iMod
(
"Hclose"
with
"[Hlist Hl HP]"
)
as
"_"
.
{
iNext
;
iExists
_,
_;
iFrame
.
}
{
iNext
;
iExists
_,
_;
iFrame
.
}
iModIntro
.
iModIntro
.
...
...
theories/hocap/fg_bag.v
View file @
917d7705
...
@@ 162,21 +162,21 @@ Section proof.
...
@@ 162,21 +162,21 @@ Section proof.
{
iNext
.
iExists
_,_.
iFrame
.
}
clear
ls
.
{
iNext
.
iExists
_,_.
iFrame
.
}
clear
ls
.
iModIntro
.
iModIntro
.
wp_alloc
n
as
"Hn"
.
wp_alloc
n
as
"Hn"
.
wp_pures
.
wp_bind
(
C
AS
_
_
_).
wp_pures
.
wp_bind
(
C
mpXchg
_
_
_).
iInv
N
as
(
o'
ls
)
"[Ho [Hls >Hb]]"
"Hcl"
.
iInv
N
as
(
o'
ls
)
"[Ho [Hls >Hb]]"
"Hcl"
.
destruct
(
decide
(
o
=
o'
))
as
[>?].
destruct
(
decide
(
o
=
o'
))
as
[>?].

wp_c
as
_suc
.
{
destruct
o'
;
left
;
done
.
}

wp_c
mpxchg
_suc
.
{
destruct
o'
;
left
;
done
.
}
iMod
(
"Hvs"
with
"[$Hb $HP]"
)
as
"[Hb HQ]"
.
iMod
(
"Hvs"
with
"[$Hb $HP]"
)
as
"[Hb HQ]"
.
iMod
(
"Hcl"
with
"[Ho Hn Hls Hb]"
)
as
"_"
.
iMod
(
"Hcl"
with
"[Ho Hn Hls Hb]"
)
as
"_"
.
{
iNext
.
iExists
(
Some
_),(
v
::
ls
).
iFrame
"Ho Hb"
.
{
iNext
.
iExists
(
Some
_),(
v
::
ls
).
iFrame
"Ho Hb"
.
simpl
.
iExists
_.
iFrame
.
by
iExists
1
%
Qp
.
}
simpl
.
iExists
_.
iFrame
.
by
iExists
1
%
Qp
.
}
iModIntro
.
wp_
if_true
.
by
iApply
"HΦ"
.
iModIntro
.
wp_
pures
.
by
iApply
"HΦ"
.

wp_c
as
_fail
.

wp_c
mpxchg
_fail
.
{
destruct
o
,
o'
;
simpl
;
congruence
.
}
{
destruct
o
,
o'
;
simpl
;
congruence
.
}
{
destruct
o'
;
left
;
done
.
}
{
destruct
o'
;
left
;
done
.
}
iMod
(
"Hcl"
with
"[Ho Hls Hb]"
)
as
"_"
.
iMod
(
"Hcl"
with
"[Ho Hls Hb]"
)
as
"_"
.
{
iNext
.
iExists
_,
ls
.
by
iFrame
"Ho Hb"
.
}
{
iNext
.
iExists
_,
ls
.
by
iFrame
"Ho Hb"
.
}
iModIntro
.
wp_
if_false
.
iModIntro
.
wp_
proj
.
wp_if
.
by
iApply
(
"IH"
with
"HP [HΦ]"
).
by
iApply
(
"IH"
with
"HP [HΦ]"
).
Qed
.
Qed
.
...
@@ 214,11 +214,11 @@ Section proof.
...
@@ 214,11 +214,11 @@ Section proof.
iExists
_;
eauto
.
by
iFrame
.
}
iExists
_;
eauto
.
by
iFrame
.
}
iModIntro
.
repeat
wp_pure
_.
iModIntro
.
repeat
wp_pure
_.
iDestruct
"Hhd'"
as
(
q
)
"Hhd"
.
iDestruct
"Hhd'"
as
(
q
)
"Hhd"
.
wp_load
.
repeat
wp_pure
_
.
wp_load
.
wp_pures
.
wp_bind
(
C
AS
_
_
_).
wp_bind
(
C
mpXchg
_
_
_).
iInv
N
as
(
o'
ls'
)
"[Ho [Hls >Hb]]"
"Hcl"
.
iInv
N
as
(
o'
ls'
)
"[Ho [Hls >Hb]]"
"Hcl"
.
destruct
(
decide
(
o'
=
(
Some
hd
)))
as
[>?].
destruct
(
decide
(
o'
=
(
Some
hd
)))
as
[>?].
+
wp_c
as
_suc
.
+
wp_c
mpxchg
_suc
.
(* The list is still the same *)
(* The list is still the same *)
rewrite
(
is_list_duplicate
tl
).
iDestruct
"Hls'"
as
"[Hls' Htl]"
.
rewrite
(
is_list_duplicate
tl
).
iDestruct
"Hls'"
as
"[Hls' Htl]"
.
iAssert
(
is_list
(
Some
hd
)
(
x
::
ls
))
with
"[Hhd Hls']"
as
"Hls'"
.
iAssert
(
is_list
(
Some
hd
)
(
x
::
ls
))
with
"[Hhd Hls']"
as
"Hls'"
.
...
@@ 230,10 +230,10 @@ Section proof.
...
@@ 230,10 +230,10 @@ Section proof.
iMod
(
"Hcl"
with
"[Ho Htl Hb]"
)
as
"_"
.
iMod
(
"Hcl"
with
"[Ho Htl Hb]"
)
as
"_"
.
{
iNext
.
iExists
_,
ls
.
by
iFrame
"Ho Hb"
.
}
{
iNext
.
iExists
_,
ls
.
by
iFrame
"Ho Hb"
.
}
iModIntro
.
wp_pures
.
by
iApply
"HΦ"
.
iModIntro
.
wp_pures
.
by
iApply
"HΦ"
.
+
wp_c
as
_fail
.
{
destruct
o'
;
simpl
;
congruence
.
}
+
wp_c
mpxchg
_fail
.
{
destruct
o'
;
simpl
;
congruence
.
}
iMod
(
"Hcl"
with
"[Ho Hls Hb]"
)
as
"_"
.
iMod
(
"Hcl"
with
"[Ho Hls Hb]"
)
as
"_"
.
{
iNext
.
iExists
_,
ls'
.
by
iFrame
"Ho Hb"
.
}
{
iNext
.
iExists
_,
ls'
.
by
iFrame
"Ho Hb"
.
}
iModIntro
.
wp_
if_false
.
iModIntro
.
wp_
proj
.
wp_if
.
by
iApply
(
"IH"
with
"HP [HΦ]"
).
by
iApply
(
"IH"
with
"HP [HΦ]"
).
Qed
.
Qed
.
End
proof
.
End
proof
.
...
...
theories/lecture_notes/coq_intro_example_2.v
View file @
917d7705
...
@@ 316,10 +316,10 @@ Section monotone_counter.
...
@@ 316,10 +316,10 @@ Section monotone_counter.
{
iNext
;
iExists
m
;
iFrame
.
}
{
iNext
;
iExists
m
;
iFrame
.
}
iModIntro
.
iModIntro
.
wp_let
;
wp_op
;
wp_let
.
wp_let
;
wp_op
;
wp_let
.
wp_bind
(
C
AS
_
_
_)%
E
.
wp_bind
(
C
mpXchg
_
_
_)%
E
.
iInv
N
as
(
k
)
">[Hpt HOwnAuth]"
"HClose"
.
iInv
N
as
(
k
)
">[Hpt HOwnAuth]"
"HClose"
.
destruct
(
decide
(
k
=
m
));
subst
.
destruct
(
decide
(
k
=
m
));
subst
.
+
wp_c
as
_suc
.
+
wp_c
mpxchg
_suc
.
(* If the CAS succeeds we need to update our ghost state. This is achieved using the own_update rule/lemma.
(* If the CAS succeeds we need to update our ghost state. This is achieved using the own_update rule/lemma.
The arguments are the ghost name and the ghost resources x from which and to which we are updating.
The arguments are the ghost name and the ghost resources x from which and to which we are updating.
<