Commit e724ddf8 authored by Robbert Krebbers's avatar Robbert Krebbers

Fix compilation with Iris 37cf94e2.

parent 7ab22ba1
...@@ -72,7 +72,7 @@ Section logrel. ...@@ -72,7 +72,7 @@ Section logrel.
Definition interp_env (Γ : list type) Definition interp_env (Γ : list type)
(Δ : listC D) (vs : list val) : iProp Σ := (Δ : listC D) (vs : list val) : iProp Σ :=
(length Γ = length vs [] zip_with (λ τ, τ Δ) Γ vs)%I. (length Γ = length vs [] zip_with (λ τ, τ Δ) Γ vs)%I.
Notation "⟦ Γ ⟧*" := (interp_env Γ). Notation "⟦ Γ ⟧*" := (interp_env Γ).
Definition interp_expr (τ : type) (Δ : listC D) (e : expr) : iProp Σ := Definition interp_expr (τ : type) (Δ : listC D) (e : expr) : iProp Σ :=
...@@ -154,7 +154,7 @@ Section logrel. ...@@ -154,7 +154,7 @@ Section logrel.
Lemma interp_env_nil Δ : True [] * Δ []. Lemma interp_env_nil Δ : True [] * Δ [].
Proof. iIntros ""; iSplit; auto. Qed. Proof. iIntros ""; iSplit; auto. Qed.
Lemma interp_env_cons Δ Γ vs τ v : Lemma interp_env_cons Δ Γ vs τ v :
τ :: Γ * Δ (v :: vs) ⊣⊢ τ Δ v Γ * Δ vs. τ :: Γ * Δ (v :: vs) ⊣⊢ τ Δ v Γ * Δ vs.
Proof. Proof.
rewrite /interp_env /= (assoc _ ( _ _ _)) -(comm _ (_ = _)%I) -assoc. rewrite /interp_env /= (assoc _ ( _ _ _)) -(comm _ (_ = _)%I) -assoc.
by apply sep_proper; [apply pure_proper; omega|]. by apply sep_proper; [apply pure_proper; omega|].
......
...@@ -61,7 +61,7 @@ Section logrel. ...@@ -61,7 +61,7 @@ Section logrel.
Qed. Qed.
Program Definition interp_ref_inv (l : loc) : D -n> iProp Σ := λne τi, Program Definition interp_ref_inv (l : loc) : D -n> iProp Σ := λne τi,
( v, l v τi v)%I. ( v, l v τi v)%I.
Solve Obligations with solve_proper. Solve Obligations with solve_proper.
Program Definition interp_ref Program Definition interp_ref
...@@ -84,7 +84,7 @@ Section logrel. ...@@ -84,7 +84,7 @@ Section logrel.
Definition interp_env (Γ : list type) Definition interp_env (Γ : list type)
(Δ : listC D) (vs : list val) : iProp Σ := (Δ : listC D) (vs : list val) : iProp Σ :=
(length Γ = length vs [] zip_with (λ τ, τ Δ) Γ vs)%I. (length Γ = length vs [] zip_with (λ τ, τ Δ) Γ vs)%I.
Notation "⟦ Γ ⟧*" := (interp_env Γ). Notation "⟦ Γ ⟧*" := (interp_env Γ).
Definition interp_expr (τ : type) (Δ : listC D) (e : expr) : iProp Σ := Definition interp_expr (τ : type) (Δ : listC D) (e : expr) : iProp Σ :=
...@@ -168,7 +168,7 @@ Section logrel. ...@@ -168,7 +168,7 @@ Section logrel.
Lemma interp_env_nil Δ : True [] * Δ []. Lemma interp_env_nil Δ : True [] * Δ [].
Proof. iIntros ""; iSplit; auto. Qed. Proof. iIntros ""; iSplit; auto. Qed.
Lemma interp_env_cons Δ Γ vs τ v : Lemma interp_env_cons Δ Γ vs τ v :
τ :: Γ * Δ (v :: vs) ⊣⊢ τ Δ v Γ * Δ vs. τ :: Γ * Δ (v :: vs) ⊣⊢ τ Δ v Γ * Δ vs.
Proof. Proof.
rewrite /interp_env /= (assoc _ ( _ _ _)) -(comm _ (_ = _)%I) -assoc. rewrite /interp_env /= (assoc _ ( _ _ _)) -(comm _ (_ = _)%I) -assoc.
by apply sep_proper; [apply pure_proper; omega|]. by apply sep_proper; [apply pure_proper; omega|].
......
...@@ -87,13 +87,13 @@ Section lang_rules. ...@@ -87,13 +87,13 @@ Section lang_rules.
Proof. by rewrite /to_heap -fmap_insert. Qed. Proof. by rewrite /to_heap -fmap_insert. Qed.
(** General properties of mapsto *) (** General properties of mapsto *)
Lemma heap_mapsto_op_eq l q1 q2 v : l {q1} v l {q2} v ⊣⊢ l {q1+q2} v. Lemma heap_mapsto_op_eq l q1 q2 v : l {q1} v l {q2} v ⊣⊢ l {q1+q2} v.
Proof. Proof.
by rewrite heap_mapsto_eq -auth_own_op op_singleton pair_op dec_agree_idemp. by rewrite heap_mapsto_eq -auth_own_op op_singleton pair_op dec_agree_idemp.
Qed. Qed.
Lemma heap_mapsto_op l q1 q2 v1 v2 : Lemma heap_mapsto_op l q1 q2 v1 v2 :
l {q1} v1 l {q2} v2 ⊣⊢ v1 = v2 l {q1+q2} v1. l {q1} v1 l {q2} v2 ⊣⊢ v1 = v2 l {q1+q2} v1.
Proof. Proof.
destruct (decide (v1 = v2)) as [->|]. destruct (decide (v1 = v2)) as [->|].
{ by rewrite heap_mapsto_op_eq pure_equiv // left_id. } { by rewrite heap_mapsto_op_eq pure_equiv // left_id. }
...@@ -103,7 +103,7 @@ Section lang_rules. ...@@ -103,7 +103,7 @@ Section lang_rules.
rewrite op_singleton pair_op dec_agree_ne // singleton_valid. by intros []. rewrite op_singleton pair_op dec_agree_ne // singleton_valid. by intros [].
Qed. Qed.
Lemma heap_mapsto_op_split l q v : (l {q} v)%I (l {q/2} v l {q/2} v)%I. Lemma heap_mapsto_op_split l q v : (l {q} v)%I (l {q/2} v l {q/2} v)%I.
Proof. by rewrite heap_mapsto_op_eq Qp_div_2. Qed. Proof. by rewrite heap_mapsto_op_eq Qp_div_2. Qed.
(** Base axioms for core primitives of the language: Stateful reductions. *) (** Base axioms for core primitives of the language: Stateful reductions. *)
...@@ -151,7 +151,7 @@ Section lang_rules. ...@@ -151,7 +151,7 @@ Section lang_rules.
Lemma wp_load E l q v : Lemma wp_load E l q v :
nclose heapN E nclose heapN E
{{{ heap_ctx l {q} v }}} Load (Loc l) @ E {{{ RET v; l {q} v }}}. {{{ heap_ctx l {q} v }}} Load (Loc l) @ E {{{ RET v; l {q} v }}}.
Proof. Proof.
iIntros (? Φ) "[#Hinv >Hl] HΦ". iIntros (? Φ) "[#Hinv >Hl] HΦ".
rewrite /heap_ctx heap_mapsto_eq /heap_mapsto_def. rewrite /heap_ctx heap_mapsto_eq /heap_mapsto_def.
...@@ -163,7 +163,7 @@ Section lang_rules. ...@@ -163,7 +163,7 @@ Section lang_rules.
Lemma wp_store E l v' e v : Lemma wp_store E l v' e v :
to_val e = Some v nclose heapN E to_val e = Some v nclose heapN E
{{{ heap_ctx l v' }}} Store (Loc l) e @ E {{{ heap_ctx l v' }}} Store (Loc l) e @ E
{{{ RET UnitV; l v }}}. {{{ RET UnitV; l v }}}.
Proof. Proof.
iIntros (<-%of_to_val ? Φ) "[#Hinv >Hl] HΦ". iIntros (<-%of_to_val ? Φ) "[#Hinv >Hl] HΦ".
......
...@@ -60,8 +60,8 @@ Section CG_Counter. ...@@ -60,8 +60,8 @@ Section CG_Counter.
Lemma steps_CG_increment E ρ j K x n: Lemma steps_CG_increment E ρ j K x n:
nclose specN E nclose specN E
spec_ctx ρ x ↦ₛ (#nv n) j fill K (App (CG_increment (Loc x)) Unit) spec_ctx ρ x ↦ₛ (#nv n) j fill K (App (CG_increment (Loc x)) Unit)
|={E}=> j fill K (Unit) x ↦ₛ (#nv (S n)). |={E}=> j fill K (Unit) x ↦ₛ (#nv (S n)).
Proof. Proof.
iIntros (HNE) "[#Hspec [Hx Hj]]". unfold CG_increment. iIntros (HNE) "[#Hspec [Hx Hj]]". unfold CG_increment.
iMod (step_rec _ _ j K _ _ _ _ with "[Hj]") as "Hj"; eauto. iMod (step_rec _ _ j K _ _ _ _ with "[Hj]") as "Hj"; eauto.
...@@ -120,9 +120,9 @@ Section CG_Counter. ...@@ -120,9 +120,9 @@ Section CG_Counter.
Lemma steps_CG_locked_increment E ρ j K x n l : Lemma steps_CG_locked_increment E ρ j K x n l :
nclose specN E nclose specN E
spec_ctx ρ x ↦ₛ (#nv n) l ↦ₛ (#v false) spec_ctx ρ x ↦ₛ (#nv n) l ↦ₛ (#v false)
j fill K (App (CG_locked_increment (Loc x) (Loc l)) Unit) j fill K (App (CG_locked_increment (Loc x) (Loc l)) Unit)
|={E}=> j fill K Unit x ↦ₛ (#nv S n) l ↦ₛ (#v false). |={E}=> j fill K Unit x ↦ₛ (#nv S n) l ↦ₛ (#v false).
Proof. Proof.
iIntros (HNE) "[#Hspec [Hx [Hl Hj]]]". iIntros (HNE) "[#Hspec [Hx [Hl Hj]]]".
iMod (steps_with_lock iMod (steps_with_lock
...@@ -160,9 +160,9 @@ Section CG_Counter. ...@@ -160,9 +160,9 @@ Section CG_Counter.
Lemma steps_counter_read E ρ j K x n : Lemma steps_counter_read E ρ j K x n :
nclose specN E nclose specN E
spec_ctx ρ x ↦ₛ (#nv n) spec_ctx ρ x ↦ₛ (#nv n)
j fill K (App (counter_read (Loc x)) Unit) j fill K (App (counter_read (Loc x)) Unit)
|={E}=> j fill K (#n n) x ↦ₛ (#nv n). |={E}=> j fill K (#n n) x ↦ₛ (#nv n).
Proof. Proof.
intros HNE. iIntros "[#Hspec [Hx Hj]]". unfold counter_read. intros HNE. iIntros "[#Hspec [Hx Hj]]". unfold counter_read.
iMod (step_rec _ _ j K _ Unit with "[Hj]") as "Hj"; eauto. iMod (step_rec _ _ j K _ Unit with "[Hj]") as "Hj"; eauto.
...@@ -282,7 +282,7 @@ Section CG_Counter. ...@@ -282,7 +282,7 @@ Section CG_Counter.
iApply wp_wand_l; iSplitR; [iIntros (v) "Hv"; iExact "Hv"|]. iApply wp_wand_l; iSplitR; [iIntros (v) "Hv"; iExact "Hv"|].
iApply (wp_alloc with "[]"); trivial; iFrame "#"; iNext; iIntros (cnt) "Hcnt /=". iApply (wp_alloc with "[]"); trivial; iFrame "#"; iNext; iIntros (cnt) "Hcnt /=".
(* establishing the invariant *) (* establishing the invariant *)
iAssert (( n, l ↦ₛ (#v false) cnt ↦ᵢ (#nv n) cnt' ↦ₛ (#nv n) )%I) iAssert (( n, l ↦ₛ (#v false) cnt ↦ᵢ (#nv n) cnt' ↦ₛ (#nv n) )%I)
with "[Hl Hcnt Hcnt']" as "Hinv". with "[Hl Hcnt Hcnt']" as "Hinv".
{ iExists _. by iFrame. } { iExists _. by iFrame. }
iMod (inv_alloc counterN with "[Hinv]") as "#Hinv"; trivial. iMod (inv_alloc counterN with "[Hinv]") as "#Hinv"; trivial.
......
...@@ -79,8 +79,8 @@ Section proof. ...@@ -79,8 +79,8 @@ Section proof.
Lemma steps_newlock E ρ j K : Lemma steps_newlock E ρ j K :
nclose specN E nclose specN E
spec_ctx ρ j fill K newlock spec_ctx ρ j fill K newlock
|={E}=> l, j fill K (Loc l) l ↦ₛ (#v false). |={E}=> l, j fill K (Loc l) l ↦ₛ (#v false).
Proof. Proof.
iIntros (HNE) "[#Hspec Hj]". iIntros (HNE) "[#Hspec Hj]".
by iMod (step_alloc _ _ j K with "[Hj]") as "Hj"; eauto. by iMod (step_alloc _ _ j K with "[Hj]") as "Hj"; eauto.
...@@ -90,8 +90,8 @@ Section proof. ...@@ -90,8 +90,8 @@ Section proof.
Lemma steps_acquire E ρ j K l : Lemma steps_acquire E ρ j K l :
nclose specN E nclose specN E
spec_ctx ρ l ↦ₛ (#v false) j fill K (App acquire (Loc l)) spec_ctx ρ l ↦ₛ (#v false) j fill K (App acquire (Loc l))
|={E}=> j fill K Unit l ↦ₛ (#v true). |={E}=> j fill K Unit l ↦ₛ (#v true).
Proof. Proof.
iIntros (HNE) "[#Hspec [Hl Hj]]". unfold acquire. iIntros (HNE) "[#Hspec [Hl Hj]]". unfold acquire.
iMod (step_rec _ _ j K with "[Hj]") as "Hj"; eauto. done. iMod (step_rec _ _ j K with "[Hj]") as "Hj"; eauto. done.
...@@ -109,8 +109,8 @@ Section proof. ...@@ -109,8 +109,8 @@ Section proof.
Lemma steps_release E ρ j K l b: Lemma steps_release E ρ j K l b:
nclose specN E nclose specN E
spec_ctx ρ l ↦ₛ (#v b) j fill K (App release (Loc l)) spec_ctx ρ l ↦ₛ (#v b) j fill K (App release (Loc l))
|={E}=> j fill K Unit l ↦ₛ (#v false). |={E}=> j fill K Unit l ↦ₛ (#v false).
Proof. Proof.
iIntros (HNE) "[#Hspec [Hl Hj]]". unfold release. iIntros (HNE) "[#Hspec [Hl Hj]]". unfold release.
iMod (step_rec _ _ j K with "[Hj]") as "Hj"; eauto; try done. iMod (step_rec _ _ j K with "[Hj]") as "Hj"; eauto; try done.
...@@ -125,11 +125,11 @@ Section proof. ...@@ -125,11 +125,11 @@ Section proof.
Lemma steps_with_lock E ρ j K e l P Q v w: Lemma steps_with_lock E ρ j K e l P Q v w:
nclose specN E nclose specN E
( f, e.[f] = e) (* e is a closed term *) ( f, e.[f] = e) (* e is a closed term *)
( K', spec_ctx ρ P j fill K' (App e (of_val w)) ( K', spec_ctx ρ P j fill K' (App e (of_val w))
|={E}=> j fill K' (of_val v) Q) |={E}=> j fill K' (of_val v) Q)
spec_ctx ρ P l ↦ₛ (#v false) spec_ctx ρ P l ↦ₛ (#v false)
j fill K (App (with_lock e (Loc l)) (of_val w)) j fill K (App (with_lock e (Loc l)) (of_val w))
|={E}=> j fill K (of_val v) Q l ↦ₛ (#v false). |={E}=> j fill K (of_val v) Q l ↦ₛ (#v false).
Proof. Proof.
iIntros (HNE H1 H2) "[#Hspec [HP [Hl Hj]]]". iIntros (HNE H1 H2) "[#Hspec [HP [Hl Hj]]]".
iMod (step_rec _ _ j K _ _ _ _ with "[Hj]") as "Hj"; eauto. iMod (step_rec _ _ j K _ _ _ _ with "[Hj]") as "Hj"; eauto.
......
...@@ -79,8 +79,8 @@ Section CG_Stack. ...@@ -79,8 +79,8 @@ Section CG_Stack.
Lemma steps_CG_push E ρ j K st v w : Lemma steps_CG_push E ρ j K st v w :
nclose specN E nclose specN E
spec_ctx ρ st ↦ₛ v j fill K (App (CG_push (Loc st)) (of_val w)) spec_ctx ρ st ↦ₛ v j fill K (App (CG_push (Loc st)) (of_val w))
|={E}=> j fill K Unit st ↦ₛ FoldV (InjRV (PairV w v)). |={E}=> j fill K Unit st ↦ₛ FoldV (InjRV (PairV w v)).
Proof. Proof.
intros HNE. iIntros "[#Hspec [Hx Hj]]". unfold CG_push. intros HNE. iIntros "[#Hspec [Hx Hj]]". unfold CG_push.
iMod (step_rec _ _ j K _ _ _ _ with "[Hj]") as "Hj"; eauto. iMod (step_rec _ _ j K _ _ _ _ with "[Hj]") as "Hj"; eauto.
...@@ -134,9 +134,9 @@ Section CG_Stack. ...@@ -134,9 +134,9 @@ Section CG_Stack.
Lemma steps_CG_locked_push E ρ j K st w v l : Lemma steps_CG_locked_push E ρ j K st w v l :
nclose specN E nclose specN E
spec_ctx ρ st ↦ₛ v l ↦ₛ (#v false) spec_ctx ρ st ↦ₛ v l ↦ₛ (#v false)
j fill K (App (CG_locked_push (Loc st) (Loc l)) (of_val w)) j fill K (App (CG_locked_push (Loc st) (Loc l)) (of_val w))
|={E}=> j fill K Unit st ↦ₛ FoldV (InjRV (PairV w v)) l ↦ₛ (#v false). |={E}=> j fill K Unit st ↦ₛ FoldV (InjRV (PairV w v)) l ↦ₛ (#v false).
Proof. Proof.
intros HNE. iIntros "[#Hspec [Hx [Hl Hj]]]". unfold CG_locked_push. intros HNE. iIntros "[#Hspec [Hx [Hl Hj]]]". unfold CG_locked_push.
iMod (steps_with_lock iMod (steps_with_lock
...@@ -175,9 +175,9 @@ Section CG_Stack. ...@@ -175,9 +175,9 @@ Section CG_Stack.
Lemma steps_CG_pop_suc E ρ j K st v w : Lemma steps_CG_pop_suc E ρ j K st v w :
nclose specN E nclose specN E
spec_ctx ρ st ↦ₛ FoldV (InjRV (PairV w v)) spec_ctx ρ st ↦ₛ FoldV (InjRV (PairV w v))
j fill K (App (CG_pop (Loc st)) Unit) j fill K (App (CG_pop (Loc st)) Unit)
|={E}=> j fill K (InjR (of_val w)) st ↦ₛ v. |={E}=> j fill K (InjR (of_val w)) st ↦ₛ v.
Proof. Proof.
intros HNE. iIntros "[#Hspec [Hx Hj]]". unfold CG_pop. intros HNE. iIntros "[#Hspec [Hx Hj]]". unfold CG_pop.
iMod (step_rec _ _ j K _ _ _ _ with "[Hj]") as "Hj"; eauto. iMod (step_rec _ _ j K _ _ _ _ with "[Hj]") as "Hj"; eauto.
...@@ -218,9 +218,9 @@ Section CG_Stack. ...@@ -218,9 +218,9 @@ Section CG_Stack.
Lemma steps_CG_pop_fail E ρ j K st : Lemma steps_CG_pop_fail E ρ j K st :
nclose specN E nclose specN E
spec_ctx ρ st ↦ₛ FoldV (InjLV UnitV) spec_ctx ρ st ↦ₛ FoldV (InjLV UnitV)
j fill K (App (CG_pop (Loc st)) Unit) j fill K (App (CG_pop (Loc st)) Unit)
|={E}=> j fill K (InjL Unit) st ↦ₛ FoldV (InjLV UnitV). |={E}=> j fill K (InjL Unit) st ↦ₛ FoldV (InjLV UnitV).
Proof. Proof.
iIntros (HNE) "[#Hspec [Hx Hj]]". unfold CG_pop. iIntros (HNE) "[#Hspec [Hx Hj]]". unfold CG_pop.
iMod (step_rec _ _ j K _ _ _ _ with "[Hj]") as "Hj"; eauto. iMod (step_rec _ _ j K _ _ _ _ with "[Hj]") as "Hj"; eauto.
...@@ -278,9 +278,9 @@ Section CG_Stack. ...@@ -278,9 +278,9 @@ Section CG_Stack.
Lemma steps_CG_locked_pop_suc E ρ j K st v w l : Lemma steps_CG_locked_pop_suc E ρ j K st v w l :
nclose specN E nclose specN E
spec_ctx ρ st ↦ₛ FoldV (InjRV (PairV w v)) l ↦ₛ (#v false) spec_ctx ρ st ↦ₛ FoldV (InjRV (PairV w v)) l ↦ₛ (#v false)
j fill K (App (CG_locked_pop (Loc st) (Loc l)) Unit) j fill K (App (CG_locked_pop (Loc st) (Loc l)) Unit)
|={E}=> j fill K (InjR (of_val w)) st ↦ₛ v l ↦ₛ (#v false). |={E}=> j fill K (InjR (of_val w)) st ↦ₛ v l ↦ₛ (#v false).
Proof. Proof.
iIntros (HNE) "[#Hspec [Hx [Hl Hj]]]". unfold CG_locked_pop. iIntros (HNE) "[#Hspec [Hx [Hl Hj]]]". unfold CG_locked_pop.
iMod (steps_with_lock _ _ j K _ _ _ _ (InjRV w) UnitV _ _ iMod (steps_with_lock _ _ j K _ _ _ _ (InjRV w) UnitV _ _
...@@ -293,9 +293,9 @@ Section CG_Stack. ...@@ -293,9 +293,9 @@ Section CG_Stack.
Lemma steps_CG_locked_pop_fail E ρ j K st l : Lemma steps_CG_locked_pop_fail E ρ j K st l :
nclose specN E nclose specN E
spec_ctx ρ st ↦ₛ FoldV (InjLV UnitV) l ↦ₛ (#v false) spec_ctx ρ st ↦ₛ FoldV (InjLV UnitV) l ↦ₛ (#v false)
j fill K (App (CG_locked_pop (Loc st) (Loc l)) Unit) j fill K (App (CG_locked_pop (Loc st) (Loc l)) Unit)
|={E}=> j fill K (InjL Unit) st ↦ₛ FoldV (InjLV UnitV) l ↦ₛ (#v false). |={E}=> j fill K (InjL Unit) st ↦ₛ FoldV (InjLV UnitV) l ↦ₛ (#v false).
Proof. Proof.
iIntros (HNE) "[#Hspec [Hx [Hl Hj]]]". unfold CG_locked_pop. iIntros (HNE) "[#Hspec [Hx [Hl Hj]]]". unfold CG_locked_pop.
iMod (steps_with_lock _ _ j K _ _ _ _ (InjLV UnitV) UnitV _ _ iMod (steps_with_lock _ _ j K _ _ _ _ (InjLV UnitV) UnitV _ _
...@@ -341,9 +341,9 @@ Section CG_Stack. ...@@ -341,9 +341,9 @@ Section CG_Stack.
Lemma steps_CG_snap E ρ j K st v l : Lemma steps_CG_snap E ρ j K st v l :
nclose specN E nclose specN E
spec_ctx ρ st ↦ₛ v l ↦ₛ (#v false) spec_ctx ρ st ↦ₛ v l ↦ₛ (#v false)
j fill K (App (CG_snap (Loc st) (Loc l)) Unit) j fill K (App (CG_snap (Loc st) (Loc l)) Unit)
|={E}=> j (fill K (of_val v)) st ↦ₛ v l ↦ₛ (#v false). |={E}=> j (fill K (of_val v)) st ↦ₛ v l ↦ₛ (#v false).
Proof. Proof.
iIntros (HNE) "[#Hspec [Hx [Hl Hj]]]". unfold CG_snap. iIntros (HNE) "[#Hspec [Hx [Hl Hj]]]". unfold CG_snap.
iMod (steps_with_lock _ _ j K _ _ _ _ v UnitV _ _ iMod (steps_with_lock _ _ j K _ _ _ _ v UnitV _ _
...@@ -407,7 +407,7 @@ Section CG_Stack. ...@@ -407,7 +407,7 @@ Section CG_Stack.
Lemma steps_CG_iter E ρ j K f v w : Lemma steps_CG_iter E ρ j K f v w :
nclose specN E nclose specN E
spec_ctx ρ spec_ctx ρ
j fill K (App (CG_iter (of_val f)) j fill K (App (CG_iter (of_val f))
(Fold (InjR (Pair (of_val w) (of_val v))))) (Fold (InjR (Pair (of_val w) (of_val v)))))
|={E}=> |={E}=>
j fill K j fill K
...@@ -441,7 +441,7 @@ Section CG_Stack. ...@@ -441,7 +441,7 @@ Section CG_Stack.
Lemma steps_CG_iter_end E ρ j K f : Lemma steps_CG_iter_end E ρ j K f :
nclose specN E nclose specN E
spec_ctx ρ j fill K (App (CG_iter (of_val f)) (Fold (InjL Unit))) spec_ctx ρ j fill K (App (CG_iter (of_val f)) (Fold (InjL Unit)))
|={E}=> j fill K Unit. |={E}=> j fill K Unit.
Proof. Proof.
iIntros (HNE) "[#Hspec Hj]". unfold CG_iter. iIntros (HNE) "[#Hspec Hj]". unfold CG_iter.
......
...@@ -73,10 +73,10 @@ Section Stack_refinement. ...@@ -73,10 +73,10 @@ Section Stack_refinement.
iFrame "Hls". iLeft. iSplit; trivial. iFrame "Hls". iLeft. iSplit; trivial.
} }
iAssert (( istk v h, (stack_owns h) iAssert (( istk v h, (stack_owns h)
stk' ↦ₛ v stk' ↦ₛ v
stk ↦ᵢ (FoldV (LocV istk)) stk ↦ᵢ (FoldV (LocV istk))
StackLink τi (LocV istk, v) StackLink τi (LocV istk, v)
l ↦ₛ (#v false) l ↦ₛ (#v false)
)%I) with "[Hoe Hstk Hstk' HLK Hl]" as "Hinv". )%I) with "[Hoe Hstk Hstk' HLK Hl]" as "Hinv".
{ iExists _, _, _. by iFrame "Hoe Hstk' Hstk Hl HLK". } { iExists _, _, _. by iFrame "Hoe Hstk' Hstk Hl HLK". }
iMod (inv_alloc stackN with "[Hinv]") as "#Hinv"; trivial. iMod (inv_alloc stackN with "[Hinv]") as "#Hinv"; trivial.
......
...@@ -28,13 +28,13 @@ Section Rules. ...@@ -28,13 +28,13 @@ Section Rules.
Notation "l ↦ˢᵗᵏ v" := (stack_mapsto l v) (at level 20) : uPred_scope. Notation "l ↦ˢᵗᵏ v" := (stack_mapsto l v) (at level 20) : uPred_scope.
Lemma stack_mapsto_dup l v : l ↦ˢᵗᵏ v l ↦ˢᵗᵏ v l ↦ˢᵗᵏ v. Lemma stack_mapsto_dup l v : l ↦ˢᵗᵏ v l ↦ˢᵗᵏ v l ↦ˢᵗᵏ v.
Proof. Proof.
by rewrite /stack_mapsto /auth_own -own_op -auth_frag_op -stackR_self_op. by rewrite /stack_mapsto /auth_own -own_op -auth_frag_op -stackR_self_op.
Qed. Qed.
Lemma stack_mapstos_agree l v w: Lemma stack_mapstos_agree l v w:
l ↦ˢᵗᵏ v l ↦ˢᵗᵏ w l ↦ˢᵗᵏ v l ↦ˢᵗᵏ w v = w. l ↦ˢᵗᵏ v l ↦ˢᵗᵏ w l ↦ˢᵗᵏ v l ↦ˢᵗᵏ w v = w.
Proof. Proof.
iIntros "H". iIntros "H".
rewrite -own_op. rewrite -own_op.
...@@ -46,10 +46,10 @@ Section Rules. ...@@ -46,10 +46,10 @@ Section Rules.
Qed. Qed.
Program Definition StackLink_pre (Q : D) : D -n> D := λne P v, Program Definition StackLink_pre (Q : D) : D -n> D := λne P v,
( l w, v.1 = LocV l l ↦ˢᵗᵏ w ( l w, v.1 = LocV l l ↦ˢᵗᵏ w
((w = InjLV UnitV v.2 = FoldV (InjLV UnitV)) ((w = InjLV UnitV v.2 = FoldV (InjLV UnitV))
( y1 z1 y2 z2, w = InjRV (PairV y1 (FoldV z1)) ( y1 z1 y2 z2, w = InjRV (PairV y1 (FoldV z1))
v.2 = FoldV (InjRV (PairV y2 z2)) Q (y1, y2) P(z1, z2))))%I. v.2 = FoldV (InjRV (PairV y2 z2)) Q (y1, y2) P(z1, z2))))%I.
Solve Obligations with solve_proper. Solve Obligations with solve_proper.
Global Instance StackLink_pre_contractive Q : Contractive (StackLink_pre Q). Global Instance StackLink_pre_contractive Q : Contractive (StackLink_pre Q).
...@@ -65,17 +65,17 @@ Section Rules. ...@@ -65,17 +65,17 @@ Section Rules.
Lemma StackLink_unfold Q v : Lemma StackLink_unfold Q v :
StackLink Q v ( l w, StackLink Q v ( l w,
v.1 = LocV l l ↦ˢᵗᵏ w v.1 = LocV l l ↦ˢᵗᵏ w
((w = InjLV UnitV v.2 = FoldV (InjLV UnitV)) ((w = InjLV UnitV v.2 = FoldV (InjLV UnitV))
( y1 z1 y2 z2, w = InjRV (PairV y1 (FoldV z1)) ( y1 z1 y2 z2, w = InjRV (PairV y1 (FoldV z1))
v.2 = FoldV (InjRV (PairV y2 z2)) v.2 = FoldV (InjRV (PairV y2 z2))
Q (y1, y2) @StackLink Q (z1, z2))))%I. Q (y1, y2) @StackLink Q (z1, z2))))%I.
Proof. by rewrite {1}/StackLink fixpoint_unfold. Qed. Proof. by rewrite {1}/StackLink fixpoint_unfold. Qed.
Global Opaque StackLink. (* So that we can only use the unfold above. *) Global Opaque StackLink. (* So that we can only use the unfold above. *)
Lemma StackLink_dup (Q : D) v `{ vw, PersistentP (Q vw)} : Lemma StackLink_dup (Q : D) v `{ vw, PersistentP (Q vw)} :
StackLink Q v StackLink Q v StackLink Q v. StackLink Q v StackLink Q v StackLink Q v.
Proof. Proof.
iIntros "H". iLöb as "Hlat" forall (v). rewrite StackLink_unfold. iIntros "H". iLöb as "Hlat" forall (v). rewrite StackLink_unfold.
iDestruct "H" as (l w) "[% [Hl Hr]]"; subst. iDestruct "H" as (l w) "[% [Hl Hr]]"; subst.
...@@ -174,14 +174,14 @@ Section Rules. ...@@ -174,14 +174,14 @@ Section Rules.
Definition stack_owns (h : stackUR) := Definition stack_owns (h : stackUR) :=
(own stack_name ( h) (own stack_name ( h)
[ map] l v h, match v with [ map] l v h, match v with
| DecAgree v' => l ↦ᵢ v' | DecAgree v' => l ↦ᵢ v'
| _ => True | _ => True
end)%I. end)%I.
Lemma stack_owns_alloc E h l v : Lemma stack_owns_alloc E h l v :
stack_owns h l ↦ᵢ v stack_owns h l ↦ᵢ v
|={E}=> stack_owns (<[l := DecAgree v]> h) l ↦ˢᵗᵏ v. |={E}=> stack_owns (<[l := DecAgree v]> h) l ↦ˢᵗᵏ v.
Proof. Proof.
iIntros "[[Hown Hall] Hl]". iIntros "[[Hown Hall] Hl]".
iDestruct (own_valid _ with "Hown") as "#Hvalid". iDestruct (own_valid _ with "Hown") as "#Hvalid".
...@@ -209,13 +209,13 @@ Section Rules. ...@@ -209,13 +209,13 @@ Section Rules.
Qed. Qed.
Lemma stack_owns_open h l v : Lemma stack_owns_open h l v :
stack_owns h l ↦ˢᵗᵏ v stack_owns h l ↦ˢᵗᵏ v
own stack_name ( h) own stack_name ( h)
([ map] l v delete l h, ([ map] l v delete l h,
match v with match v with
| DecAgree v' => l ↦ᵢ v' | DecAgree v' => l ↦ᵢ v'
| DecAgreeBot => True | DecAgreeBot => True
end) l ↦ᵢ v l ↦ˢᵗᵏ v. end) l ↦ᵢ v l ↦ˢᵗᵏ v.
Proof. Proof.
iIntros "[[Hown Hall] Hl]". iIntros "[[Hown Hall] Hl]".
unfold stack_mapsto, auth_own. unfold stack_mapsto, auth_own.
...@@ -231,12 +231,12 @@ Section Rules. ...@@ -231,12 +231,12 @@ Section Rules.