Commit 5ea9eab2 authored by Robbert Krebbers's avatar Robbert Krebbers

Add lemma `singleton_included : {[ i := x ]} ≼ ({[ i := y ]} x ≡ y ∨ x ≼ y`.

Rename existing asymmetric lemma `singleton_included` into `singleton_included_l`.
parent daf6f5e8
...@@ -308,7 +308,7 @@ Global Instance gmap_singleton_core_id i (x : A) : ...@@ -308,7 +308,7 @@ Global Instance gmap_singleton_core_id i (x : A) :
CoreId x CoreId {[ i := x ]}. CoreId x CoreId {[ i := x ]}.
Proof. intros. by apply core_id_total, core_singleton'. Qed. Proof. intros. by apply core_id_total, core_singleton'. Qed.
Lemma singleton_includedN n m i x : Lemma singleton_includedN_l n m i x :
{[ i := x ]} {n} m y, m !! i {n} Some y Some x {n} Some y. {[ i := x ]} {n} m y, m !! i {n} Some y Some x {n} Some y.
Proof. Proof.
split. split.
...@@ -321,7 +321,7 @@ Proof. ...@@ -321,7 +321,7 @@ Proof.
+ by rewrite lookup_op lookup_singleton_ne// lookup_partial_alter_ne// left_id. + by rewrite lookup_op lookup_singleton_ne// lookup_partial_alter_ne// left_id.
Qed. Qed.
(* We do not have [x ≼ y ↔ ∀ n, x ≼{n} y], so we cannot use the previous lemma *) (* We do not have [x ≼ y ↔ ∀ n, x ≼{n} y], so we cannot use the previous lemma *)
Lemma singleton_included m i x : Lemma singleton_included_l m i x :
{[ i := x ]} m y, m !! i Some y Some x Some y. {[ i := x ]} m y, m !! i Some y Some x Some y.
Proof. Proof.
split. split.
...@@ -333,13 +333,21 @@ Proof. ...@@ -333,13 +333,21 @@ Proof.
+ by rewrite lookup_op lookup_singleton lookup_partial_alter Hi. + by rewrite lookup_op lookup_singleton lookup_partial_alter Hi.
+ by rewrite lookup_op lookup_singleton_ne// lookup_partial_alter_ne// left_id. + by rewrite lookup_op lookup_singleton_ne// lookup_partial_alter_ne// left_id.
Qed. Qed.
Lemma singleton_included_exclusive m i x : Lemma singleton_included_exclusive_l m i x :
Exclusive x m Exclusive x m
{[ i := x ]} m m !! i Some x. {[ i := x ]} m m !! i Some x.
Proof. Proof.
intros ? Hm. rewrite singleton_included. split; last by eauto. intros ? Hm. rewrite singleton_included_l. split; last by eauto.
intros (y&?&->%(Some_included_exclusive _)); eauto using lookup_valid_Some. intros (y&?&->%(Some_included_exclusive _)); eauto using lookup_valid_Some.
Qed. Qed.
Lemma singleton_included i x y :
{[ i := x ]} ({[ i := y ]} : gmap K A) x y x y.
Proof.
rewrite singleton_included_l. split.
- intros (y'&Hi&?). rewrite lookup_insert in Hi.
apply Some_included. by rewrite Hi.
- intros ?. exists y. by rewrite lookup_insert Some_included.
Qed.
Global Instance singleton_cancelable i x : Global Instance singleton_cancelable i x :
Cancelable (Some x) Cancelable {[ i := x ]}. Cancelable (Some x) Cancelable {[ i := x ]}.
......
...@@ -146,7 +146,7 @@ Section to_gen_heap. ...@@ -146,7 +146,7 @@ Section to_gen_heap.
Lemma gen_heap_singleton_included σ l q v : Lemma gen_heap_singleton_included σ l q v :
{[l := (q, to_agree v)]} to_gen_heap σ σ !! l = Some v. {[l := (q, to_agree v)]} to_gen_heap σ σ !! l = Some v.
Proof. Proof.
rewrite singleton_included=> -[[q' av] []]. rewrite singleton_included_l=> -[[q' av] []].
rewrite /to_gen_heap lookup_fmap fmap_Some_equiv => -[v' [Hl [/= -> ->]]]. rewrite /to_gen_heap lookup_fmap fmap_Some_equiv => -[v' [Hl [/= -> ->]]].
move=> /Some_pair_included_total_2 [_] /to_agree_included /leibniz_equiv_iff -> //. move=> /Some_pair_included_total_2 [_] /to_agree_included /leibniz_equiv_iff -> //.
Qed. Qed.
......
...@@ -102,7 +102,7 @@ Section to_proph_map. ...@@ -102,7 +102,7 @@ Section to_proph_map.
Lemma proph_map_singleton_included R p vs : Lemma proph_map_singleton_included R p vs :
{[p := Excl vs]} to_proph_map R R !! p = Some vs. {[p := Excl vs]} to_proph_map R R !! p = Some vs.
Proof. Proof.
rewrite singleton_included_exclusive; last by apply to_proph_map_valid. rewrite singleton_included_exclusive_l; last by apply to_proph_map_valid.
by rewrite leibniz_equiv_iff /to_proph_map lookup_fmap fmap_Some=> -[v' [-> [->]]]. by rewrite leibniz_equiv_iff /to_proph_map lookup_fmap fmap_Some=> -[v' [-> [->]]].
Qed. Qed.
End to_proph_map. End to_proph_map.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment