Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Joshua Yanovski
iris-coq
Commits
2136375b
Commit
2136375b
authored
Feb 13, 2016
by
Robbert Krebbers
Browse files
Some heap stuff.
parent
4fea482a
Changes
1
Hide whitespace changes
Inline
Side-by-side
heap_lang/heap.v
View file @
2136375b
...
...
@@ -14,9 +14,6 @@ Proof. split; apply _. Qed.
Definition
to_heap
:
state
→
heapRA
:=
fmap
Excl
.
Definition
from_heap
:
heapRA
→
state
:=
omap
(
maybe
Excl
).
Lemma
from_to_heap
σ
:
from_heap
(
to_heap
σ
)
=
σ
.
Proof
.
apply
map_eq
=>
l
.
rewrite
lookup_omap
lookup_fmap
.
by
case
(
σ
!!
l
).
Qed
.
(
*
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
that
.
We
should
be
able
to
derive
the
lemmas
we
want
for
this
,
too
.
*
)
...
...
@@ -37,16 +34,22 @@ Section heap.
Implicit
Types
h
g
:
heapRA
.
Implicit
Types
γ
:
gname
.
Global
Instance
heap_inv_proper
:
P
ro
per
((
≡
)
==>
(
≡
))
(
heap_inv
HeapI
)
.
Lemma
from_to_heap
σ
:
f
ro
m_heap
(
to_heap
σ
)
=
σ
.
Proof
.
move
=>?
?
EQ
.
rewrite
/
heap_inv
/
from_heap
.
(
*
TODO
I
guess
we
need
some
lemma
about
omap
?
*
)
Admitted
.
(
*
FIXME
...
I
can
'
t
make
progress
otherwise
...
*
)
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
.
Hint
Resolve
to_heap_valid
.
Global
Instance
heap_inv_proper
:
Proper
((
≡
)
==>
(
≡
))
(
heap_inv
HeapI
).
Proof
.
by
intros
h1
h2
;
fold_leibniz
=>
->
.
Qed
.
Lemma
heap_own_op
γ
σ
1
σ
2
:
(
heap_own
HeapI
γ
σ
1
★
heap_own
HeapI
γ
σ
2
)
%
I
≡
(
■
(
σ
1
⊥ₘ
σ
2
)
∧
heap_own
HeapI
γ
(
σ
1
∪
σ
2
))
%
I
.
Proof
.
(
*
TODO
.
*
)
Proof
.
(
*
TODO
.
*
)
Abort
.
Lemma
heap_own_mapsto
γ
σ
l
v
:
...
...
@@ -60,11 +63,7 @@ Section heap.
Lemma
heap_alloc
N
σ
:
ownP
σ
⊑
pvs
N
N
(
∃
γ
,
heap_ctx
HeapI
γ
N
∧
heap_own
HeapI
γ
σ
).
Proof
.
rewrite
-{
1
}
[
σ
]
from_to_heap
.
rewrite
-
(
auth_alloc
_
N
);
first
done
.
move
=>
n
l
.
rewrite
lookup_fmap
.
by
case
_
:
(
σ
!!
l
)
=>
[
v
|
]
/=
.
Qed
.
Proof
.
by
rewrite
-{
1
}
[
σ
]
from_to_heap
-
(
auth_alloc
_
N
).
Qed
.
Lemma
wp_load_heap
N
E
γ
σ
l
v
P
Q
:
nclose
N
⊆
E
→
...
...
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