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
8f5438b8
Commit
8f5438b8
authored
7 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Make invariants closed under logical equivalence.
This partially solves #112.
parent
59fbe96b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/base_logic/lib/invariants.v
+21
-9
21 additions, 9 deletions
theories/base_logic/lib/invariants.v
with
21 additions
and
9 deletions
theories/base_logic/lib/invariants.v
+
21
−
9
View file @
8f5438b8
...
...
@@ -7,7 +7,7 @@ Import uPred.
(** Derived forms and lemmas about them. *)
Definition
inv_def
`{
invG
Σ
}
(
N
:
namespace
)
(
P
:
iProp
Σ
)
:
iProp
Σ
:=
(
∃
i
,
⌜
i
∈
(
↑
N
:
coPset
)
⌝
∧
ownI
i
P
)
%
I
.
(
∃
i
P'
,
⌜
i
∈
(
↑
N
:
coPset
)
⌝
∧
▷
□
(
P'
↔
P
)
∧
ownI
i
P
'
)
%
I
.
Definition
inv_aux
:
seal
(
@
inv_def
)
.
by
eexists
.
Qed
.
Definition
inv
{
Σ
i
}
:=
unseal
inv_aux
Σ
i
.
Definition
inv_eq
:
@
inv
=
@
inv_def
:=
seal_eq
inv_aux
.
...
...
@@ -21,19 +21,25 @@ Implicit Types N : namespace.
Implicit
Types
P
Q
R
:
iProp
Σ
.
Global
Instance
inv_contractive
N
:
Contractive
(
inv
N
)
.
Proof
.
rewrite
inv_eq
=>
n
???
.
apply
exist_ne
=>
i
.
by
apply
and_ne
,
ownI_contractive
.
Qed
.
Proof
.
rewrite
inv_eq
.
solve_contractive
.
Qed
.
Global
Instance
inv_ne
N
:
NonExpansive
(
inv
N
)
.
Proof
.
apply
contractive_ne
,
_
.
Qed
.
Global
Instance
inv_
P
roper
N
:
Proper
((
⊣⊢
)
==>
(
⊣⊢
))
(
inv
N
)
.
Global
Instance
inv_
p
roper
N
:
Proper
((
⊣⊢
)
==>
(
⊣⊢
))
(
inv
N
)
.
Proof
.
apply
ne_proper
,
_
.
Qed
.
Global
Instance
inv_persistent
N
P
:
Persistent
(
inv
N
P
)
.
Proof
.
rewrite
inv_eq
/
inv
;
apply
_
.
Qed
.
Lemma
inv_iff
N
P
Q
:
▷
□
(
P
↔
Q
)
-∗
inv
N
P
-∗
inv
N
Q
.
Proof
.
iIntros
"#HPQ"
.
rewrite
inv_eq
.
iDestruct
1
as
(
i
P'
)
"(?&#HP&?)"
.
iExists
i
,
P'
.
iFrame
.
iNext
;
iAlways
;
iSplit
.
-
iIntros
"HP'"
.
iApply
"HPQ"
.
by
iApply
"HP"
.
-
iIntros
"HQ"
.
iApply
"HP"
.
by
iApply
"HPQ"
.
Qed
.
Lemma
fresh_inv_name
(
E
:
gset
positive
)
N
:
∃
i
,
i
∉
E
∧
i
∈
(
↑
N
:
coPset
)
.
Proof
.
exists
(
coPpick
(
↑
N
∖
coPset
.
of_gset
E
))
.
...
...
@@ -48,6 +54,7 @@ Proof.
rewrite
inv_eq
/
inv_def
fupd_eq
/
fupd_def
.
iIntros
"HP [Hw $]"
.
iMod
(
ownI_alloc
(
∈
(
↑
N
:
coPset
))
P
with
"[$HP $Hw]"
)
as
(
i
?)
"[$ ?]"
;
auto
using
fresh_inv_name
.
do
2
iModIntro
.
iExists
i
,
P
.
rewrite
-
(
iff_refl
True
)
.
auto
.
Qed
.
Lemma
inv_alloc_open
N
E
P
:
...
...
@@ -61,7 +68,9 @@ Proof.
{
rewrite
-
?ownE_op
;
[|
set_solver
..]
.
rewrite
assoc_L
-!
union_difference_L
//.
set_solver
.
}
do
2
iModIntro
.
iFrame
"HE\N"
.
iSplitL
"Hw HEi"
;
first
by
iApply
"Hw"
.
iSplitL
"Hi"
;
first
by
eauto
.
iIntros
"HP [Hw HE\N]"
.
iSplitL
"Hi"
.
{
iExists
i
,
P
.
rewrite
-
(
iff_refl
True
)
.
auto
.
}
iIntros
"HP [Hw HE\N]"
.
iDestruct
(
ownI_close
with
"[$Hw $Hi $HP $HD]"
)
as
"[$ HEi]"
.
do
2
iModIntro
.
iSplitL
;
[|
done
]
.
iCombine
"HEi"
"HEN\i"
as
"HEN"
;
iCombine
"HEN"
"HE\N"
as
"HE"
.
...
...
@@ -72,13 +81,16 @@ Qed.
Lemma
inv_open
E
N
P
:
↑
N
⊆
E
→
inv
N
P
=
{
E
,
E
∖↑
N
}
=∗
▷
P
∗
(
▷
P
=
{
E
∖↑
N
,
E
}
=∗
True
)
.
Proof
.
rewrite
inv_eq
/
inv_def
fupd_eq
/
fupd_def
;
iDestruct
1
as
(
i
)
"[Hi #HiP]"
.
rewrite
inv_eq
/
inv_def
fupd_eq
/
fupd_def
.
iDestruct
1
as
(
i
P'
)
"(Hi & #HP' & #HiP)"
.
iDestruct
"Hi"
as
%
?
%
elem_of_subseteq_singleton
.
rewrite
{
1
4
}(
union_difference_L
(
↑
N
)
E
)
//
ownE_op
;
last
set_solver
.
rewrite
{
1
5
}(
union_difference_L
{[
i
]}
(
↑
N
))
//
ownE_op
;
last
set_solver
.
iIntros
"(Hw & [HE $] & $) !> !>"
.
iDestruct
(
ownI_open
i
P
with
"[$Hw $HE $HiP]"
)
as
"($ & $ & HD)"
.
iIntros
"HP [Hw $] !> !>"
.
iApply
ownI_close
;
by
iFrame
.
iDestruct
(
ownI_open
i
with
"[$Hw $HE $HiP]"
)
as
"($ & HP & HD)"
.
iDestruct
(
"HP'"
with
"HP"
)
as
"$"
.
iIntros
"HP [Hw $] !> !>"
.
iApply
(
ownI_close
_
P'
)
.
iFrame
"HD Hw HiP"
.
iApply
"HP'"
.
iFrame
.
Qed
.
Lemma
inv_open_timeless
E
N
P
`{
!
Timeless
P
}
:
...
...
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