Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iris
Manage
Activity
Members
Labels
Plan
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
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
Paolo G. Giarrusso
iris
Commits
22823e07
Commit
22823e07
authored
3 years ago
by
Ralf Jung
Committed by
Robbert Krebbers
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add big_op lemmas to gmap_view and use them in ghost_map
parent
45014bab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
iris/algebra/lib/gmap_view.v
+44
-19
44 additions, 19 deletions
iris/algebra/lib/gmap_view.v
iris/base_logic/lib/ghost_map.v
+25
-41
25 additions, 41 deletions
iris/base_logic/lib/ghost_map.v
with
70 additions
and
60 deletions
CHANGELOG.md
+
1
−
0
View file @
22823e07
...
@@ -26,6 +26,7 @@ Coq 8.11 is no longer supported in this version of Iris.
...
@@ -26,6 +26,7 @@ Coq 8.11 is no longer supported in this version of Iris.
information.
information.
*
Demote the Camera structure on
`list`
to
`iris_staging`
since its composition
*
Demote the Camera structure on
`list`
to
`iris_staging`
since its composition
is not very well-behaved.
is not very well-behaved.
*
Extend
`gmap_view`
with lemmas for "big" operations on maps.
**Changes in `proofmode`:**
**Changes in `proofmode`:**
...
...
This diff is collapsed.
Click to expand it.
iris/algebra/lib/gmap_view.v
+
44
−
19
View file @
22823e07
...
@@ -353,29 +353,54 @@ Section lemmas.
...
@@ -353,29 +353,54 @@ Section lemmas.
rewrite
lookup_delete_ne
//.
rewrite
lookup_delete_ne
//.
Qed
.
Qed
.
Lemma
gmap_view_delete_big
m
m'
:
gmap_view_auth
1
m
⋅
([
^
op
map
]
k
↦
v
∈
m'
,
gmap_view_frag
k
(
DfracOwn
1
)
v
)
~~>
gmap_view_auth
1
(
m
∖
m'
)
.
Proof
.
induction
m'
as
[|
k
v
m'
?
IH
]
using
map_ind
.
{
rewrite
right_id_L
big_opM_empty
right_id
//.
}
rewrite
big_opM_insert
//.
etrans
.
-
rewrite
[
gmap_view_frag
_
_
_
⋅
_]
comm
assoc
.
eapply
cmra_update_op
;
[
eapply
IH
|
reflexivity
]
.
-
etrans
;
first
by
eapply
gmap_view_delete
.
rewrite
-
delete_difference
.
done
.
Qed
.
Lemma
gmap_view_update
m
k
v
v'
:
Lemma
gmap_view_update
m
k
v
v'
:
gmap_view_auth
1
m
⋅
gmap_view_frag
k
(
DfracOwn
1
)
v
~~>
gmap_view_auth
1
m
⋅
gmap_view_frag
k
(
DfracOwn
1
)
v
~~>
gmap_view_auth
1
(
<
[
k
:=
v'
]
>
m
)
⋅
gmap_view_frag
k
(
DfracOwn
1
)
v'
.
gmap_view_auth
1
(
<
[
k
:=
v'
]
>
m
)
⋅
gmap_view_frag
k
(
DfracOwn
1
)
v'
.
Proof
.
Proof
.
apply
view_update
=>
n
bf
Hrel
j
[
df
va
]
/=.
etrans
;
first
by
eapply
gmap_view_delete
.
etrans
.
rewrite
lookup_op
.
destruct
(
decide
(
j
=
k
))
as
[
->
|
Hne
]
.
-
eapply
(
gmap_view_alloc
_
k
(
DfracOwn
1
)
v'
);
last
done
.
-
assert
(
bf
!!
k
=
None
)
as
Hbf
.
rewrite
lookup_delete
//.
{
move
:
Hrel
=>
/
view_rel_validN
/
(_
k
)
.
-
rewrite
insert_delete
.
done
.
rewrite
lookup_op
lookup_singleton
.
Qed
.
destruct
(
bf
!!
k
)
as
[[
df'
va'
]|]
eqn
:
Hbf
;
last
done
.
rewrite
Hbf
.
clear
Hbf
.
Lemma
gmap_view_update_big
m
m0
m1
:
rewrite
-
Some_op
-
pair_op
.
dom
(
gset
K
)
m0
=
dom
(
gset
K
)
m1
→
move
=>[
/=
/
dfrac_full_exclusive
Hdf
_]
.
done
.
}
gmap_view_auth
1
m
⋅
([
^
op
map
]
k
↦
v
∈
m0
,
gmap_view_frag
k
(
DfracOwn
1
)
v
)
~~>
rewrite
Hbf
right_id
lookup_singleton
.
clear
Hbf
.
gmap_view_auth
1
(
m1
∪
m
)
⋅
([
^
op
map
]
k
↦
v
∈
m1
,
gmap_view_frag
k
(
DfracOwn
1
)
v
)
.
intros
[
=
<-
<-
]
.
Proof
.
eexists
.
do
2
(
split
;
first
done
)
.
intros
Hdom
%
eq_sym
.
revert
m1
Hdom
.
rewrite
lookup_insert
.
done
.
induction
m0
as
[|
k
v
m0
Hnotdom
IH
]
using
map_ind
;
intros
m1
Hdom
.
-
rewrite
lookup_singleton_ne
;
last
done
.
{
rewrite
dom_empty_L
in
Hdom
.
rewrite
left_id
=>
Hbf
.
apply
dom_empty_inv_L
in
Hdom
as
->
.
edestruct
(
Hrel
j
)
as
(
v''
&
?
&
?
&
Hm
)
.
rewrite
left_id_L
big_opM_empty
.
done
.
}
{
rewrite
lookup_op
lookup_singleton_ne
//
left_id
.
done
.
}
rewrite
dom_insert_L
in
Hdom
.
simpl
in
*.
eexists
.
do
2
(
split
;
first
done
)
.
assert
(
k
∈
dom
(
gset
K
)
m1
)
as
Hindom
by
set_solver
.
rewrite
lookup_insert_ne
//.
apply
elem_of_dom
in
Hindom
as
[
v'
Hlookup
]
.
rewrite
big_opM_insert
//.
etrans
;
last
etrans
.
-
rewrite
[
gmap_view_frag
_
_
_
⋅
_]
comm
assoc
.
eapply
cmra_update_op
;
[
eapply
(
IH
(
delete
k
m1
))|
reflexivity
]
.
rewrite
dom_delete_L
Hdom
.
apply
not_elem_of_dom
in
Hnotdom
.
set_solver
-
Hdom
.
-
rewrite
-
assoc
[_
⋅
gmap_view_frag
_
_
_]
comm
assoc
.
eapply
cmra_update_op
;
last
reflexivity
.
eapply
(
gmap_view_update
_
_
v
v'
)
.
-
rewrite
(
big_opM_delete
_
m1
k
v'
)
//
-
assoc
.
eapply
cmra_update_op
;
last
done
.
rewrite
insert_union_r
;
last
by
rewrite
lookup_delete
.
rewrite
union_delete_insert
//.
Qed
.
Qed
.
Lemma
gmap_view_persist
k
dq
v
:
Lemma
gmap_view_persist
k
dq
v
:
...
...
This diff is collapsed.
Click to expand it.
iris/base_logic/lib/ghost_map.v
+
25
−
41
View file @
22823e07
...
@@ -67,6 +67,15 @@ Section lemmas.
...
@@ -67,6 +67,15 @@ Section lemmas.
AsFractional
(
k
↪
[
γ
]{
#
q
}
v
)
(
λ
q
,
k
↪
[
γ
]{
#
q
}
v
)
%
I
q
.
AsFractional
(
k
↪
[
γ
]{
#
q
}
v
)
(
λ
q
,
k
↪
[
γ
]{
#
q
}
v
)
%
I
q
.
Proof
.
split
;
first
done
.
apply
_
.
Qed
.
Proof
.
split
;
first
done
.
apply
_
.
Qed
.
Local
Lemma
ghost_map_elems_unseal
γ
m
dq
:
([
∗
map
]
k
↦
v
∈
m
,
k
↪
[
γ
]{
dq
}
v
)
==∗
own
γ
([
^
op
map
]
k
↦
v
∈
m
,
gmap_view_frag
(
V
:=
leibnizO
V
)
k
dq
v
)
.
Proof
.
unseal
.
destruct
(
decide
(
m
=
∅
))
as
[
->
|
Hne
]
.
-
rewrite
!
big_opM_empty
.
iIntros
"_"
.
iApply
own_unit
.
-
rewrite
big_opM_own
//.
iIntros
"?"
.
done
.
Qed
.
Lemma
ghost_map_elem_valid
k
γ
dq
v
:
k
↪
[
γ
]{
dq
}
v
-∗
⌜✓
dq
⌝.
Lemma
ghost_map_elem_valid
k
γ
dq
v
:
k
↪
[
γ
]{
dq
}
v
-∗
⌜✓
dq
⌝.
Proof
.
Proof
.
unseal
.
iIntros
"Helem"
.
unseal
.
iIntros
"Helem"
.
...
@@ -209,24 +218,20 @@ Section lemmas.
...
@@ -209,24 +218,20 @@ Section lemmas.
Lemma
ghost_map_update
{
γ
m
k
v
}
w
:
Lemma
ghost_map_update
{
γ
m
k
v
}
w
:
ghost_map_auth
γ
1
m
-∗
k
↪
[
γ
]
v
==∗
ghost_map_auth
γ
1
(
<
[
k
:=
w
]
>
m
)
∗
k
↪
[
γ
]
w
.
ghost_map_auth
γ
1
m
-∗
k
↪
[
γ
]
v
==∗
ghost_map_auth
γ
1
(
<
[
k
:=
w
]
>
m
)
∗
k
↪
[
γ
]
w
.
Proof
.
Proof
.
iIntros
"Hauth Hel"
.
iMod
(
ghost_map_delete
with
"Hauth Hel"
)
as
"Hauth"
.
unseal
.
apply
bi
.
wand_intro_r
.
rewrite
-!
own_op
.
iMod
(
ghost_map_insert
k
with
"Hauth"
)
.
apply
own_update
.
apply
:
gmap_view_update
.
{
rewrite
lookup_delete
.
done
.
}
rewrite
insert_delete
.
eauto
.
Qed
.
Qed
.
(**
Derived b
ig-op versions of above lemmas *)
(**
B
ig-op versions of above lemmas *)
Lemma
ghost_map_lookup_big
{
γ
q
m
}
m0
:
Lemma
ghost_map_lookup_big
{
γ
q
m
}
m0
:
ghost_map_auth
γ
q
m
-∗
ghost_map_auth
γ
q
m
-∗
([
∗
map
]
k
↦
v
∈
m0
,
k
↪
[
γ
]
v
)
-∗
([
∗
map
]
k
↦
v
∈
m0
,
k
↪
[
γ
]
v
)
-∗
⌜
m0
⊆
m
⌝.
⌜
m0
⊆
m
⌝.
Proof
.
Proof
.
iInduction
m0
as
[|
k
v
m0
Hk
IH
]
"IH"
using
map_ind
.
iIntros
"Hauth Hfrag"
.
rewrite
map_subseteq_spec
.
iIntros
(
k
v
Hm0
)
.
{
iIntros
"_ _"
.
iPureIntro
.
apply
map_empty_subseteq
.
}
iDestruct
(
ghost_map_lookup
with
"Hauth [Hfrag]"
)
as
%->
.
rewrite
big_sepM_insert
//.
iIntros
"Hauth [Helem Hm0]"
.
{
rewrite
big_sepM_lookup
;
done
.
}
iDestruct
(
ghost_map_lookup
with
"Hauth Helem"
)
as
%
Helem
.
done
.
iDestruct
(
"IH"
with
"Hauth Hm0"
)
as
%
Hm0
.
iPureIntro
.
apply
insert_subseteq_l
;
done
.
Qed
.
Qed
.
Lemma
ghost_map_insert_big
{
γ
m
}
m'
:
Lemma
ghost_map_insert_big
{
γ
m
}
m'
:
...
@@ -234,14 +239,8 @@ Section lemmas.
...
@@ -234,14 +239,8 @@ Section lemmas.
ghost_map_auth
γ
1
m
==∗
ghost_map_auth
γ
1
m
==∗
ghost_map_auth
γ
1
(
m'
∪
m
)
∗
([
∗
map
]
k
↦
v
∈
m'
,
k
↪
[
γ
]
v
)
.
ghost_map_auth
γ
1
(
m'
∪
m
)
∗
([
∗
map
]
k
↦
v
∈
m'
,
k
↪
[
γ
]
v
)
.
Proof
.
Proof
.
iInduction
m'
as
[|
k
v
m'
Hk
]
"IH"
using
map_ind
forall
(
m
);
iIntros
(
Hdisj
)
"Hm"
.
unseal
.
intros
?
.
rewrite
-
big_opM_own_1
-
own_op
.
{
rewrite
left_id_L
.
auto
.
}
apply
own_update
.
apply
:
gmap_view_alloc_big
;
done
.
iMod
(
"IH"
with
"[] Hm"
)
as
"[Hm'm Hm']"
.
{
iPureIntro
.
by
eapply
map_disjoint_insert_l
.
}
decompose_map_disjoint
.
rewrite
!
big_opM_insert
//
-
insert_union_l
//.
by
iMod
(
ghost_map_insert
with
"Hm'm"
)
as
"($ & $)"
;
first
by
apply
lookup_union_None
.
Qed
.
Qed
.
Lemma
ghost_map_insert_persist_big
{
γ
m
}
m'
:
Lemma
ghost_map_insert_persist_big
{
γ
m
}
m'
:
m'
##
ₘ
m
→
m'
##
ₘ
m
→
...
@@ -259,12 +258,9 @@ Section lemmas.
...
@@ -259,12 +258,9 @@ Section lemmas.
([
∗
map
]
k
↦
v
∈
m0
,
k
↪
[
γ
]
v
)
==∗
([
∗
map
]
k
↦
v
∈
m0
,
k
↪
[
γ
]
v
)
==∗
ghost_map_auth
γ
1
(
m
∖
m0
)
.
ghost_map_auth
γ
1
(
m
∖
m0
)
.
Proof
.
Proof
.
iInduction
m0
as
[|
k
v
m0
Hk
IH
]
"IH"
using
map_ind
.
iIntros
"Hauth Hfrag"
.
iMod
(
ghost_map_elems_unseal
with
"Hfrag"
)
as
"Hfrag"
.
{
iIntros
"Hauth _"
.
rewrite
right_id_L
//.
}
unseal
.
iApply
(
own_update_2
with
"Hauth Hfrag"
)
.
rewrite
big_sepM_insert
//.
iIntros
"Hauth [Helem Hm0]"
.
apply
:
gmap_view_delete_big
.
iMod
(
"IH"
with
"Hauth Hm0"
)
as
"Hauth"
.
iMod
(
ghost_map_delete
with
"Hauth Helem"
)
as
"Hauth"
.
rewrite
-
delete_difference
.
done
.
Qed
.
Qed
.
Theorem
ghost_map_update_big
{
γ
m
}
m0
m1
:
Theorem
ghost_map_update_big
{
γ
m
}
m0
m1
:
...
@@ -274,22 +270,10 @@ Section lemmas.
...
@@ -274,22 +270,10 @@ Section lemmas.
ghost_map_auth
γ
1
(
m1
∪
m
)
∗
ghost_map_auth
γ
1
(
m1
∪
m
)
∗
[
∗
map
]
k
↦
v
∈
m1
,
k
↪
[
γ
]
v
.
[
∗
map
]
k
↦
v
∈
m1
,
k
↪
[
γ
]
v
.
Proof
.
Proof
.
iIntros
(
Hdom
%
eq_sym
)
"Hauth Hm0"
.
iIntros
(?)
"Hauth Hfrag"
.
iMod
(
ghost_map_elems_unseal
with
"Hfrag"
)
as
"Hfrag"
.
iInduction
m0
as
[|
k
v
m0
Hk
]
"IH"
using
map_ind
forall
(
m
m1
Hdom
)
.
unseal
.
rewrite
-
big_opM_own_1
-
own_op
.
-
rewrite
dom_empty_L
in
Hdom
.
iApply
(
own_update_2
with
"Hauth Hfrag"
)
.
apply
dom_empty_inv_L
in
Hdom
as
->
.
apply
:
gmap_view_update_big
.
done
.
rewrite
left_id_L
big_sepM_empty
.
by
iFrame
.
-
rewrite
big_sepM_insert
//.
iDestruct
"Hm0"
as
"[Hl Hm0]"
.
rewrite
dom_insert_L
in
Hdom
.
assert
(
k
∈
dom
(
gset
K
)
m1
)
as
Hindom
by
set_solver
.
apply
elem_of_dom
in
Hindom
as
[
v'
Hlookup
]
.
iMod
(
ghost_map_update
v'
with
"Hauth Hl"
)
as
"[Hauth Hl]"
.
iMod
(
"IH"
$!
(
<
[
k
:=
v'
]
>
m
)
(
delete
k
m1
)
with
"[%] Hauth Hm0"
)
as
"[Hauth Hm0]"
.
{
apply
(
not_elem_of_dom
(
D
:=
gset
K
))
in
Hk
.
set_solver
.
}
rewrite
union_delete_insert
//.
iFrame
.
iClear
"#"
.
iApply
big_sepM_delete
;
first
done
.
by
iFrame
.
Qed
.
Qed
.
End
lemmas
.
End
lemmas
.
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