Skip to content
Snippets Groups Projects
Commit f079e680 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Extensionality of map on agreement.

parent 5f13409c
No related branches found
No related tags found
No related merge requests found
...@@ -124,15 +124,21 @@ Proof. ...@@ -124,15 +124,21 @@ Proof.
Qed. Qed.
End agree. End agree.
Program Definition agree_map `{Dist A, Dist B}
(f : A B) (x : agree A) : agree B :=
{| agree_car n := f (x n); agree_is_valid := agree_is_valid x |}.
Solve Obligations with auto using agree_valid_0, agree_valid_S.
Section agree_map. Section agree_map.
Context `{Cofe A,Cofe B} (f : A B) `{Hf: n, Proper (dist n ==> dist n) f}. Context `{Cofe A, Cofe B} (f : A B) `{Hf: n, Proper (dist n ==> dist n) f}.
Program Definition agree_map (x : agree A) : agree B := Global Instance agree_map_ne n : Proper (dist n ==> dist n) (agree_map f).
{| agree_car n := f (x n); agree_is_valid := agree_is_valid x |}.
Solve Obligations with auto using agree_valid_0, agree_valid_S.
Global Instance agree_map_ne n : Proper (dist n ==> dist n) agree_map.
Proof. by intros x1 x2 Hx; split; simpl; intros; [apply Hx|apply Hf, Hx]. Qed. Proof. by intros x1 x2 Hx; split; simpl; intros; [apply Hx|apply Hf, Hx]. Qed.
Global Instance agree_map_proper: Proper (()==>()) agree_map := ne_proper _. Global Instance agree_map_proper :
Global Instance agree_map_monotone : CMRAMonotone agree_map. Proper (() ==> ()) (agree_map f) := ne_proper _.
Lemma agree_map_ext (g : A B) x :
( x, f x g x) agree_map f x agree_map g x.
Proof. by intros Hfg; split; simpl; intros; rewrite ?Hfg. Qed.
Global Instance agree_map_monotone : CMRAMonotone (agree_map f).
Proof. Proof.
split; [|by intros n x [? Hx]; split; simpl; [|by intros n' ?; rewrite Hx]]. split; [|by intros n x [? Hx]; split; simpl; [|by intros n' ?; rewrite Hx]].
intros x y n; rewrite !agree_includedN; intros Hy; rewrite Hy. intros x y n; rewrite !agree_includedN; intros Hy; rewrite Hy.
......
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