Skip to content
Snippets Groups Projects
Commit b6b2f174 authored by Ralf Jung's avatar Ralf Jung
Browse files

complete heap.v

parent 042e24dc
No related branches found
No related tags found
No related merge requests found
...@@ -118,9 +118,13 @@ Section heap. ...@@ -118,9 +118,13 @@ Section heap.
P ( ( l, heap_mapsto HeapI γ l v -★ Q (LocV l))) P ( ( l, heap_mapsto HeapI γ l v -★ Q (LocV l)))
P wp E (Alloc e) Q. P wp E (Alloc e) Q.
Proof. Proof.
intros HN ? ? HP. eapply wp_alloc_heap with (σ:=); try eassumption. intros HN ? Hctx HP. rewrite -(right_id True%I ()%I (P)) (auth_empty γ) pvs_frame_l.
rewrite HP. Fail rewrite left_id. apply wp_strip_pvs. eapply wp_alloc_heap with (σ:=); try eassumption.
Abort. { eauto with I. }
rewrite HP comm. apply sep_mono.
- rewrite /heap_own. f_equiv. apply: map_eq=>l. by rewrite lookup_fmap !lookup_empty.
- apply later_mono, forall_mono=>l. apply wand_mono; last done. eauto with I.
Qed.
Lemma wp_load_heap N E γ σ l v P Q : Lemma wp_load_heap N E γ σ l v P Q :
σ !! l = Some v σ !! l = Some v
...@@ -276,4 +280,17 @@ Section heap. ...@@ -276,4 +280,17 @@ Section heap.
- rewrite /from_heap /to_heap lookup_insert_ne // !lookup_omap !lookup_op !lookup_fmap. - rewrite /from_heap /to_heap lookup_insert_ne // !lookup_omap !lookup_op !lookup_fmap.
rewrite lookup_insert_ne //. rewrite lookup_insert_ne //.
Qed. Qed.
Lemma wp_cas_suc N E γ l e1 v1 e2 v2 P Q :
to_val e1 = Some v1 to_val e2 = Some v2
nclose N E
P heap_ctx HeapI γ N
P (heap_mapsto HeapI γ l v1 (heap_mapsto HeapI γ l v2 -★ Q 'true))
P wp E (Cas (Loc l) e1 e2) Q.
Proof.
rewrite /heap_mapsto=>???? HP. eapply wp_cas_suc_heap; try eassumption; last first.
- rewrite HP. apply sep_mono; first done. by rewrite insert_singleton.
- by simplify_map_equality.
Qed.
End heap. End heap.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment