gen_proc proven - deprecations remaining

parent 9ff91ebf
Pipeline #9882 canceled with stages
......@@ -215,6 +215,8 @@ Lemma auth_both_op a b : Auth (Excl' a) b ≡ ● a ⋅ ◯ b.
Proof. by rewrite /op /auth_op /= left_id. Qed.
Lemma auth_auth_valid a : a ( a).
Proof. intros; split; simpl; auto using ucmra_unit_leastN. Qed.
Lemma auth_frag_valid a : a ( a).
Proof. intros; auto using ucmra_unit_leastN. Qed.
Lemma auth_update a b a' b' :
(a,b) ~l~> (a',b') a b ~~> a' b'.
......@@ -231,6 +233,9 @@ Proof. intros. rewrite -(right_id _ _ (● a)). by apply auth_update. Qed.
Lemma auth_update_dealloc a b a' : (a,b) ~l~> (a',ε) a b ~~> a'.
Proof. intros. rewrite -(right_id _ _ ( a')). by apply auth_update. Qed.
Lemma auth_alloc_unit a : a ~~> a ε.
Proof. intros. (* rewrite -(right_id _ _ (● a)). *) by apply auth_update_alloc. Qed.
Lemma auth_local_update (a b0 b1 a' b0' b1': A) :
(b0, b1) ~l~> (b0', b1') b0' a' a'
( a b0, a b1) ~l~> ( a' b0', a' b1').
......
......@@ -417,7 +417,8 @@ Proof.
intros Hi1 Hi2 Hup; apply local_update_unital=> n mf Hmv Hm; simpl in *.
destruct (Hup n (mf !! i)) as [? Hx']; simpl in *.
{ move: (Hmv i). by rewrite Hi1. }
{ move: (Hm i). by rewrite lookup_op Hi1 Hi2 Some_op_opM (inj_iff Some). }
{ move: (Hm i). rewrite lookup_op Hi1 Hi2. rewrite Some_op_opM (inj_iff Some). eauto.
(* by rewrite lookup_op Hi1 Hi2 Some_op_opM (inj_iff Some). *) }
split; auto using insert_validN.
rewrite Hm Hx'=> j; destruct (decide (i = j)) as [->|].
- by rewrite lookup_insert lookup_op lookup_insert Some_op_opM.
......@@ -471,8 +472,144 @@ Proof.
apply (delete_local_update_cancelable m _ i (Some x));
[done|by rewrite lookup_singleton].
Qed.
End properties.
Section unital_properties.
Context `{Countable K} {A : ucmraT}.
Implicit Types m : gmap K A.
Implicit Types i : K.
Implicit Types x y : A.
Lemma insert_idN (n:nat) (m : gmap K A) (i:K) (x:A) :
m !! i {n} Some x <[ i := x ]>m {n} m.
Proof.
intros H0. apply dist_Some_inv_r' in H0. destruct H0. destruct H0. rewrite H1.
by rewrite insert_id => //.
Qed.
Lemma insert_opN (m1 : gmap K A) (m2 : gmap K A) (i:K) (x:A) (y:A) :
<[ i := x y ]>(m1 m2) = <[ i := x ]>m1 <[ i := y ]>m2 .
Proof. by rewrite (insert_merge () m1 m2 i (x y) x y). Qed.
Lemma insert_alloc_local_update (m1 :gmap K A) (m2 : gmap K A) (i:K) (x:A) (x':A) (y':A) :
m1 !! i = Some x m2 !! i = None
(x, ε) ~l~> (x', y')
(m1, m2) ~l~> (<[i:=x']>m1, <[i:=y']>m2).
Proof.
intros Hi1 Hi2 Hup.
apply local_update_unital=> n mf Hmv Hm.
assert (dist n (mf !! i) (Some x)) as Hif.
{ move: (Hm i). rewrite lookup_op. rewrite Hi1 Hi2. by rewrite left_id. }
destruct (Hup n (mf !! i)) as [? Hx'].
{ move: (Hmv i). by rewrite Hi1. }
{ simpl. rewrite Hif. rewrite -(inj_iff Some). rewrite -Some_op_opM. rewrite -Some_op. by rewrite left_id. }
simpl in *.
assert ( (y' x) {n} (x') ).
{ rewrite Hx'. by rewrite Hif. }
assert ( (m2 mf) {n} (m1) ).
{ by rewrite Hm. }
split; auto using insert_validN.
rewrite Hm Hx' => j; destruct (decide (i = j)) as [->|].
- rewrite lookup_insert. rewrite Hif. rewrite -Some_op_opM. rewrite -Some_op.
rewrite H1. apply H0.
- rewrite lookup_insert_ne //.
rewrite H2. apply Hmv.
- rewrite -(insert_idN n mf i x) =>//.
rewrite -insert_opN.
rewrite -Hm.
by rewrite H1.
Qed.
End unital_properties.
Section nested_gmap_properties.
Context `{Countable K} {A : cmraT}.
Implicit Types m : gmap K (gmap K A).
Implicit Types p i : K.
Implicit Types x y : gmap K A.
Implicit Types v : A.
Definition insert2 m p i v :=
match m !! p with
| None => <[p := {[ i := v ]}]>m
| Some(m') => <[p:= <[ i := v ]>m']>m
end.
Definition delete2 `{Countable K} {A : Type} (p i:K) (m: gmap K (gmap K A)) :=
match (m !! p) with
| None => m
| Some(m') => <[p := delete i m']>m
end.
Lemma delete_something_update m1 m2 p i x y :
m1 !! p = Some x
m2 !! p = Some y
(x, y) ~l~> (delete i x, )
(m1, m2) ~l~> (delete2 p i m1, <[ p := ]>m2).
Proof.
intros.
unfold delete2.
rewrite H0.
apply insert_local_update with x y => //.
Qed.
(* Lemma delete_something_update m1 m2 p i v : *)
(* m2 !! p = Some {[ i := v ]} → *)
(* (m1, m2) ~l~> (delete2 p i m1, <[ p := ∅ ]>m2 ). *)
(* Proof. *)
(* intros. *)
(* apply local_update_unital=> n mf Hmv Hm. *)
(* assert (m1 !! p ≡{n}≡ Some {[ i := v ]} ) by admit. *)
(* split. *)
(* - admit. *)
(* - unfold delete2. *)
(* destruct (m1 !! p). *)
(* inversion H1. *)
(* rewrite H4. *)
(* rewrite delete_insert. *)
(* rewrite Hm. *)
(* SearchAbout op. *)
(* rewrite -insert_opN. *)
(* rewrite -(insert_idN). *)
(* eapply insert_local_update. *)
(* Lemma delete_something_update m1 m2 p i x y: *)
(* m1 !! p = Some x → *)
(* m2 !! p = Some y → *)
(* (x, y) ~l~> (delete i x, ∅) → *)
(* (m1, m2) ~l~> (delete2 p i m1, <[ p := ∅ ]>m2 ). *)
(* Proof. *)
(* intros. *)
(* apply local_update_unital=> n mf Hmv Hm. *)
(* assert (m !! p ≡{n}≡ Some {[ i := x ]} ) by admit. *)
(* split. *)
(* - unfold delete2. *)
(* destruct (m !! p). inversion H0. rewrite H3. apply insert_validN =>//. rewrite delete_insert => //. apply Hmv. *)
(* - rewrite left_id. *)
(* assert (m !! p ≡{n}≡ Some {[ i := x ]} ) by admit. *)
(* assert (mf !! p ≡{n}≡ None \/ (∃ mf', mf !! p ≡{n}≡ Some (mf') /\ mf !! i ≡{n}≡ None)) by admit. *)
(* split. *)
(* - unfold delete2. *)
(* destruct (m !! p). inversion H0. rewrite H4. apply insert_validN =>//. rewrite delete_insert => //. apply Hmv. *)
(* - unfold delete2. *)
(* destruct (m !! p). *)
(* inversion H0. *)
(* rewrite H4. *)
(* rewrite left_id. *)
(* rewrite Hm. *)
(* destruct H1. *)
(* + subst. rewrite -insert_singleton_op => //. *)
(* apply delete_notin. *)
(* rewrite -insert_opN. *)
(* Admitted. *)
End nested_gmap_properties.
Print delete_something_update.
(** Functor *)
Instance gmap_fmap_ne `{Countable K} {A B : ofeT} (f : A B) n :
Proper (dist n ==> dist n) f Proper (dist n ==>dist n) (fmap (M:=gmap K) f).
......
......@@ -57,6 +57,8 @@ Section to_gen_heap.
Proof. intros l. rewrite lookup_fmap. by case (σ !! l). Qed.
Lemma lookup_to_gen_heap_None σ l : σ !! l = None to_gen_heap σ !! l = None.
Proof. by rewrite /to_gen_heap lookup_fmap=> ->. Qed.
Lemma lookup_to_gen_heap_Some σ l v : σ !! l = Some v to_gen_heap σ !! l = Some (1%Qp, to_agree (v:leibnizC V)).
Proof. by rewrite /to_gen_heap lookup_fmap=> ->. Qed.
Lemma gen_heap_singleton_included σ l q v :
{[l := (q, to_agree v)]} to_gen_heap σ σ !! l = Some v.
Proof.
......
This diff is collapsed.
This diff is collapsed.
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