Commit c3c39389 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

More lemmas about Some and included.

parent 786857a6
...@@ -1063,7 +1063,7 @@ Section option. ...@@ -1063,7 +1063,7 @@ Section option.
Proof. by destruct my. Qed. Proof. by destruct my. Qed.
Lemma option_included (mx my : option A) : Lemma option_included (mx my : option A) :
mx my mx = None x y, mx = Some x my = Some y (x y x y). mx my mx = None x y, mx = Some x my = Some y (x y x y).
Proof. Proof.
split. split.
- intros [mz Hmz]. - intros [mz Hmz].
...@@ -1071,10 +1071,10 @@ Section option. ...@@ -1071,10 +1071,10 @@ Section option.
destruct my as [y|]; [exists x, y|destruct mz; inversion_clear Hmz]. destruct my as [y|]; [exists x, y|destruct mz; inversion_clear Hmz].
destruct mz as [z|]; inversion_clear Hmz; split_and?; auto; destruct mz as [z|]; inversion_clear Hmz; split_and?; auto;
setoid_subst; eauto using cmra_included_l. setoid_subst; eauto using cmra_included_l.
- intros [->|(x&y&->&->&[[z Hz]|Hz])]. - intros [->|(x&y&->&->&[Hz|[z Hz]])].
+ exists my. by destruct my. + exists my. by destruct my.
+ exists (Some z); by constructor.
+ exists None; by constructor. + exists None; by constructor.
+ exists (Some z); by constructor.
Qed. Qed.
Lemma option_cmra_mixin : CMRAMixin (option A). Lemma option_cmra_mixin : CMRAMixin (option A).
...@@ -1094,10 +1094,10 @@ Section option. ...@@ -1094,10 +1094,10 @@ Section option.
destruct (pcore x) as [cx|] eqn:?; simpl; eauto using cmra_pcore_idemp. destruct (pcore x) as [cx|] eqn:?; simpl; eauto using cmra_pcore_idemp.
- intros mx my; setoid_rewrite option_included. - intros mx my; setoid_rewrite option_included.
intros [->|(x&y&->&->&[?|?])]; simpl; eauto. intros [->|(x&y&->&->&[?|?])]; simpl; eauto.
+ destruct (pcore x) as [cx|] eqn:?; eauto.
destruct (cmra_pcore_mono x y cx) as (?&?&?); eauto 10.
+ destruct (pcore x) as [cx|] eqn:?; eauto. + destruct (pcore x) as [cx|] eqn:?; eauto.
destruct (cmra_pcore_proper x y cx) as (?&?&?); eauto 10. destruct (cmra_pcore_proper x y cx) as (?&?&?); eauto 10.
+ destruct (pcore x) as [cx|] eqn:?; eauto.
destruct (cmra_pcore_mono x y cx) as (?&?&?); eauto 10.
- intros n [x|] [y|]; rewrite /validN /option_validN /=; - intros n [x|] [y|]; rewrite /validN /option_validN /=;
eauto using cmra_validN_op_l. eauto using cmra_validN_op_l.
- intros n mx my1 my2. - intros n mx my1 my2.
...@@ -1143,6 +1143,10 @@ Section option. ...@@ -1143,6 +1143,10 @@ Section option.
{n} (my Some x) my = None. {n} (my Some x) my = None.
Proof. rewrite comm. by apply exclusiveN_Some_l. Qed. Proof. rewrite comm. by apply exclusiveN_Some_l. Qed.
Lemma Some_included x y : Some x Some y x y x y.
Proof. rewrite option_included; naive_solver. Qed.
Lemma Some_included' `{CMRATotal A} x y : Some x Some y x y x y.
Proof. rewrite Some_included; naive_solver. Qed.
Lemma is_Some_included mx my : mx my is_Some mx is_Some my. Lemma is_Some_included mx my : mx my is_Some mx is_Some my.
Proof. rewrite -!not_eq_None_Some option_included. naive_solver. Qed. Proof. rewrite -!not_eq_None_Some option_included. naive_solver. Qed.
End option. End option.
...@@ -1156,8 +1160,8 @@ Proof. ...@@ -1156,8 +1160,8 @@ Proof.
split; first apply _. split; first apply _.
- intros n [x|] ?; rewrite /cmra_validN //=. by apply (validN_preserving f). - intros n [x|] ?; rewrite /cmra_validN //=. by apply (validN_preserving f).
- intros mx my; rewrite !option_included. - intros mx my; rewrite !option_included.
intros [->|(x&y&->&->&[?|Hxy])]; simpl; eauto 10 using @cmra_monotone. intros [->|(x&y&->&->&[Hxy|?])]; simpl; eauto 10 using @cmra_monotone.
right; exists (f x), (f y). by rewrite {4}Hxy; eauto. right; exists (f x), (f y). by rewrite {3}Hxy; eauto.
Qed. Qed.
Program Definition optionURF (F : rFunctor) : urFunctor := {| Program Definition optionURF (F : rFunctor) : urFunctor := {|
urFunctor_car A B := optionUR (rFunctor_car F A B); urFunctor_car A B := optionUR (rFunctor_car F A B);
......
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