Built with Alectryon, running Coq+SerAPI v8.16.0+0.16.3. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use ⌘ instead of Ctrl.
From Tealeaves Require Export
Classes.Functor
Classes.Categorical.Comonad (Extract, extract).Import Functor.Notations.#[local] Generalizable VariablesW A B C D.(** * Comonads *)(**********************************************************************)(** ** Operations *)(**********************************************************************)ClassCobind (W : Type -> Type) :=
cobind : forall (AB : Type), (W A -> B) -> W A -> W B.#[global] Arguments cobind {W}%function_scope {Cobind}
{A B}%type_scope _%function_scope _.(** ** Co-Kleisli Composition *)(**********************************************************************)Definitionkc1 {W : Type -> Type} `{Cobind W}
{A B C : Type} `(g : W B -> C) `(f : W A -> B) : (W A -> C) :=
g ∘ @cobind W _ A B f.#[local] Infix"⋆1" := (kc1) (at level60) : tealeaves_scope.(** ** Typeclasses *)(**********************************************************************)ClassComonad `(W : Type -> Type) `{Cobind W} `{Extract W} :=
{ kcom_cobind0 : forall `(f : W A -> B),
@extract W _ B ∘ @cobind W _ A B f = f;
kcom_cobind1 : forall (A : Type),
@cobind W _ A A (@extract W _ A) = @id (W A);
kcom_cobind2 : forall (ABC : Type) (g : W B -> C) (f : W A -> B),
@cobind W _ B C g ∘ @cobind W _ A B f = @cobind W _ A C (g ⋆1 f)
}.(** ** Kleisli Category Laws *)(**********************************************************************)SectionKleisli_category_laws.Context
`{Comonad W}.
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W B, C: Type
forallg : W B -> C, g ⋆1 extract = g
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W B, C: Type
forallg : W B -> C, g ⋆1 extract = g
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W B, C: Type g: W B -> C
g ⋆1 extract = g
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W B, C: Type g: W B -> C
g ∘ cobind extract = g
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W B, C: Type g: W B -> C
g ∘ id = g
reflexivity.Qed.
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W A, B: Type
forallf : W A -> B, extract ⋆1 f = f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W A, B: Type
forallf : W A -> B, extract ⋆1 f = f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W A, B: Type f: W A -> B
extract ⋆1 f = f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W A, B: Type f: W A -> B
extract ∘ cobind f = f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W A, B: Type f: W A -> B
f = f
reflexivity.Qed.
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W A, B, C, D: Type
forall (h : W C -> D) (g : W B -> C) (f : W A -> B),
(h ⋆1 g) ⋆1 f = h ⋆1 (g ⋆1 f)
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W A, B, C, D: Type
forall (h : W C -> D) (g : W B -> C) (f : W A -> B),
(h ⋆1 g) ⋆1 f = h ⋆1 (g ⋆1 f)
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W A, B, C, D: Type h: W C -> D g: W B -> C f: W A -> B
(h ⋆1 g) ⋆1 f = h ⋆1 (g ⋆1 f)
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W A, B, C, D: Type h: W C -> D g: W B -> C f: W A -> B
h ∘ cobind g ∘ cobind f = h ∘ cobind (g ∘ cobind f)
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W A, B, C, D: Type h: W C -> D g: W B -> C f: W A -> B
h ∘ (cobind g ∘ cobind f) = h ∘ cobind (g ∘ cobind f)
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W A, B, C, D: Type h: W C -> D g: W B -> C f: W A -> B
h ∘ cobind (g ⋆1 f) = h ∘ cobind (g ∘ cobind f)
reflexivity.Qed.EndKleisli_category_laws.(** ** Comonad Homomorphisms *)(** TODO *)(**********************************************************************)(** * Derived Structures *)(**********************************************************************)(** ** Derived Operations *)(**********************************************************************)ModuleDerivedOperations.#[export] InstanceMap_Cobind (W: Type -> Type)
`{Extract_W: Extract W} `{Cobind_W: Cobind W}: Map W :=
funAB (f : A -> B) =>
@cobind W Cobind_W A B (f ∘ @extract W Extract_W A).EndDerivedOperations.ClassCompat_Map_Cobind
(W: Type -> Type)
`{Extract_W: Extract W}
`{Cobind_W: Cobind W}
`{Map_W: Map W}: Prop :=
compat_map_cobind:
@Map_W = @DerivedOperations.Map_Cobind W Extract_W Cobind_W.
W: Type -> Type Extract_W: Extract W Cobind_W: Cobind W
Compat_Map_Cobind W
W: Type -> Type Extract_W: Extract W Cobind_W: Cobind W
Compat_Map_Cobind W
reflexivity.Qed.
W: Type -> Type Extract_W: Extract W Combind_W: Cobind W Map_W: Map W Compat_Map_Cobind0: Compat_Map_Cobind W
forall (AB : Type) (f : A -> B),
map f = cobind (f ∘ extract)
W: Type -> Type Extract_W: Extract W Combind_W: Cobind W Map_W: Map W Compat_Map_Cobind0: Compat_Map_Cobind W
forall (AB : Type) (f : A -> B),
map f = cobind (f ∘ extract)
W: Type -> Type Extract_W: Extract W Combind_W: Cobind W Map_W: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B: Type f: A -> B
map f = cobind (f ∘ extract)
W: Type -> Type Extract_W: Extract W Combind_W: Cobind W Map_W: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B: Type f: A -> B
DerivedOperations.Map_Cobind W A B f =
cobind (f ∘ extract)
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type
forall (g : W B -> C) (f : A -> B),
g ⋆1 f ∘ extract = g ∘ map f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type
forall (g : W B -> C) (f : A -> B),
g ⋆1 f ∘ extract = g ∘ map f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type g: W B -> C f: A -> B
g ⋆1 f ∘ extract = g ∘ map f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type g: W B -> C f: A -> B
g ∘ cobind (f ∘ extract) = g ∘ map f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type g: W B -> C f: A -> B
g ∘ cobind (f ∘ extract) = g ∘ cobind (f ∘ extract)
reflexivity.Qed.
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type
forall (g : B -> C) (f : W A -> B),
g ∘ extract ⋆1 f = g ∘ f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type
forall (g : B -> C) (f : W A -> B),
g ∘ extract ⋆1 f = g ∘ f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type g: B -> C f: W A -> B
g ∘ extract ⋆1 f = g ∘ f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type g: B -> C f: W A -> B
g ∘ extract ∘ cobind f = g ∘ f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type g: B -> C f: W A -> B
g ∘ (extract ∘ cobind f) = g ∘ f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type g: B -> C f: W A -> B
g ∘ f = g ∘ f
reflexivity.Qed.
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type
forall (g : B -> C) (f : A -> B),
g ∘ extract ⋆1 f ∘ extract = g ∘ f ∘ extract
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type
forall (g : B -> C) (f : A -> B),
g ∘ extract ⋆1 f ∘ extract = g ∘ f ∘ extract
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type g: B -> C f: A -> B
g ∘ extract ⋆1 f ∘ extract = g ∘ f ∘ extract
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type g: B -> C f: A -> B
g ∘ extract ∘ cobind (f ∘ extract) = g ∘ f ∘ extract
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type g: B -> C f: A -> B
g ∘ (extract ∘ cobind (f ∘ extract)) = g ∘ f ∘ extract
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W A, B, C: Type g: B -> C f: A -> B
g ∘ (f ∘ extract) = g ∘ f ∘ extract
reflexivity.Qed.(** *** Other rules for Kleisli composition *)(********************************************************************)
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W
forall (CD : Type) (h : W C -> D) (B : Type)
(g : B -> C) (A : Type) (f : W A -> B),
h ⋆1 g ∘ f = h ∘ map g ⋆1 f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W
forall (CD : Type) (h : W C -> D) (B : Type)
(g : B -> C) (A : Type) (f : W A -> B),
h ⋆1 g ∘ f = h ∘ map g ⋆1 f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W C, D: Type h: W C -> D B: Type g: B -> C A: Type f: W A -> B
h ⋆1 g ∘ f = h ∘ map g ⋆1 f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W C, D: Type h: W C -> D B: Type g: B -> C A: Type f: W A -> B
h ∘ cobind (g ∘ f) = h ∘ map g ∘ cobind f
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W C, D: Type h: W C -> D B: Type g: B -> C A: Type f: W A -> B
h ∘ cobind (g ∘ f) = h ∘ (map g ∘ cobind f)
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W C, D: Type h: W C -> D B: Type g: B -> C A: Type f: W A -> B
h ∘ cobind (g ∘ f) =
h ∘ (cobind (g ∘ extract) ∘ cobind f)
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W C, D: Type h: W C -> D B: Type g: B -> C A: Type f: W A -> B
h ∘ cobind (g ∘ f) = h ∘ cobind (g ∘ extract ⋆1 f)
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W C, D: Type h: W C -> D B: Type g: B -> C A: Type f: W A -> B
h ∘ cobind (g ∘ f) = h ∘ cobind (g ∘ f)
reflexivity.Qed.
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W
forall (CD : Type) (h : C -> D) (B : Type)
(g : W B -> C) (A : Type) (f : W A -> B),
h ∘ g ⋆1 f = h ∘ (g ⋆1 f)
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W
forall (CD : Type) (h : C -> D) (B : Type)
(g : W B -> C) (A : Type) (f : W A -> B),
h ∘ g ⋆1 f = h ∘ (g ⋆1 f)
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W C, D: Type h: C -> D B: Type g: W B -> C A: Type f: W A -> B
h ∘ g ⋆1 f = h ∘ (g ⋆1 f)
W: Type -> Type H: Cobind W H0: Extract W H1: Comonad W H2: Map W Compat_Map_Cobind0: Compat_Map_Cobind W C, D: Type h: C -> D B: Type g: W B -> C A: Type f: W A -> B