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
Abhishek Anand
Iris
Commits
a5ff3f99
Commit
a5ff3f99
authored
6 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
define a general make_laterable construct and use it for atomic updates
parent
469c810a
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
theories/bi/lib/atomic.v
+8
-13
8 additions, 13 deletions
theories/bi/lib/atomic.v
theories/bi/lib/laterable.v
+43
-0
43 additions, 0 deletions
theories/bi/lib/laterable.v
with
51 additions
and
13 deletions
theories/bi/lib/atomic.v
+
8
−
13
View file @
a5ff3f99
...
@@ -64,21 +64,19 @@ Section definition.
...
@@ -64,21 +64,19 @@ Section definition.
Qed
.
Qed
.
(** atomic_update as a fixed-point of the equation
(** atomic_update as a fixed-point of the equation
AU = ∃ P. ▷ P ∗ □ (▷ P ==∗ α ∗ (α ==∗ AU) ∧ (β ==∗ Q))
AU = make_laterable $ atomic_acc α AU β Q
= ∃ P. ▷ P ∗ □ (▷ P -∗ atomic_acc α AU β Q)
*)
*)
Context
Eo
Ei
α
β
Φ
.
Context
Eo
Ei
α
β
Φ
.
Definition
atomic_update_pre
(
Ψ
:
()
→
PROP
)
(_
:
())
:
PROP
:=
Definition
atomic_update_pre
(
Ψ
:
()
→
PROP
)
(_
:
())
:
PROP
:=
(
∃
(
P
:
PROP
),
▷
P
∗
make_laterable
$
atomic_acc
Eo
Ei
α
(
Ψ
())
β
Φ
.
□
(
▷
P
-∗
atomic_acc
Eo
Ei
α
(
Ψ
())
β
Φ
))
%
I
.
Local
Instance
atomic_update_pre_mono
:
BiMonoPred
atomic_update_pre
.
Local
Instance
atomic_update_pre_mono
:
BiMonoPred
atomic_update_pre
.
Proof
.
Proof
.
constructor
.
constructor
.
-
iIntros
(
P1
P2
)
"#HP12"
.
iIntros
([])
"AU"
.
-
iIntros
(
P1
P2
)
"#HP12"
.
iIntros
([])
"AU"
.
i
Destruct
"AU"
as
(
P
)
"[HP #AS]"
.
iExists
P
.
iFrame
.
i
Apply
(
make_laterable_wand
with
"[] AU"
)
.
iIntros
"!#
HP
"
.
iApply
(
atomic_acc_wand
with
"[HP12]
"
);
last
by
iApply
"AS"
.
iIntros
"!#
AA
"
.
iApply
(
atomic_acc_wand
with
"[HP12]
AA"
)
.
iSplit
;
last
by
eauto
.
iApply
"HP12"
.
iSplit
;
last
by
eauto
.
iApply
"HP12"
.
-
intros
??
.
solve_proper
.
-
intros
??
.
solve_proper
.
Qed
.
Qed
.
...
@@ -256,7 +254,7 @@ Section lemmas.
...
@@ -256,7 +254,7 @@ Section lemmas.
Proof
using
Type
*.
Proof
using
Type
*.
rewrite
atomic_update_eq
{
1
}
/
atomic_update_def
/=.
iIntros
"HUpd"
.
rewrite
atomic_update_eq
{
1
}
/
atomic_update_def
/=.
iIntros
"HUpd"
.
iPoseProof
(
greatest_fixpoint_unfold_1
with
"HUpd"
)
as
"HUpd"
.
iPoseProof
(
greatest_fixpoint_unfold_1
with
"HUpd"
)
as
"HUpd"
.
i
Destruct
"HUpd"
as
(
P
)
"(HP & Hshift)"
.
by
iApply
"Hshift"
.
i
Apply
make_laterable_elim
.
done
.
Qed
.
Qed
.
(* This lets you eliminate atomic updates with iMod. *)
(* This lets you eliminate atomic updates with iMod. *)
...
@@ -278,10 +276,8 @@ Section lemmas.
...
@@ -278,10 +276,8 @@ Section lemmas.
Global
Instance
aupd_laterable
Eo
Ei
α
β
Φ
:
Global
Instance
aupd_laterable
Eo
Ei
α
β
Φ
:
Laterable
(
atomic_update
Eo
Ei
α
β
Φ
)
.
Laterable
(
atomic_update
Eo
Ei
α
β
Φ
)
.
Proof
.
Proof
.
rewrite
/
Laterable
atomic_update_eq
{
1
}
/
atomic_update_def
/=.
iIntros
"AU"
.
rewrite
atomic_update_eq
{
1
}
/
atomic_update_def
greatest_fixpoint_unfold
.
iPoseProof
(
greatest_fixpoint_unfold_1
with
"AU"
)
as
(
P
)
"[HP #AS]"
.
apply
_
.
iExists
P
.
iFrame
.
iIntros
"!# HP !>"
.
iApply
greatest_fixpoint_unfold_2
.
iExists
P
.
iFrame
"#∗"
.
Qed
.
Qed
.
Lemma
aupd_intro
P
Q
α
β
Eo
Ei
Φ
:
Lemma
aupd_intro
P
Q
α
β
Eo
Ei
Φ
:
...
@@ -292,8 +288,7 @@ Section lemmas.
...
@@ -292,8 +288,7 @@ Section lemmas.
rewrite
atomic_update_eq
{
1
}
/
atomic_update_def
/=.
rewrite
atomic_update_eq
{
1
}
/
atomic_update_def
/=.
iIntros
(???
HAU
)
"[#HP HQ]"
.
iIntros
(???
HAU
)
"[#HP HQ]"
.
iApply
(
greatest_fixpoint_coind
_
(
λ
_,
Q
));
last
done
.
iIntros
"!#"
([])
"HQ"
.
iApply
(
greatest_fixpoint_coind
_
(
λ
_,
Q
));
last
done
.
iIntros
"!#"
([])
"HQ"
.
iDestruct
(
laterable
with
"HQ"
)
as
(
Q'
)
"[HQ' #HQi]"
.
iExists
Q'
.
iFrame
.
iApply
(
make_laterable_intro
with
"[] HQ"
)
.
iIntros
"!# >HQ"
.
iIntros
"!# HQ'"
.
iDestruct
(
"HQi"
with
"HQ'"
)
as
">HQ {HQi}"
.
iApply
HAU
.
by
iFrame
.
iApply
HAU
.
by
iFrame
.
Qed
.
Qed
.
...
...
This diff is collapsed.
Click to expand it.
theories/bi/lib/laterable.v
+
43
−
0
View file @
a5ff3f99
...
@@ -14,6 +14,9 @@ Section instances.
...
@@ -14,6 +14,9 @@ Section instances.
Implicit
Types
P
:
PROP
.
Implicit
Types
P
:
PROP
.
Implicit
Types
Ps
:
list
PROP
.
Implicit
Types
Ps
:
list
PROP
.
Global
Instance
laterable_proper
:
Proper
((
⊣⊢
)
==>
(
↔
))
(
@
Laterable
PROP
)
.
Proof
.
solve_proper
.
Qed
.
Global
Instance
later_laterable
P
:
Laterable
(
▷
P
)
.
Global
Instance
later_laterable
P
:
Laterable
(
▷
P
)
.
Proof
.
Proof
.
rewrite
/
Laterable
.
iIntros
"HP"
.
iExists
P
.
iFrame
.
rewrite
/
Laterable
.
iIntros
"HP"
.
iExists
P
.
iFrame
.
...
@@ -57,4 +60,44 @@ Section instances.
...
@@ -57,4 +60,44 @@ Section instances.
TCForall
Laterable
Ps
→
TCForall
Laterable
Ps
→
Laterable
([
∗
]
Ps
)
.
Laterable
([
∗
]
Ps
)
.
Proof
.
induction
2
;
simpl
;
apply
_
.
Qed
.
Proof
.
induction
2
;
simpl
;
apply
_
.
Qed
.
(* A wrapper to obtain a weaker, laterable form of any assertion. *)
Definition
make_laterable
(
Q
:
PROP
)
:
PROP
:=
(
∃
P
,
▷
P
∗
□
(
▷
P
-∗
Q
))
%
I
.
Global
Instance
make_laterable_ne
:
NonExpansive
make_laterable
.
Proof
.
solve_proper
.
Qed
.
Global
Instance
make_laterable_proper
:
Proper
((
≡
)
==>
(
≡
))
make_laterable
:=
ne_proper
_
.
Lemma
make_laterable_wand
Q1
Q2
:
□
(
Q1
-∗
Q2
)
-∗
(
make_laterable
Q1
-∗
make_laterable
Q2
)
.
Proof
.
iIntros
"#HQ HQ1"
.
iDestruct
"HQ1"
as
(
P
)
"[HP #HQ1]"
.
iExists
P
.
iFrame
.
iIntros
"!# HP"
.
iApply
"HQ"
.
iApply
"HQ1"
.
done
.
Qed
.
Global
Instance
make_laterable_laterable
Q
:
Laterable
(
make_laterable
Q
)
.
Proof
.
rewrite
/
Laterable
.
iIntros
"HQ"
.
iDestruct
"HQ"
as
(
P
)
"[HP #HQ]"
.
iExists
P
.
iFrame
.
iIntros
"!# HP !>"
.
iExists
P
.
by
iFrame
.
Qed
.
Lemma
make_laterable_elim
Q
:
make_laterable
Q
-∗
Q
.
Proof
.
iIntros
"HQ"
.
iDestruct
"HQ"
as
(
P
)
"[HP #HQ]"
.
by
iApply
"HQ"
.
Qed
.
Lemma
make_laterable_intro
P
Q
:
Laterable
P
→
□
(
◇
P
-∗
Q
)
-∗
P
-∗
make_laterable
Q
.
Proof
.
iIntros
(?)
"#HQ HP"
.
iDestruct
(
laterable
with
"HP"
)
as
(
P'
)
"[HP' #HPi]"
.
iExists
P'
.
iFrame
.
iIntros
"!# HP'"
.
iApply
"HQ"
.
iApply
"HPi"
.
done
.
Qed
.
End
instances
.
End
instances
.
Typeclasses
Opaque
make_laterable
.
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