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
Simcha van Collem
Iris
Commits
c3e1c02a
Commit
c3e1c02a
authored
9 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Frame preserving updates for maps.
parent
63c020e4
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
modures/fin_maps.v
+29
-10
29 additions, 10 deletions
modures/fin_maps.v
with
29 additions
and
10 deletions
modures/fin_maps.v
+
29
−
10
View file @
c3e1c02a
...
@@ -164,7 +164,7 @@ Proof. by move=> /(_ i) Hm Hi; move:Hm; rewrite Hi. Qed.
...
@@ -164,7 +164,7 @@ Proof. by move=> /(_ i) Hm Hi; move:Hm; rewrite Hi. Qed.
Lemma
map_insert_validN
n
m
i
x
:
✓
{
n
}
x
→
✓
{
n
}
m
→
✓
{
n
}
(
<
[
i
:=
x
]
>
m
)
.
Lemma
map_insert_validN
n
m
i
x
:
✓
{
n
}
x
→
✓
{
n
}
m
→
✓
{
n
}
(
<
[
i
:=
x
]
>
m
)
.
Proof
.
by
intros
??
j
;
destruct
(
decide
(
i
=
j
));
simplify_map_equality
.
Qed
.
Proof
.
by
intros
??
j
;
destruct
(
decide
(
i
=
j
));
simplify_map_equality
.
Qed
.
Lemma
map_insert_op
m1
m2
i
x
:
Lemma
map_insert_op
m1
m2
i
x
:
m2
!!
i
=
None
→
<
[
i
:=
x
]
>
(
m1
⋅
m2
)
=
<
[
i
:=
x
]
>
m1
⋅
m2
.
m2
!!
i
=
None
→
<
[
i
:=
x
]
>
(
m1
⋅
m2
)
=
<
[
i
:=
x
]
>
m1
⋅
m2
.
Proof
.
by
intros
Hi
;
apply
(
insert_merge_l
_
m1
m2
);
rewrite
Hi
.
Qed
.
Proof
.
by
intros
Hi
;
apply
(
insert_merge_l
_
m1
m2
);
rewrite
Hi
.
Qed
.
Lemma
map_unit_singleton
(
i
:
K
)
(
x
:
A
)
:
Lemma
map_unit_singleton
(
i
:
K
)
(
x
:
A
)
:
unit
({[
i
↦
x
]}
:
gmap
K
A
)
=
{[
i
↦
unit
x
]}
.
unit
({[
i
↦
x
]}
:
gmap
K
A
)
=
{[
i
↦
unit
x
]}
.
...
@@ -185,26 +185,45 @@ Proof.
...
@@ -185,26 +185,45 @@ Proof.
+
by
rewrite
Hi
;
apply
Some_Some_includedN
,
cmra_included_includedN
.
+
by
rewrite
Hi
;
apply
Some_Some_includedN
,
cmra_included_includedN
.
+
apply
None_includedN
.
+
apply
None_includedN
.
Qed
.
Qed
.
Lemma
map_dom_op
(
m1
m2
:
gmap
K
A
)
:
Lemma
map_dom_op
m1
m2
:
dom
(
gset
K
)
(
m1
⋅
m2
)
≡
dom
_
m1
∪
dom
_
m2
.
dom
(
gset
K
)
(
m1
⋅
m2
)
≡
dom
_
m1
∪
dom
_
m2
.
Proof
.
Proof
.
apply
elem_of_equiv
;
intros
i
;
rewrite
elem_of_union
!
elem_of_dom
.
apply
elem_of_equiv
;
intros
i
;
rewrite
elem_of_union
!
elem_of_dom
.
unfold
is_Some
;
setoid_rewrite
lookup_op
.
unfold
is_Some
;
setoid_rewrite
lookup_op
.
destruct
(
m1
!!
i
),
(
m2
!!
i
);
naive_solver
.
destruct
(
m1
!!
i
),
(
m2
!!
i
);
naive_solver
.
Qed
.
Qed
.
Lemma
map_insert_updateP
(
P
:
A
→
Prop
)
(
Q
:
gmap
K
A
→
Prop
)
m
i
x
:
x
⇝:
P
→
(
∀
y
,
P
y
→
Q
(
<
[
i
:=
y
]
>
m
))
→
<
[
i
:=
x
]
>
m
⇝:
Q
.
Proof
.
intros
Hx
%
option_updateP'
HP
mf
n
Hm
.
destruct
(
Hx
(
mf
!!
i
)
n
)
as
([
y
|]
&
?
&
?);
try
done
.
{
by
generalize
(
Hm
i
);
rewrite
lookup_op
;
simplify_map_equality
.
}
exists
(
<
[
i
:=
y
]
>
m
);
split
;
first
by
auto
.
intros
j
;
move
:
(
Hm
j
)=>{
Hm
};
rewrite
!
lookup_op
=>
Hm
.
destruct
(
decide
(
i
=
j
));
simplify_map_equality'
;
auto
.
Qed
.
Lemma
map_insert_updateP'
(
P
:
A
→
Prop
)
(
Q
:
gmap
K
A
→
Prop
)
m
i
x
:
x
⇝:
P
→
<
[
i
:=
x
]
>
m
⇝:
λ
m'
,
∃
y
,
m'
=
<
[
i
:=
y
]
>
m
∧
P
y
.
Proof
.
eauto
using
map_insert_updateP
.
Qed
.
Lemma
map_insert_update
m
i
x
y
:
x
⇝
y
→
<
[
i
:=
x
]
>
m
⇝
<
[
i
:=
y
]
>
m
.
Proof
.
rewrite
!
cmra_update_updateP
;
eauto
using
map_insert_updateP
with
congruence
.
Qed
.
Context
`{
Fresh
K
(
gset
K
),
!
FreshSpec
K
(
gset
K
)}
.
Context
`{
Fresh
K
(
gset
K
),
!
FreshSpec
K
(
gset
K
)}
.
Lemma
map_update_alloc
(
m
:
gmap
K
A
)
x
:
Lemma
map_update
P
_alloc
(
Q
:
gmap
K
A
→
Prop
)
m
x
:
✓
x
→
m
⇝:
λ
m'
,
∃
i
,
m'
=
<
[
i
:=
x
]
>
m
∧
m
!!
i
=
None
.
✓
x
→
(
∀
i
,
m
!!
i
=
None
→
Q
(
<
[
i
:=
x
]
>
m
))
→
m
⇝:
Q
.
Proof
.
Proof
.
intros
?
mf
n
Hm
.
set
(
i
:=
fresh
(
dom
(
gset
K
)
(
m
⋅
mf
)))
.
intros
?
HQ
mf
n
Hm
.
set
(
i
:=
fresh
(
dom
(
gset
K
)
(
m
⋅
mf
)))
.
assert
(
i
∉
dom
(
gset
K
)
m
∧
i
∉
dom
(
gset
K
)
mf
)
as
[??]
.
assert
(
i
∉
dom
(
gset
K
)
m
∧
i
∉
dom
(
gset
K
)
mf
)
as
[??]
.
{
rewrite
-
not_elem_of_union
-
map_dom_op
;
apply
is_fresh
.
}
{
rewrite
-
not_elem_of_union
-
map_dom_op
;
apply
is_fresh
.
}
exists
(
<
[
i
:=
x
]
>
m
);
split
;
[
exists
i
;
split
;
[
done
|]|]
.
exists
(
<
[
i
:=
x
]
>
m
);
split
;
first
by
apply
HQ
,
not_elem_of_dom
.
*
by
apply
not_elem_of_dom
.
rewrite
-
map_insert_op
;
last
by
apply
not_elem_of_dom
.
*
rewrite
-
map_insert_op
;
last
by
apply
not_elem_of_dom
.
by
apply
map_insert_validN
;
[
apply
cmra_valid_validN
|]
.
by
apply
map_insert_validN
;
[
apply
cmra_valid_validN
|]
.
Qed
.
Qed
.
Lemma
map_updateP_alloc'
m
x
:
✓
x
→
m
⇝:
λ
m'
,
∃
i
,
m'
=
<
[
i
:=
x
]
>
m
∧
m
!!
i
=
None
.
Proof
.
eauto
using
map_updateP_alloc
.
Qed
.
End
properties
.
End
properties
.
Instance
map_fmap_ne
`{
Countable
K
}
{
A
B
:
cofeT
}
(
f
:
A
→
B
)
n
:
Instance
map_fmap_ne
`{
Countable
K
}
{
A
B
:
cofeT
}
(
f
:
A
→
B
)
n
:
...
...
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