Commit 392a0d4a authored by Ralf Jung's avatar Ralf Jung
Browse files

show that snapshot needs no control at all over the other location

parent 45ad940f
Pipeline #17450 failed with stage
in 14 minutes and 22 seconds
...@@ -13,26 +13,15 @@ Set Default Proof Using "Type". ...@@ -13,26 +13,15 @@ Set Default Proof Using "Type".
(* (*
newPair x y := newPair v :=
(ref (ref (x, 0)), ref y) ref (ref (v, 0))
*) *)
Definition newPair : val := Definition new_snapshot : val :=
λ: "args", λ: "v",
let: "x" := Fst "args" in ref (ref ("v", #0)).
let: "y" := Snd "args" in
(ref (ref ("x", #0)), ref "y").
(* (*
writeY (xp, yp) y := write xp x :=
yp <- y
*)
Definition writeY : val :=
λ: "args",
let: "p" := Fst "args" in
Snd "p" <- Snd "args".
(*
writeX (xp, yp) x :=
let xp1 = !xp in let xp1 = !xp in
let v = (!xp1).2 let v = (!xp1).2
let xp2 = ref (x, v + 1) let xp2 = ref (x, v + 1)
...@@ -40,62 +29,43 @@ Definition writeY : val := ...@@ -40,62 +29,43 @@ Definition writeY : val :=
then () then ()
else writeX (xp, yp) x else writeX (xp, yp) x
*) *)
Definition writeX : val := Definition write : val :=
rec: "writeX" "args" := rec: "write" "xp" "x" :=
let: "p" := Fst "args" in
let: "x" := Snd "args" in
let: "xp" := Fst "p" in
let: "xp1" := !"xp" in let: "xp1" := !"xp" in
let: "v" := Snd (!"xp1") in let: "v" := Snd (!"xp1") in
let: "xp2" := ref ("x", "v" + #1) in let: "xp2" := ref ("x", "v" + #1) in
if: CAS "xp" "xp1" "xp2" if: CAS "xp" "xp1" "xp2"
then #() then #()
else "writeX" "args". else "write" "xp" "x".
(* (*
readX (xp, yp) := read xp :=
!!xp (!!xp).1
*) *)
Definition readX : val := Definition read : val :=
λ: "p", λ: "xp",
let: "xp" := Fst "p" in Fst !(!"xp").
!(!"xp").
Definition readY : val :=
λ: "p",
let: "yp" := Snd "p" in
!"yp".
(* (*
readPair l := read_with xp l :=
let (x, v) = readX l in let (x, v) = !!xp in
let y = readY l in let y = !l in
let (_, v') = readX l in let (_, v') = !!xp in
if v = v' if v = v'
then (x, y) then (x, y)
else readPair l else readPair l
*) *)
Definition readPair : val := Definition read_with_proph : val :=
rec: "readPair" "l" := rec: "readPair" "xp" "l" :=
let: "x" := readX "l" in let: "proph" := NewProph in
let: "y" := readY "l" in let: "x" := ! !"xp" in
let: "x'" := readX "l" in let: "y" := !"l" in
if: Snd "x" = Snd "x'" let: "x'" := ! !"xp" in
then (Fst "x", Fst "y") let: "v_eq" := Snd "x" = Snd "x'" in
else "readPair" "l".
Definition readPair_proph : val :=
rec: "readPair" "l" :=
let: "xv1" := readX "l" in
let: "proph" := NewProph in
let: "y" := readY "l" in
let: "xv2" := readX "l" in
let: "v2" := Snd "xv2" in
let: "v_eq" := Snd "xv1" = "v2" in
resolve_proph: "proph" to: "v_eq" ;; resolve_proph: "proph" to: "v_eq" ;;
if: "v_eq" if: "v_eq"
then (Fst "xv1", "y") then (Fst "x", "y")
else "readPair" "l". else "readPair" "xp" "l".
(** The CMRA & functor we need. *) (** The CMRA & functor we need. *)
...@@ -120,7 +90,7 @@ Section atomic_snapshot. ...@@ -120,7 +90,7 @@ Section atomic_snapshot.
Definition gmap_to_UR T : timestampUR := to_agree <$> T. Definition gmap_to_UR T : timestampUR := to_agree <$> T.
Definition pair_inv γ1 γ2 l1 : iProp Σ := Definition snapshot_inv γ1 γ2 l1 : iProp Σ :=
( q (l1':loc) (T : gmap Z val) x (t : Z), ( q (l1':loc) (T : gmap Z val) x (t : Z),
(* we add the q to make the l1' map fractional. that way, (* we add the q to make the l1' map fractional. that way,
we can take a fraction of the l1' map out of the invariant we can take a fraction of the l1' map out of the invariant
...@@ -131,51 +101,50 @@ Section atomic_snapshot. ...@@ -131,51 +101,50 @@ Section atomic_snapshot.
T !! t = Some x T !! t = Some x
forall (t' : Z), t' dom (gset Z) T (t' <= t)%Z)%I. forall (t' : Z), t' dom (gset Z) T (t' <= t)%Z)%I.
Definition is_pair (γs: gname * gname * loc) (p : val) := Definition is_snapshot (γs: gname * gname) (p : val) :=
( (l1 : loc), p = (#l1, #γs.2)%V inv N (pair_inv γs.1.1 γs.1.2 l1))%I. ( (l1 : loc), p = #l1%V inv N (snapshot_inv γs.1 γs.2 l1))%I.
Global Instance is_pair_persistent γs p : Persistent (is_pair γs p) := _. Global Instance is_snapshot_persistent γs p : Persistent (is_snapshot γs p) := _.
Definition pair_content (γs : gname * gname * loc) (a : val * val) := Definition snapshot_content (γs : gname * gname) (a : val) :=
(own γs.1.1 ( Excl' a.1) γs.2 a.2)%I. (own γs.1 ( Excl' a))%I.
Global Instance pair_content_timeless γs a : Timeless (pair_content γs a) := _. Global Instance snapshot_content_timeless γs a : Timeless (snapshot_content γs a) := _.
Lemma pair_content_exclusive γs a1 a2 : Lemma snapshot_content_exclusive γs a1 a2 :
pair_content γs a1 - pair_content γs a2 - False. snapshot_content γs a1 - snapshot_content γs a2 - False.
Proof. Proof.
iIntros "[H1 _] [H2 _]". iDestruct (own_valid_2 with "H1 H2") as %[]. iIntros "H1 H2". iDestruct (own_valid_2 with "H1 H2") as %[].
Qed. Qed.
Definition new_timestamp t v : gmap Z val := {[ t := v ]}. Definition new_timestamp t v : gmap Z val := {[ t := v ]}.
Lemma newPair_spec (v1 v2 : val) : Lemma new_snapshot_spec (v : val) :
{{{ True }}} {{{ True }}}
newPair (v1, v2)%V new_snapshot v
{{{ γs p, RET p; is_pair γs p pair_content γs (v1, v2) }}}. {{{ γs p, RET p; is_snapshot γs p snapshot_content γs v }}}.
Proof. Proof.
iIntros (Φ _) "Hx". rewrite /newPair. wp_lam. iIntros (Φ _) "Hx". rewrite /new_snapshot. wp_lam.
repeat (wp_proj; wp_let). repeat (wp_proj; wp_let).
iApply wp_fupd. iApply wp_fupd.
wp_alloc ly as "Hly".
wp_alloc lx' as "Hlx'". wp_alloc lx' as "Hlx'".
wp_alloc lx as "Hlx". wp_alloc lx as "Hlx".
set (Excl' v1) as p. set (Excl' v) as p.
iMod (own_alloc ( p p)) as (γ1) "[Hx⚫ Hx◯]". { iMod (own_alloc ( p p)) as (γ1) "[Hx⚫ Hx◯]". {
rewrite /p. apply auth_both_valid. split; done. rewrite /p. apply auth_both_valid. split; done.
} }
set (new_timestamp 0 v1) as t. set (new_timestamp 0 v) as t.
iMod (own_alloc ( gmap_to_UR t gmap_to_UR t)) as (γ2) "[Ht⚫ Ht◯]". { iMod (own_alloc ( gmap_to_UR t gmap_to_UR t)) as (γ2) "[Ht⚫ Ht◯]". {
rewrite /t /new_timestamp. apply auth_both_valid. rewrite /t /new_timestamp. apply auth_both_valid.
split; first done. rewrite /gmap_to_UR map_fmap_singleton. apply singleton_valid. done. split; first done. rewrite /gmap_to_UR map_fmap_singleton. apply singleton_valid. done.
} }
wp_pures. iApply ("Hx" $! (γ1, γ2, ly)). wp_pures. iApply ("Hx" $! (γ1, γ2)).
iMod (inv_alloc N _ (pair_inv γ1 γ2 _) with "[-Hx◯ Ht◯ Hly]") as "#Hinv". { iMod (inv_alloc N _ (snapshot_inv γ1 γ2 _) with "[-Hx◯ Ht◯]") as "#Hinv". {
iNext. rewrite /pair_inv. iExists _, _, _, _, 0. iFrame. iNext. rewrite /snapshot_inv. iExists _, _, _, _, 0. iFrame.
iPureIntro. split; first done. intros ?. subst t. rewrite /new_timestamp dom_singleton. iPureIntro. split; first done. intros ?. subst t. rewrite /new_timestamp dom_singleton.
rewrite elem_of_singleton. lia. rewrite elem_of_singleton. lia.
} }
iModIntro. rewrite /is_pair /pair_content. iFrame. iExists _. iModIntro. rewrite /is_snapshot /snapshot_content. iFrame. iExists _.
iSplitL; first done. done. iSplitL; first done. done.
Qed. Qed.
...@@ -234,30 +203,12 @@ Section atomic_snapshot. ...@@ -234,30 +203,12 @@ Section atomic_snapshot.
by intros ->. by intros ->.
Qed. Qed.
Lemma writeY_spec γ (y2: val) p : Lemma write_spec γ (x2: val) p :
is_pair γ p - is_snapshot γ p -
<<< x y : val, pair_content γ (x, y) >>> <<< x : val, snapshot_content γ x >>>
writeY (p, y2)%V write p x2
@ ∖↑N @ ∖↑N
<<< pair_content γ (x, y2), RET #() >>>. <<< snapshot_content γ x2, RET #() >>>.
Proof.
iIntros "Hx". iIntros (Φ) "AU".
iDestruct "Hx" as (l1 ->) "#Hinv". wp_pures.
wp_lam. wp_pures.
iApply wp_fupd.
iMod "AU" as (xv yv) "[[Hx Hy] [_ Hclose]]".
wp_store.
iMod ("Hclose" with "[Hx Hy]") as "HΦ".
{ rewrite /pair_content. iFrame. }
eauto.
Qed.
Lemma writeX_spec γ (x2: val) p :
is_pair γ p -
<<< x y : val, pair_content γ (x, y) >>>
writeX (p, x2)%V
@ ∖↑N
<<< pair_content γ (x2, y), RET #() >>>.
Proof. Proof.
iIntros "Hx". iIntros (Φ) "AU". iLöb as "IH". iIntros "Hx". iIntros (Φ) "AU". iLöb as "IH".
iDestruct "Hx" as (l1 ->) "#Hinv". wp_pures. wp_lam. wp_pures. iDestruct "Hx" as (l1 ->) "#Hinv". wp_pures. wp_lam. wp_pures.
...@@ -268,7 +219,7 @@ Section atomic_snapshot. ...@@ -268,7 +219,7 @@ Section atomic_snapshot.
iDestruct "Hl1'" as "[Hl1'frac1 Hl1'frac2]". iDestruct "Hl1'" as "[Hl1'frac1 Hl1'frac2]".
iModIntro. iSplitR "AU Hl1'frac2". iModIntro. iSplitR "AU Hl1'frac2".
(* close invariant *) (* close invariant *)
{ iNext. rewrite /pair_inv. eauto 10 with iFrame. } { iNext. rewrite /snapshot_inv. eauto 10 with iFrame. }
wp_let. wp_bind (!_)%E. clear T. wp_let. wp_bind (!_)%E. clear T.
wp_load. wp_proj. wp_let. wp_op. wp_alloc l1'new as "Hl1'new". wp_load. wp_proj. wp_let. wp_op. wp_alloc l1'new as "Hl1'new".
wp_let. wp_let.
...@@ -281,20 +232,19 @@ Section atomic_snapshot. ...@@ -281,20 +232,19 @@ Section atomic_snapshot.
- wp_cas_suc. - wp_cas_suc.
iDestruct (mapsto_agree with "Hl1'frac2 Hl1''") as %[= -> ->]. iClear "Hl1'frac2". iDestruct (mapsto_agree with "Hl1'frac2 Hl1''") as %[= -> ->]. iClear "Hl1'frac2".
(* open AU *) (* open AU *)
iMod "AU" as (xv yv) "[[Hx Hy] [_ Hclose]]". iMod "AU" as (xv) "[Hx [_ Hclose]]".
(* update pair ghost state to (x2, y') *) (* update snapshot ghost state to (x2, y') *)
iDestruct (excl_sync with "Hx⚫ Hx") as %[= ->]. iDestruct (excl_sync with "Hx⚫ Hx") as %[= ->].
iMod (excl_update _ x2 with "Hx⚫ Hx") as "[Hx⚫ Hx◯]". iMod (excl_update _ x2 with "Hx⚫ Hx") as "[Hx⚫ Hx◯]".
(* close AU *) (* close AU *)
iMod ("Hclose" with "[Hx◯ Hy]") as "HΦ". iMod ("Hclose" with "Hx◯") as "HΦ".
{ rewrite /pair_content. iFrame. }
(* update timestamp *) (* update timestamp *)
iMod (timestamp_update _ T (v'' + 1)%Z x2 with "[Ht●]") as "Ht". iMod (timestamp_update _ T (v'' + 1)%Z x2 with "[Ht●]") as "Ht".
{ eapply (not_elem_of_dom (D:=gset Z) T). intros Hd. specialize (Hvt _ Hd). omega. } { eapply (not_elem_of_dom (D:=gset Z) T). intros Hd. specialize (Hvt _ Hd). omega. }
{ done. } { done. }
(* close invariant *) (* close invariant *)
iModIntro. iSplitR "HΦ". iModIntro. iSplitR "HΦ".
+ iNext. rewrite /pair_inv. + iNext. rewrite /snapshot_inv.
set (<[ v'' + 1 := x2]> T) as T'. set (<[ v'' + 1 := x2]> T) as T'.
iExists 1%Qp, l1'new, T', x2, (v'' + 1). iExists 1%Qp, l1'new, T', x2, (v'' + 1).
iFrame. iFrame.
...@@ -309,51 +259,32 @@ Section atomic_snapshot. ...@@ -309,51 +259,32 @@ Section atomic_snapshot.
specialize (Hvt _ Hv). lia. specialize (Hvt _ Hv). lia.
+ wp_if. done. + wp_if. done.
- wp_cas_fail. iModIntro. iSplitR "AU". - wp_cas_fail. iModIntro. iSplitR "AU".
+ iNext. rewrite /pair_inv. eauto 10 with iFrame. + iNext. rewrite /snapshot_inv. eauto 10 with iFrame.
+ wp_if. iApply "IH"; last eauto. rewrite /is_pair. eauto. + wp_if. iApply "IH"; last eauto. rewrite /is_snapshot. eauto.
Qed.
Lemma readY_spec γ p :
is_pair γ p -
<<< v1 v2 : val, pair_content γ (v1, v2) >>>
readY p
@ ∖↑N
<<< pair_content γ (v1, v2), RET v2 >>>.
Proof.
iIntros "Hx". iIntros (Φ) "AU".
iDestruct "Hx" as (l1 ->) "#Hinv".
repeat (wp_lam; wp_proj). wp_let.
iApply wp_fupd.
iMod "AU" as (xv yv) "[[Hx Hy] [_ Hclose]]".
wp_load.
rewrite /pair_content.
iMod ("Hclose" with "[$Hx $Hy]") as "HΦ".
iModIntro. done.
Qed. Qed.
Lemma readX_spec γ p : Lemma read_spec γ p :
is_pair γ p - is_snapshot γ p -
<<< v1 v2 : val, pair_content γ (v1, v2) >>> <<< v : val, snapshot_content γ v >>>
readX p read p
@ ∖↑N @ ∖↑N
<<< (t: Z), pair_content γ (v1, v2), RET (v1, #t) >>>. <<< snapshot_content γ v, RET v >>>.
Proof. Proof.
iIntros "Hx". iIntros (Φ) "AU". iIntros "Hx". iIntros (Φ) "AU".
iDestruct "Hx" as (l1 ->) "#Hinv". iDestruct "Hx" as (l1 ->) "#Hinv".
repeat (wp_lam; wp_proj). wp_let. wp_bind (! #l1)%E. wp_lam. wp_bind (! #l1)%E.
(* open invariant for 1st read *) (* open invariant for 1st read *)
iInv N as (q l1' T x v') ">[Hl1 [Hl1' [Hx⚫ Htime]]]". iInv N as (q l1' T x v') ">[Hl1 [Hl1' [Hx⚫ Htime]]]".
wp_load. wp_load.
iDestruct "Hl1'" as "[Hl1' Hl1'frac]". iDestruct "Hl1'" as "[Hl1' Hl1'frac]".
iMod "AU" as (xv yv) "[[Hx Hy] [_ Hclose]]". iMod "AU" as (xv) "[Hx [_ Hclose]]".
iDestruct (excl_sync with "Hx⚫ Hx") as %[= ->]. iDestruct (excl_sync with "Hx⚫ Hx") as %[= ->].
iMod ("Hclose" with "[Hx Hy]") as "HΦ". iMod ("Hclose" with "Hx") as "HΦ".
{ rewrite /pair_content. iFrame. }
(* close invariant *) (* close invariant *)
iModIntro. iSplitR "HΦ Hl1'". { iModIntro. iSplitR "HΦ Hl1'". {
iNext. unfold pair_inv. eauto 7 with iFrame. iNext. unfold snapshot_inv. eauto 7 with iFrame.
} }
iApply wp_fupd. wp_load. eauto. iApply wp_fupd. wp_load. wp_pures. eauto.
Qed. Qed.
Definition prophecy_to_bool (v : list (val * val)) : bool := Definition prophecy_to_bool (v : list (val * val)) : bool :=
...@@ -362,18 +293,20 @@ Section atomic_snapshot. ...@@ -362,18 +293,20 @@ Section atomic_snapshot.
| _ => false | _ => false
end. end.
Lemma readPair_spec γ p : Lemma read_with_spec γ p (l : loc) :
is_pair γ p - is_snapshot γ p -
<<< v1 v2 : val, pair_content γ (v1, v2) >>> <<< v1 v2 : val, snapshot_content γ v1 l v2 >>>
readPair_proph p read_with_proph p #l
@ ∖↑N @ ∖↑N
<<< pair_content γ (v1, v2), RET (v1, v2) >>>. <<< snapshot_content γ v1 l v2, RET (v1, v2) >>>.
Proof. Proof.
iIntros "Hx". iIntros (Φ) "AU". iLöb as "IH". iIntros "Hx". iIntros (Φ) "AU". iLöb as "IH". wp_lam. wp_pures.
(* ************ new prophecy ********** *)
wp_apply wp_new_proph; first done.
iIntros (proph_val proph) "Hpr".
wp_pures. wp_pures.
(* ************ 1st readX ********** *) (* ************ 1st readX ********** *)
iDestruct "Hx" as (l1 ->) "#Hinv". repeat (wp_lam; wp_pures). iDestruct "Hx" as (l1 ->) "#Hinv". wp_bind (! #l1)%E.
wp_bind (! #l1)%E.
(* open invariant for 1st read *) (* open invariant for 1st read *)
iInv N as (q_x1 l1' T_x x1 v_x1) ">[Hl1 [Hl1' [Hx⚫ [Ht_x Htime_x]]]]". iInv N as (q_x1 l1' T_x x1 v_x1) ">[Hl1 [Hl1' [Hx⚫ [Ht_x Htime_x]]]]".
iDestruct "Htime_x" as %[Hlookup_x Hdom_x]. iDestruct "Htime_x" as %[Hlookup_x Hdom_x].
...@@ -381,19 +314,14 @@ Section atomic_snapshot. ...@@ -381,19 +314,14 @@ Section atomic_snapshot.
iDestruct "Hl1'" as "[Hl1' Hl1'frac]". iDestruct "Hl1'" as "[Hl1' Hl1'frac]".
iMod "AU" as (xv yv) "[[Hx Hy] [Hclose _]]". iMod "AU" as (xv yv) "[[Hx Hy] [Hclose _]]".
iDestruct (excl_sync with "Hx⚫ Hx") as %[= ->]. iDestruct (excl_sync with "Hx⚫ Hx") as %[= ->].
iMod ("Hclose" with "[Hx Hy]") as "AU". iMod ("Hclose" with "[$Hx $Hy]") as "AU".
{ rewrite /pair_content. iFrame. }
(* duplicate timestamp T_x1 *) (* duplicate timestamp T_x1 *)
iMod (timestamp_dupl with "Ht_x") as "[Ht_x1⚫ Ht_x1◯]". iMod (timestamp_dupl with "Ht_x") as "[Ht_x1⚫ Ht_x1◯]".
(* close invariant *) (* close invariant *)
iModIntro. iSplitR "AU Hl1' Ht_x1◯". { iModIntro. iSplitR "AU Hl1' Ht_x1◯ Hpr". {
iNext. unfold pair_inv. eauto 8 with iFrame. iNext. unfold snapshot_inv. eauto 8 with iFrame.
} }
wp_load. wp_let. wp_load. wp_let.
(* ************ new prophecy ********** *)
wp_apply wp_new_proph; first done.
iIntros (proph_val proph) "Hpr".
wp_let.
(* ************ readY ********** *) (* ************ readY ********** *)
repeat (wp_lam; wp_pures). wp_bind (!_)%E. repeat (wp_lam; wp_pures). wp_bind (!_)%E.
iInv N as (q_y l1'_y T_y x_y v_y) ">[Hl1 [Hl1'_y [Hx⚫ [Ht_y Htime_y]]]]". iInv N as (q_y l1'_y T_y x_y v_y) ">[Hl1 [Hl1'_y [Hx⚫ [Ht_y Htime_y]]]]".
...@@ -402,7 +330,7 @@ Section atomic_snapshot. ...@@ -402,7 +330,7 @@ Section atomic_snapshot.
clear yv. clear yv.
iMod "AU" as (xv yv) "[[Hx Hy] Hclose]". iMod "AU" as (xv yv) "[[Hx Hy] Hclose]".
wp_load. wp_load.
rewrite /pair_content. rewrite /snapshot_content.
iDestruct (excl_sync with "Hx⚫ Hx") as %[= ->]. iDestruct (excl_sync with "Hx⚫ Hx") as %[= ->].
destruct (prophecy_to_bool proph_val) eqn:Hproph. destruct (prophecy_to_bool proph_val) eqn:Hproph.
- (* prophecy value is predicting that timestamp has not changed, so we commit *) - (* prophecy value is predicting that timestamp has not changed, so we commit *)
...@@ -416,7 +344,7 @@ Section atomic_snapshot. ...@@ -416,7 +344,7 @@ Section atomic_snapshot.
iModIntro. iModIntro. iModIntro. iModIntro.
(* closing invariant *) (* closing invariant *)
iSplitR "HΦ Hl1' Ht_x1◯ Ht_y◯ Hpr". iSplitR "HΦ Hl1' Ht_x1◯ Ht_y◯ Hpr".
{ iNext. unfold pair_inv. eauto 10 with iFrame. } { iNext. unfold snapshot_inv. eauto 10 with iFrame. }
wp_let. wp_let.
(* ************ 2nd readX ********** *) (* ************ 2nd readX ********** *)
repeat (wp_lam; wp_pures). wp_bind (! #l1)%E. repeat (wp_lam; wp_pures). wp_bind (! #l1)%E.
...@@ -429,10 +357,10 @@ Section atomic_snapshot. ...@@ -429,10 +357,10 @@ Section atomic_snapshot.
iDestruct (timestamp_sub with "[Ht_x2 Ht_y◯]") as "#Hs'"; first by iFrame. iDestruct (timestamp_sub with "[Ht_x2 Ht_y◯]") as "#Hs'"; first by iFrame.
iDestruct "Hs'" as %Hs'. iDestruct "Hs'" as %Hs'.
iModIntro. iSplitR "HΦ Hl1'_x2_frag Hpr". { iModIntro. iSplitR "HΦ Hl1'_x2_frag Hpr". {
iNext. unfold pair_inv. eauto 8 with iFrame. iNext. unfold snapshot_inv. eauto 8 with iFrame.
} }
wp_load. wp_let. wp_proj. wp_let. wp_proj. wp_op. wp_load. wp_pures.
case_bool_decide; wp_let; wp_apply (wp_resolve_proph with "Hpr"); case_bool_decide; wp_apply (wp_resolve_proph with "Hpr");
iIntros (vs') "[Eq _]"; iDestruct "Eq" as %->; wp_seq; wp_if. iIntros (vs') "[Eq _]"; iDestruct "Eq" as %->; wp_seq; wp_if.
+ inversion H; subst; clear H. wp_pures. + inversion H; subst; clear H. wp_pures.
assert (v_x2 = v_y) as ->. { assert (v_x2 = v_y) as ->. {
...@@ -451,37 +379,38 @@ Section atomic_snapshot. ...@@ -451,37 +379,38 @@ Section atomic_snapshot.
} }
done. done.
+ inversion Hproph. + inversion Hproph.
- iDestruct "Hclose" as "[Hclose _]". iMod ("Hclose" with "[$Hx $Hy]") as "AU". - (* prophecy value is predicting that timestamp has not changed, so we abort *)
iDestruct "Hclose" as "[Hclose _]". iMod ("Hclose" with "[$Hx $Hy]") as "AU".
iModIntro. iModIntro. iModIntro. iModIntro.
(* closing invariant *) (* closing invariant *)
iSplitR "AU Hpr". iSplitR "AU Hpr".
{ iNext. unfold pair_inv. eauto 10 with iFrame. } { iNext. unfold snapshot_inv. eauto 10 with iFrame. }
wp_let. wp_let.
(* ************ 2nd readX ********** *) (* ************ 2nd readX ********** *)
repeat (wp_lam; wp_proj). wp_let. wp_bind (! #l1)%E. wp_bind (! #l1)%E.
(* open invariant *) (* open invariant *)
iInv N as (q_x2 l1'_x2 T_x2 x2 v_x2) "[Hl1 [Hl1'_x2 [Hx⚫ [Ht_x2 Htime_x2]]]]".