Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Iris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
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
Gaëtan Gilbert
Iris
Commits
466710ad
Commit
466710ad
authored
7 years ago
by
Ralf Jung
Committed by
Robbert Krebbers
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
saved_prop: provide convenience definitions for common instances
parent
c9707f98
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/saved_prop.v
+62
-18
62 additions, 18 deletions
theories/base_logic/lib/saved_prop.v
with
62 additions
and
18 deletions
theories/base_logic/lib/saved_prop.v
+
62
−
18
View file @
466710ad
From
iris
.
base_logic
Require
Export
own
.
From
iris
.
algebra
Require
Import
agree
.
From
stdpp
Require
Import
gmap
.
From
iris
.
proofmode
Require
Import
tactics
.
Set
Default
Proof
Using
"Type"
.
Import
uPred
.
Class
savedPropG
(
Σ
:
gFunctors
)
(
F
:
cFunctor
)
:=
saved_prop_inG
:>
inG
Σ
(
agreeR
(
F
(
iPreProp
Σ
)))
.
Definition
savedPropΣ
(
F
:
cFunctor
)
`{
!
cFunctorContractive
F
}
:
gFunctors
:=
(* "Saved anything" -- this can give you saved propositions, saved predicates,
saved whatever-you-like. *)
Class
savedAnythingG
(
Σ
:
gFunctors
)
(
F
:
cFunctor
)
:=
saved_anything_inG
:>
inG
Σ
(
agreeR
(
F
(
iPreProp
Σ
)))
.
Definition
savedAnythingΣ
(
F
:
cFunctor
)
`{
!
cFunctorContractive
F
}
:
gFunctors
:=
#
[
GFunctor
(
agreeRF
F
)
]
.
Instance
subG_saved
Prop
Σ
{
Σ
F
}
`{
!
cFunctorContractive
F
}
:
subG
(
saved
Prop
Σ
F
)
Σ
→
saved
Prop
G
Σ
F
.
Instance
subG_saved
Anything
Σ
{
Σ
F
}
`{
!
cFunctorContractive
F
}
:
subG
(
saved
Anything
Σ
F
)
Σ
→
saved
Anything
G
Σ
F
.
Proof
.
solve_inG
.
Qed
.
Definition
saved_
prop
_own
`{
saved
Prop
G
Σ
F
}
Definition
saved_
anything
_own
`{
saved
Anything
G
Σ
F
}
(
γ
:
gname
)
(
x
:
F
(
iProp
Σ
))
:
iProp
Σ
:=
own
γ
(
to_agree
$
(
cFunctor_map
F
(
iProp_fold
,
iProp_unfold
)
x
))
.
Typeclasses
Opaque
saved_
prop
_own
.
Instance
:
Params
(
@
saved_
prop
_own
)
3
.
Typeclasses
Opaque
saved_
anything
_own
.
Instance
:
Params
(
@
saved_
anything
_own
)
3
.
Section
saved_
prop
.
Context
`{
saved
Prop
G
Σ
F
}
.
Section
saved_
anything
.
Context
`{
saved
Anything
G
Σ
F
}
.
Implicit
Types
x
y
:
F
(
iProp
Σ
)
.
Implicit
Types
γ
:
gname
.
Global
Instance
saved_prop_persistent
γ
x
:
Persistent
(
saved_
prop
_own
γ
x
)
.
Proof
.
rewrite
/
saved_
prop
_own
;
apply
_
.
Qed
.
Global
Instance
saved_prop_persistent
γ
x
:
Persistent
(
saved_
anything
_own
γ
x
)
.
Proof
.
rewrite
/
saved_
anything
_own
;
apply
_
.
Qed
.
Lemma
saved_
prop
_alloc_strong
x
(
G
:
gset
gname
)
:
(|
==>
∃
γ
,
⌜
γ
∉
G
⌝
∧
saved_
prop
_own
γ
x
)
%
I
.
Lemma
saved_
anything
_alloc_strong
x
(
G
:
gset
gname
)
:
(|
==>
∃
γ
,
⌜
γ
∉
G
⌝
∧
saved_
anything
_own
γ
x
)
%
I
.
Proof
.
by
apply
own_alloc_strong
.
Qed
.
Lemma
saved_
prop
_alloc
x
:
(|
==>
∃
γ
,
saved_
prop
_own
γ
x
)
%
I
.
Lemma
saved_
anything
_alloc
x
:
(|
==>
∃
γ
,
saved_
anything
_own
γ
x
)
%
I
.
Proof
.
by
apply
own_alloc
.
Qed
.
Lemma
saved_
prop
_agree
γ
x
y
:
saved_
prop
_own
γ
x
-∗
saved_
prop
_own
γ
y
-∗
x
≡
y
.
Lemma
saved_
anything
_agree
γ
x
y
:
saved_
anything
_own
γ
x
-∗
saved_
anything
_own
γ
y
-∗
x
≡
y
.
Proof
.
(* TODO: Use the proof mode. *)
apply
wand_intro_r
.
rewrite
-
own_op
own_valid
agree_validI
agree_equivI
.
set
(
G1
:=
cFunctor_map
F
(
iProp_fold
,
iProp_unfold
))
.
...
...
@@ -46,4 +51,43 @@ Section saved_prop.
apply
(
ne_proper
(
cFunctor_map
F
));
split
=>?;
apply
iProp_fold_unfold
.
}
rewrite
-
{
2
}[
x
]
help
-
{
2
}[
y
]
help
.
apply
f_equiv
,
_
.
Qed
.
End
saved_prop
.
End
saved_anything
.
(** Provide specialized versions of this for convenience. **)
(* Saved propositions. *)
Notation
savedPropG
Σ
:=
(
savedAnythingG
Σ
(
▶
∙
))
.
Notation
savedPropΣ
:=
(
savedAnythingΣ
(
▶
∙
))
.
Definition
saved_prop_own
`{
savedPropG
Σ
}
(
γ
:
gname
)
(
P
:
iProp
Σ
)
:=
saved_anything_own
(
F
:=
▶
∙
)
γ
(
Next
P
)
.
Lemma
saved_prop_alloc
`{
savedPropG
Σ
}
(
P
:
iProp
Σ
)
:
(|
==>
∃
γ
,
saved_prop_own
γ
P
)
%
I
.
Proof
.
iApply
saved_anything_alloc
.
Qed
.
Lemma
saved_prop_agree
`{
savedPropG
Σ
}
γ
P
Q
:
saved_prop_own
γ
P
-∗
saved_prop_own
γ
Q
-∗
▷
(
P
≡
Q
)
.
Proof
.
iIntros
"HP HQ"
.
iApply
later_equivI
.
iApply
(
saved_anything_agree
with
"HP HQ"
)
.
Qed
.
(* Saved predicates. *)
Notation
savedPredG
Σ
A
:=
(
savedAnythingG
Σ
(
constCF
A
-
n
>
▶
∙
))
.
Notation
savedPredΣ
A
:=
(
savedAnythingΣ
(
constCF
A
-
n
>
▶
∙
))
.
Definition
saved_pred_own
`{
savedPredG
Σ
A
}
(
γ
:
gname
)
(
f
:
A
-
n
>
iProp
Σ
)
:=
saved_anything_own
(
F
:=
A
-
n
>
▶
∙
)
γ
(
CofeMor
Next
◎
f
)
.
Lemma
saved_pred_alloc
`{
savedPredG
Σ
A
}
(
f
:
A
-
n
>
iProp
Σ
)
:
(|
==>
∃
γ
,
saved_pred_own
γ
f
)
%
I
.
Proof
.
iApply
saved_anything_alloc
.
Qed
.
Lemma
saved_pred_agree
`{
savedPredG
Σ
A
}
γ
f
g
:
saved_pred_own
γ
f
-∗
saved_pred_own
γ
g
-∗
∀
x
,
▷
(
f
x
≡
g
x
)
.
Proof
.
iIntros
"Hx Hy *"
.
unfold
saved_pred_own
.
iApply
later_equivI
.
iDestruct
(
ofe_morC_equivI
(
CofeMor
Next
◎
f
)
(
CofeMor
Next
◎
g
))
as
"[FE _]"
.
simpl
.
iApply
(
"FE"
with
"[-]"
)
.
iApply
(
saved_anything_agree
with
"Hx Hy"
)
.
Qed
.
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