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

Contractive and non-expansiveness properties of later.

parent 457cf079
No related branches found
No related tags found
No related merge requests found
...@@ -278,8 +278,10 @@ Canonical Structure boolC := leibnizC bool. ...@@ -278,8 +278,10 @@ Canonical Structure boolC := leibnizC bool.
(** Later *) (** Later *)
Inductive later (A : Type) : Type := Later { later_car : A }. Inductive later (A : Type) : Type := Later { later_car : A }.
Add Printing Constructor later.
Arguments Later {_} _. Arguments Later {_} _.
Arguments later_car {_} _. Arguments later_car {_} _.
Section later. Section later.
Instance later_equiv `{Equiv A} : Equiv (later A) := λ x y, Instance later_equiv `{Equiv A} : Equiv (later A) := λ x y,
later_car x later_car y. later_car x later_car y.
...@@ -305,12 +307,14 @@ Section later. ...@@ -305,12 +307,14 @@ Section later.
Qed. Qed.
Canonical Structure laterC (A : cofeT) : cofeT := CofeT (later A). Canonical Structure laterC (A : cofeT) : cofeT := CofeT (later A).
Global Instance Later_contractive `{Dist A} : Contractive (@Later A).
Proof. by intros n ??. Qed.
Definition later_map {A B} (f : A B) (x : later A) : later B := Definition later_map {A B} (f : A B) (x : later A) : later B :=
Later (f (later_car x)). Later (f (later_car x)).
Instance later_fmap_ne `{Cofe A, Cofe B} (f : A B) : Global Instance later_map_ne `{Cofe A, Cofe B} (f : A B) n :
( n, Proper (dist n ==> dist n) f) Proper (dist (pred n) ==> dist (pred n)) f
n, Proper (dist n ==> dist n) (later_map f). Proper (dist n ==> dist n) (later_map f) | 0.
Proof. intros Hf [|n] [x] [y] ?; do 2 red; simpl. done. by apply Hf. Qed. Proof. destruct n as [|n]; intros Hf [x] [y] ?; do 2 red; simpl; auto. Qed.
Lemma later_fmap_id {A} (x : later A) : later_map id x = x. Lemma later_fmap_id {A} (x : later A) : later_map id x = x.
Proof. by destruct x. Qed. Proof. by destruct x. Qed.
Lemma later_fmap_compose {A B C} (f : A B) (g : B C) (x : later A) : Lemma later_fmap_compose {A B C} (f : A B) (g : B C) (x : later A) :
......
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