show that allocating a single ref is like normal map insertion
... | ... | @@ -143,17 +143,17 @@ Section gen_heap. |
Qed. | ||
Lemma gen_heap_alloc_gen σ σ' : | ||
σ ##ₘ σ' → gen_heap_ctx σ ==∗ gen_heap_ctx (σ ∪ σ') ∗ [∗ map] l ↦ v ∈ σ', l ↦ v. | ||
σ ##ₘ σ' → gen_heap_ctx σ ==∗ gen_heap_ctx (σ' ∪ σ) ∗ [∗ map] l ↦ v ∈ σ', l ↦ v. | ||
|
||
Proof. | ||
revert σ; induction σ' as [| l v σ' Hl IHσ'] using map_ind; | ||
iIntros (σ Hσdisj) "Hσ". | ||
- by rewrite right_id big_opM_empty; iFrame. | ||
- by rewrite left_id big_opM_empty; iFrame. | ||
- iMod (IHσ' with "Hσ") as "[Hσ m]"; first by eapply map_disjoint_insert_r. | ||
rewrite big_opM_insert //; iFrame. | ||
assert (σ !! l = None). | ||
{ eapply map_disjoint_Some_r; first by eauto. | ||
rewrite lookup_insert //. } | ||
rewrite -insert_union_r //. | ||
rewrite -insert_union_l //. | ||
iMod (gen_heap_alloc with "Hσ") as "[$ $]"; last done. | ||
apply lookup_union_None; split; auto. | ||
Qed. | ||
... | ... |