Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Iris/Iris/HeapLang/Completeness.lean
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ theorem wp_base_atomic {e₁ : Exp} {v₂ : Val} (l : Loc) (vlive : Val) (vnew :
icases (BigSepM.bigSepM_insert_acc (M := HeapF) (Φ := cellInv) hcell) $$ Hmap
with ⟨⟨Hpt, Hmeta⟩, Hclose⟩
iapply wp_lift_atomic_step (EctxLanguage.val_stuck (hbase σ hcell))
iintro %σ₁ %ns %obs %obs' %nt Hσ !>
icases (stateInterp_split σ₁ ns (obs ++ obs') nt).mp $$ Hσ with ⟨Hσ, Hproph⟩
iintro %σ₁ %ns %obs %nt Hσ !>
icases (stateInterp_split σ₁ ns obs nt).mp $$ Hσ with ⟨Hσ, Hproph⟩
ihave %hcell1 : ⌜get? (M := HeapF) σ₁.heap l = some (some vlive)⌝ $$ [Hσ Hpt]
· icases genHeap_valid $$ [$Hσ $Hpt] with >%hh
itrivial
Expand All @@ -121,7 +121,7 @@ theorem wp_base_atomic {e₁ : Exp} {v₂ : Val} (l : Loc) (vlive : Val) (vnew :
simp only [Stuckness.MaybeReducible]
exact EctxLanguage.primStep_reducible_of_baseStep_reducible
⟨[], _, _, [], hbase σ₁ hcell1⟩
iintro !> %e₂ %σ₂ %eₜ %Hprim -
iintro !> %e₂ %σ₂ %eₜ %κ %obs' %Hsplit %Hprim -
obtain ⟨rfl, rfl, rfl, rfl⟩ :=
hdet hcell1 (EctxLanguage.baseStep_of_primStep_of_baseStep_reducible
⟨[], _, _, [], hbase σ₁ hcell1⟩ Hprim)
Expand All @@ -130,7 +130,7 @@ theorem wp_base_atomic {e₁ : Exp} {v₂ : Val} (l : Loc) (vlive : Val) (vnew :
· ipureintro
exact EctxLanguage.primStep_of_baseStep (hbase σ hcell)
imodintro
ihave Hproph := (prophMapInterp_nil_append obs' σ₁.usedProphId).mp $$ Hproph
subst Hsplit
have hl0 : l + (0 : Int) = l := by
cases l
simp only [HAdd.hAdd, Loc.mk.injEq]
Expand Down Expand Up @@ -305,19 +305,19 @@ theorem wp_baseCompletenessGoal (e₁ : Exp) (σ : State) (E : CoPset)
iframe %hatom
iintro %Φ Hstep
iapply wp_lift_atomic_step (EctxLanguage.val_stuck (BaseStep.allocNS n v σ l hn hfresh))
iintro %σ₁ %ns %obs %obs' %nt Hσ !>
icases (stateInterp_split σ₁ ns (obs ++ obs') nt).mp $$ Hσ with ⟨Hσ, Hproph⟩
iintro %σ₁ %ns %obs %nt Hσ !>
icases (stateInterp_split σ₁ ns obs nt).mp $$ Hσ with ⟨Hσ, Hproph⟩
obtain ⟨lf, hlf⟩ := exists_fresh_block σ₁.heap n
have Hred₁ : BaseStep.Reducible (Exp.allocN (.val (.lit (.int n))) (.val v), σ₁) :=
⟨[], _, _, [], BaseStep.allocNS n v σ₁ lf hn hlf⟩
isplit
· ipureintro
simp only [Stuckness.MaybeReducible]
exact EctxLanguage.primStep_reducible_of_baseStep_reducible Hred₁
iintro !> %e₂ %σ₂ %eₜ %Hprim -
iintro !> %e₂ %σ₂ %eₜ %κ %obs' %Hsplit %Hprim -
rcases EctxLanguage.baseStep_of_primStep_of_baseStep_reducible Hred₁ Hprim
rename_i l' Hpo Hi
ihave Hproph := (prophMapInterp_nil_append obs' σ₁.usedProphId).mp $$ Hproph
subst Hsplit
icases Hinv with ⟨Hmap, Hproph_inv⟩
imod (genHeap_alloc_big (allocCells l' n.toNat (some v)) σ₁.heap (allocCells_disjoint Hi))
$$ Hσ with ⟨Hσ', Hnewpts, Hnewmeta⟩
Expand Down Expand Up @@ -361,8 +361,8 @@ theorem wp_baseCompletenessGoal (e₁ : Exp) (σ : State) (E : CoPset)
exact base_step_to_val_atomic Atomicity.StronglyAtomic (BaseStep.newProphS σ p hp)
iintro %Φ Hstep
iapply wp_lift_atomic_step (EctxLanguage.val_stuck (BaseStep.newProphS σ p hp))
iintro %σ₁ %ns %obs %obs' %nt Hσ !>
icases (stateInterp_split σ₁ ns (obs ++ obs') nt).mp $$ Hσ with ⟨Hσ, Hproph⟩
iintro %σ₁ %ns %obs %nt Hσ !>
icases (stateInterp_split σ₁ ns obs nt).mp $$ Hσ with ⟨Hσ, Hproph⟩
obtain ⟨pf, Hpf⟩ := Std.List.fresh σ₁.usedProphId.toList
have Hpf_contains : ¬ σ₁.usedProphId.contains pf := by
intro hc; exact Hpf (Std.ExtTreeSet.mem_toList.mpr hc)
Expand All @@ -372,13 +372,13 @@ theorem wp_baseCompletenessGoal (e₁ : Exp) (σ : State) (E : CoPset)
· ipureintro
simp only [Stuckness.MaybeReducible]
exact EctxLanguage.primStep_reducible_of_baseStep_reducible Hred₁
iintro !> %e₂ %σ₂ %eₜ %Hprim -
iintro !> %e₂ %σ₂ %eₜ %κ %obs' %Hsplit %Hprim -
cases EctxLanguage.baseStep_of_primStep_of_baseStep_reducible Hred₁ Hprim
rename_i p' Hp'
ihave Hproph := (prophMapInterp_nil_append obs' σ₁.usedProphId).mp $$ Hproph
subst Hsplit
have Hp'_mem : p' ∉ σ₁.usedProphId :=
fun hmem => Hp' (Std.ExtTreeSet.mem_iff_contains.symm.mp hmem)
imod (ProphMap.new_proph p' σ₁.usedProphId obs' Hp'_mem) $$ Hproph
imod (ProphMap.new_proph p' σ₁.usedProphId obs Hp'_mem) $$ Hproph
with ⟨Hproph', Htok⟩
icases Hinv with ⟨Hmap, Hproph_inv⟩
ihave %Hfresh_σ : ⌜p' ∉ σ.usedProphId⌝ $$ [Hproph_inv Htok]
Expand Down Expand Up @@ -412,7 +412,7 @@ theorem wp_baseCompletenessGoal (e₁ : Exp) (σ : State) (E : CoPset)
iapply (BigSepS.bigSepS_union hdisj).mpr
iframe
iapply BigSepS.bigSepS_singleton.mpr
iexists (prophListResolves obs' p')
iexists (prophListResolves obs p')
iexact Htok
| resolveS p v e σ w σ' κs ts hbase hp =>
have IH : heapInv (GF := GF) σ ⊢ iprop(|={E}=> baseCompletenessGoal e σ E) :=
Expand Down
Loading