Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
Fairis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Iris
Fairis
Commits
205a111e
Commit
205a111e
authored
Feb 14, 2016
by
Robbert Krebbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename from_heap -> of_heap.
This is shorter and more consistent with naming elsewhere.
parent
3a51d445
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
heap_lang/heap.v
heap_lang/heap.v
+22
-22
No files found.
heap_lang/heap.v
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
from
_heap
:
heapRA
→
state
:=
omap
(
maybe
Excl
).
Definition
of
_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
(
from
_heap
h
).
(
h
:
heapRA
)
:
iPropG
heap_lang
Σ
:=
ownP
(
of
_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
from_heap_proper
:
Proper
((
≡
)
==>
(
=
))
from
_heap
.
Global
Instance
of_heap_proper
:
Proper
((
≡
)
==>
(
=
))
of
_heap
.
Proof
.
by
intros
??
;
fold_leibniz
=>->
.
Qed
.
Lemma
from_to_heap
σ
:
from
_heap
(
to_heap
σ
)
=
σ
.
Lemma
from_to_heap
σ
:
of
_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_
from
_heap
l
v
h
:
<
[
l
:=
v
]
>
(
from_heap
h
)
=
from
_heap
(
<
[
l
:=
Excl
v
]
>
h
).
Proof
.
by
rewrite
/
from
_heap
-
(
omap_insert
_
_
_
(
Excl
v
)).
Qed
.
Lemma
from
_heap_None
h
l
:
✓
h
→
from
_heap
h
!!
l
=
None
→
h
!!
l
=
None
∨
h
!!
l
≡
Some
ExclUnit
.
Lemma
insert_
of
_heap
l
v
h
:
<
[
l
:=
v
]
>
(
of_heap
h
)
=
of
_heap
(
<
[
l
:=
Excl
v
]
>
h
).
Proof
.
by
rewrite
/
of
_heap
-
(
omap_insert
_
_
_
(
Excl
v
)).
Qed
.
Lemma
of
_heap_None
h
l
:
✓
h
→
of
_heap
h
!!
l
=
None
→
h
!!
l
=
None
∨
h
!!
l
≡
Some
ExclUnit
.
Proof
.
move
=>
/
(
_
O
l
).
rewrite
/
from
_heap
lookup_omap
.
move
=>
/
(
_
O
l
).
rewrite
/
of
_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
∘
from
_heap
)
N
(
to_heap
σ
)),
to_heap_valid
.
first
apply
(
auth_alloc
(
ownP
∘
of
_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
_
(
from
_heap
h
))
//.
rewrite
/
wp_fsa
-
(
wp_alloc_pst
_
(
of
_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_
from
_heap
left_id
right_id
!
assoc
.
rewrite
insert_
of
_heap
left_id
right_id
!
assoc
.
apply
sep_mono_l
.
rewrite
-
(
map_insert_singleton_op
h
);
last
by
apply
from
_heap_None
.
rewrite
-
(
map_insert_singleton_op
h
);
last
by
apply
of
_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
]
>
(
from
_heap
h
)))
?
lookup_insert
//.
rewrite
-
(
wp_load_pst
_
(
<
[
l
:=
v
]
>
(
of
_heap
h
)))
?
lookup_insert
//.
rewrite
const_equiv
// left_id.
rewrite
-
(
map_insert_singleton_op
h
);
last
by
eapply
heap_singleton_inv_l
.
rewrite
insert_
from
_heap
.
rewrite
insert_
of
_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
'
]
>
(
from
_heap
h
)))
?
lookup_insert
//.
rewrite
-
(
wp_store_pst
_
(
<
[
l
:=
v
'
]
>
(
of
_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_
from
_heap
const_equiv
;
rewrite
!
insert_
of
_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
'
]
>
(
from
_heap
h
)))
?
lookup_insert
//.
rewrite
-
(
wp_cas_fail_pst
_
(
<
[
l
:=
v
'
]
>
(
of
_heap
h
)))
?
lookup_insert
//.
rewrite
const_equiv
// left_id.
rewrite
-
(
map_insert_singleton_op
h
);
last
by
eapply
heap_singleton_inv_l
.
rewrite
insert_
from
_heap
.
rewrite
insert_
of
_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
]
>
(
from
_heap
h
)))
?
lookup_insert
//.
rewrite
-
(
wp_cas_suc_pst
_
(
<
[
l
:=
v1
]
>
(
of
_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_
from
_heap
const_equiv
;
rewrite
!
insert_
of
_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
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment