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
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
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
Iris
Iris
Commits
205a111e
Commit
205a111e
authored
9 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Rename from_heap -> of_heap.
This is shorter and more consistent with naming elsewhere.
parent
3a51d445
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
heap_lang/heap.v
+22
-22
22 additions, 22 deletions
heap_lang/heap.v
with
22 additions
and
22 deletions
heap_lang/heap.v
+
22
−
22
View file @
205a111e
...
...
@@ -13,7 +13,7 @@ Instance heap_inG_auth `{HeapInG Σ i} : AuthInG heap_lang Σ i heapRA.
Proof
.
split
;
apply
_
.
Qed
.
Definition
to_heap
:
state
→
heapRA
:=
fmap
Excl
.
Definition
f
rom
_heap
:
heapRA
→
state
:=
omap
(
maybe
Excl
)
.
Definition
o
f_heap
:
heapRA
→
state
:=
omap
(
maybe
Excl
)
.
(* TODO: Do we want to expose heap ownership based on the state, or the heapRA?
The former does not expose the annoying "Excl", so for now I am going for
...
...
@@ -22,7 +22,7 @@ Definition heap_mapsto {Σ} (i : gid) `{HeapInG Σ i}
(
γ
:
gname
)
(
l
:
loc
)
(
v
:
val
)
:
iPropG
heap_lang
Σ
:=
auth_own
i
γ
{[
l
↦
Excl
v
]}
.
Definition
heap_inv
{
Σ
}
(
i
:
gid
)
`{
HeapInG
Σ
i
}
(
h
:
heapRA
)
:
iPropG
heap_lang
Σ
:=
ownP
(
f
rom
_heap
h
)
.
(
h
:
heapRA
)
:
iPropG
heap_lang
Σ
:=
ownP
(
o
f_heap
h
)
.
Definition
heap_ctx
{
Σ
}
(
i
:
gid
)
`{
HeapInG
Σ
i
}
(
γ
:
gname
)
(
N
:
namespace
)
:
iPropG
heap_lang
Σ
:=
auth_ctx
i
γ
N
(
heap_inv
i
)
.
...
...
@@ -35,21 +35,21 @@ Section heap.
Implicit
Types
γ
:
gname
.
(** Conversion to heaps and back *)
Global
Instance
f
rom
_heap_proper
:
Proper
((
≡
)
==>
(
=
))
f
rom
_heap
.
Global
Instance
o
f_heap_proper
:
Proper
((
≡
)
==>
(
=
))
o
f_heap
.
Proof
.
by
intros
??;
fold_leibniz
=>
->
.
Qed
.
Lemma
from_to_heap
σ
:
f
rom
_heap
(
to_heap
σ
)
=
σ
.
Lemma
from_to_heap
σ
:
o
f_heap
(
to_heap
σ
)
=
σ
.
Proof
.
apply
map_eq
=>
l
.
rewrite
lookup_omap
lookup_fmap
.
by
case
(
σ
!!
l
)
.
Qed
.
Lemma
to_heap_valid
σ
:
✓
to_heap
σ
.
Proof
.
intros
n
l
.
rewrite
lookup_fmap
.
by
case
(
σ
!!
l
)
.
Qed
.
Lemma
insert_f
rom
_heap
l
v
h
:
<
[
l
:=
v
]
>
(
f
rom
_heap
h
)
=
f
rom
_heap
(
<
[
l
:=
Excl
v
]
>
h
)
.
Proof
.
by
rewrite
/
f
rom
_heap
-
(
omap_insert
_
_
_
(
Excl
v
))
.
Qed
.
Lemma
f
rom
_heap_None
h
l
:
✓
h
→
f
rom
_heap
h
!!
l
=
None
→
h
!!
l
=
None
∨
h
!!
l
≡
Some
ExclUnit
.
Lemma
insert_
o
f_heap
l
v
h
:
<
[
l
:=
v
]
>
(
o
f_heap
h
)
=
o
f_heap
(
<
[
l
:=
Excl
v
]
>
h
)
.
Proof
.
by
rewrite
/
o
f_heap
-
(
omap_insert
_
_
_
(
Excl
v
))
.
Qed
.
Lemma
o
f_heap_None
h
l
:
✓
h
→
o
f_heap
h
!!
l
=
None
→
h
!!
l
=
None
∨
h
!!
l
≡
Some
ExclUnit
.
Proof
.
move
=>
/
(_
O
l
)
.
rewrite
/
f
rom
_heap
lookup_omap
.
move
=>
/
(_
O
l
)
.
rewrite
/
o
f_heap
lookup_omap
.
by
case
:
(
h
!!
l
)=>
[[]|];
auto
.
Qed
.
Lemma
heap_singleton_inv_l
h
l
v
:
...
...
@@ -77,7 +77,7 @@ Section heap.
Proof
.
rewrite
-
{
1
}(
from_to_heap
σ
)
.
etransitivity
;
first
apply
(
auth_alloc
(
ownP
∘
f
rom
_heap
)
N
(
to_heap
σ
)),
to_heap_valid
.
first
apply
(
auth_alloc
(
ownP
∘
o
f_heap
)
N
(
to_heap
σ
)),
to_heap_valid
.
apply
pvs_mono
,
exist_mono
;
auto
with
I
.
Qed
.
...
...
@@ -96,15 +96,15 @@ Section heap.
apply
sep_mono_r
,
forall_intro
=>
h
;
apply
wand_intro_l
.
rewrite
-
assoc
left_id
;
apply
const_elim_sep_l
=>
?
.
rewrite
{
1
}[(
▷
ownP
_)
%
I
]
pvs_timeless
pvs_frame_r
;
apply
wp_strip_pvs
.
rewrite
/
wp_fsa
-
(
wp_alloc_pst
_
(
f
rom
_heap
h
))
//.
rewrite
/
wp_fsa
-
(
wp_alloc_pst
_
(
o
f_heap
h
))
//.
apply
sep_mono_r
;
rewrite
HP
;
apply
later_mono
.
apply
forall_intro
=>
l
;
apply
wand_intro_l
;
rewrite
(
forall_elim
l
)
.
rewrite
always_and_sep_l
-
assoc
;
apply
const_elim_sep_l
=>
?
.
rewrite
-
(
exist_intro
(
op
{[
l
↦
Excl
v
]}))
.
repeat
erewrite
<-
exist_intro
by
apply
_;
simpl
.
rewrite
insert_f
rom
_heap
left_id
right_id
!
assoc
.
rewrite
insert_
o
f_heap
left_id
right_id
!
assoc
.
apply
sep_mono_l
.
rewrite
-
(
map_insert_singleton_op
h
);
last
by
apply
f
rom
_heap_None
.
rewrite
-
(
map_insert_singleton_op
h
);
last
by
apply
o
f_heap_None
.
rewrite
const_equiv
?left_id
;
last
by
apply
(
map_insert_valid
h
)
.
apply
later_intro
.
Qed
.
...
...
@@ -121,10 +121,10 @@ Section heap.
rewrite
HPQ
{
HPQ
};
apply
sep_mono_r
,
forall_intro
=>
h
;
apply
wand_intro_l
.
rewrite
-
assoc
;
apply
const_elim_sep_l
=>
?
.
rewrite
{
1
}[(
▷
ownP
_)
%
I
]
pvs_timeless
pvs_frame_r
;
apply
wp_strip_pvs
.
rewrite
-
(
wp_load_pst
_
(
<
[
l
:=
v
]
>
(
f
rom
_heap
h
)))
?lookup_insert
//.
rewrite
-
(
wp_load_pst
_
(
<
[
l
:=
v
]
>
(
o
f_heap
h
)))
?lookup_insert
//.
rewrite
const_equiv
//
left_id
.
rewrite
-
(
map_insert_singleton_op
h
);
last
by
eapply
heap_singleton_inv_l
.
rewrite
insert_f
rom
_heap
.
rewrite
insert_
o
f_heap
.
apply
sep_mono_r
,
later_mono
,
wand_intro_l
.
by
rewrite
-
later_intro
.
Qed
.
...
...
@@ -141,10 +141,10 @@ Section heap.
rewrite
HPQ
{
HPQ
};
apply
sep_mono_r
,
forall_intro
=>
h
;
apply
wand_intro_l
.
rewrite
-
assoc
;
apply
const_elim_sep_l
=>
?
.
rewrite
{
1
}[(
▷
ownP
_)
%
I
]
pvs_timeless
pvs_frame_r
;
apply
wp_strip_pvs
.
rewrite
-
(
wp_store_pst
_
(
<
[
l
:=
v'
]
>
(
f
rom
_heap
h
)))
?lookup_insert
//.
rewrite
-
(
wp_store_pst
_
(
<
[
l
:=
v'
]
>
(
o
f_heap
h
)))
?lookup_insert
//.
rewrite
/
heap_inv
alter_singleton
insert_insert
.
rewrite
-!
(
map_insert_singleton_op
h
);
try
by
eapply
heap_singleton_inv_l
.
rewrite
!
insert_f
rom
_heap
const_equiv
;
rewrite
!
insert_
o
f_heap
const_equiv
;
last
(
split
;
[
naive_solver
|
by
eapply
map_insert_valid
,
cmra_valid_op_r
])
.
apply
sep_mono_r
,
later_mono
,
wand_intro_l
.
by
rewrite
left_id
-
later_intro
.
Qed
.
...
...
@@ -163,10 +163,10 @@ Section heap.
rewrite
HPQ
{
HPQ
};
apply
sep_mono_r
,
forall_intro
=>
h
;
apply
wand_intro_l
.
rewrite
-
assoc
;
apply
const_elim_sep_l
=>
?
.
rewrite
{
1
}[(
▷
ownP
_)
%
I
]
pvs_timeless
pvs_frame_r
;
apply
wp_strip_pvs
.
rewrite
-
(
wp_cas_fail_pst
_
(
<
[
l
:=
v'
]
>
(
f
rom
_heap
h
)))
?lookup_insert
//.
rewrite
-
(
wp_cas_fail_pst
_
(
<
[
l
:=
v'
]
>
(
o
f_heap
h
)))
?lookup_insert
//.
rewrite
const_equiv
//
left_id
.
rewrite
-
(
map_insert_singleton_op
h
);
last
by
eapply
heap_singleton_inv_l
.
rewrite
insert_f
rom
_heap
.
rewrite
insert_
o
f_heap
.
apply
sep_mono_r
,
later_mono
,
wand_intro_l
.
by
rewrite
-
later_intro
.
Qed
.
...
...
@@ -184,10 +184,10 @@ Section heap.
rewrite
HPQ
{
HPQ
};
apply
sep_mono_r
,
forall_intro
=>
h
;
apply
wand_intro_l
.
rewrite
-
assoc
;
apply
const_elim_sep_l
=>
?
.
rewrite
{
1
}[(
▷
ownP
_)
%
I
]
pvs_timeless
pvs_frame_r
;
apply
wp_strip_pvs
.
rewrite
-
(
wp_cas_suc_pst
_
(
<
[
l
:=
v1
]
>
(
f
rom
_heap
h
)))
?lookup_insert
//.
rewrite
-
(
wp_cas_suc_pst
_
(
<
[
l
:=
v1
]
>
(
o
f_heap
h
)))
?lookup_insert
//.
rewrite
/
heap_inv
alter_singleton
insert_insert
.
rewrite
-!
(
map_insert_singleton_op
h
);
try
by
eapply
heap_singleton_inv_l
.
rewrite
!
insert_f
rom
_heap
const_equiv
;
rewrite
!
insert_
o
f_heap
const_equiv
;
last
(
split
;
[
naive_solver
|
by
eapply
map_insert_valid
,
cmra_valid_op_r
])
.
apply
sep_mono_r
,
later_mono
,
wand_intro_l
.
by
rewrite
left_id
-
later_intro
.
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