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

wp_eq_loc: don't throw away the mapstos

parent f4cc2bf4
No related branches found
No related tags found
1 merge request!7Adding location equality.
...@@ -268,9 +268,9 @@ Lemma wp_eq_int E (n1 n2 : Z) P Φ : ...@@ -268,9 +268,9 @@ Lemma wp_eq_int E (n1 n2 : Z) P Φ :
(n1 n2 P -∗ Φ (LitV false)) (n1 n2 P -∗ Φ (LitV false))
P -∗ WP BinOp EqOp (Lit (LitInt n1)) (Lit (LitInt n2)) @ E {{ Φ }}. P -∗ WP BinOp EqOp (Lit (LitInt n1)) (Lit (LitInt n2)) @ E {{ Φ }}.
Proof. Proof.
iIntros (Hl Hg) "HP". iIntros (Heq Hne) "HP".
destruct (bool_decide_reflect (n1 = n2)); [rewrite Hl //|rewrite Hg //]; destruct (bool_decide_reflect (n1 = n2)); [rewrite Heq //|rewrite Hne //];
clear Hl Hg; iApply wp_bin_op_pure; subst. clear Hne Heq; iApply wp_bin_op_pure; subst.
- intros. apply BinOpEqTrue. constructor. - intros. apply BinOpEqTrue. constructor.
- iNext; iIntros (?? Heval). by inversion_clear Heval; inv_lit. - iNext; iIntros (?? Heval). by inversion_clear Heval; inv_lit.
- intros. apply BinOpEqFalse. by constructor. - intros. apply BinOpEqFalse. by constructor.
...@@ -280,31 +280,37 @@ Qed. ...@@ -280,31 +280,37 @@ Qed.
Lemma wp_eq_loc E (l1 : loc) (l2: loc) P Φ : Lemma wp_eq_loc E (l1 : loc) (l2: loc) P Φ :
(l1 = l2 P -∗ Φ (LitV true)) (l1 = l2 P -∗ Φ (LitV true))
(l1 l2 P -∗ Φ (LitV false)) (l1 l2 P -∗ Φ (LitV false))
( q1 vl1 q2 vl2, l1 {q1} vl1 l2 {q2} vl2)%I -∗ (P -∗ q v, l1 {q} v)
(P -∗ q v, l2 {q} v)
P -∗ WP BinOp EqOp (Lit (LitLoc l1)) (Lit (LitLoc l2)) @ E {{ Φ }}. P -∗ WP BinOp EqOp (Lit (LitLoc l1)) (Lit (LitLoc l2)) @ E {{ Φ }}.
Proof. Proof.
iIntros (Hl Hg) "Hp HP". iIntros (Heq Hne Hl1 Hl2) "HP".
iDestruct "Hp" as (q1 vl1 q2 vl2) "Hp". destruct (bool_decide_reflect (l1 = l2)).
destruct (bool_decide_reflect (l1 = l2)); [rewrite Hl //|rewrite Hg //]; - rewrite Heq // {Heq Hne}. iApply wp_bin_op_pure; subst.
clear Hl Hg.
- iApply wp_bin_op_pure; subst.
+ intros. apply BinOpEqTrue. constructor. + intros. apply BinOpEqTrue. constructor.
+ iNext. iIntros (?? Heval). by inversion_clear Heval; inv_lit. + iNext. iIntros (?? Heval). by inversion_clear Heval; inv_lit.
- iApply wp_lift_atomic_head_step_no_fork; subst=>//. - clear Heq. iApply wp_lift_atomic_head_step_no_fork; subst=>//.
iIntros. iModIntro. inv_head_step. iIntros (σ1) "Hσ1". iModIntro. inv_head_step.
iSplitR. iSplitR.
{ iPureIntro. eexists _, _, _. constructor. apply BinOpEqFalse. by auto. } { iPureIntro. eexists _, _, _. constructor. apply BinOpEqFalse. by auto. }
(* We need to do a little gymnastics here to apply Hne now and strip away a
▷ but also keep the P. *)
iAssert (P Φ (LitV false))%I with "[HP]" as "HP".
{ iSplit; first done. by iApply Hne. }
iNext. iNext.
iIntros (e2 σ2 efs Hs) "!>". iIntros (e2 σ2 efs Hs) "!>".
inv_head_step. iSplitR=>//. inv_head_step. iSplitR=>//.
inversion H7; inv_lit=>//. match goal with [ H : bin_op_eval _ _ _ _ _ |- _ ] => inversion H end;
* iDestruct "Hp" as "[Hp _]". inv_lit=>//.
iDestruct (heap_read σ2 with "~ Hp") as (n') "%". * iExFalso. iDestruct "HP" as "[HP _]".
by rewrite H0 in H6. iDestruct (Hl1 with "HP") as (??) "Hl1".
* iDestruct "Hp" as "[_ Hp]". iDestruct (heap_read σ2 with "Hσ1 Hl1") as (n') "%".
iDestruct (heap_read σ2 with "~ Hp") as (n') "%". simplify_eq.
by rewrite H0 in H6. * iExFalso. iDestruct "HP" as "[HP _]".
* by iFrame. iDestruct (Hl2 with "HP") as (??) "Hl2".
iDestruct (heap_read σ2 with "Hσ1 Hl2") as (n') "%".
simplify_eq.
* iDestruct "HP" as "[_ $]". done.
Qed. Qed.
Lemma wp_eq_loc_0_r E (l : loc) P Φ : Lemma wp_eq_loc_0_r E (l : loc) P Φ :
......
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