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 Import
Classes.Categorical.Monad
Classes.Categorical.Applicative
Adapters.CategoricalToKleisli.Monad
Misc.Product.Import Misc.Product.Notations.(** * Monadic Applicative Functors *)(**********************************************************************)SectionApplicative_Monad.#[local] Generalizable VariableT.Import Applicative.Notations.Context
`{Categorical.Monad.Monad T}.Import Kleisli.Monad.Import CategoricalToKleisli.Monad.DerivedOperations.Import CategoricalToKleisli.Monad.DerivedInstances.(** ** Derived Operations *)(********************************************************************)#[global] InstancePure_Monad: Pure T := @ret T _.#[global] InstanceMult_Monad: Mult T :=
funAB (p: T A * T B) =>
match p with (ta, tb) =>
bind (funa => strength (a, tb)) ta
end.(** ** Derived Laws *)(********************************************************************)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T
forall (AB : Type) (f : A -> B) (x : A),
map f (pure x) = pure (f x)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T
forall (AB : Type) (f : A -> B) (x : A),
map f (pure x) = pure (f x)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B: Type f: A -> B x: A
map f (pure x) = pure (f x)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B: Type f: A -> B x: A
map f (ret x) = ret (f x)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B: Type f: A -> B x: A
(map f ∘ ret) x = (ret ∘ f) x
nowrewrite (natural (ϕ := @ret T _)).Qed.
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T
forall (ABCD : Type) (f : A -> C) (g : B -> D)
(x : T A) (y : T B),
map f x ⊗ map g y = map (map_tensor f g) (x ⊗ y)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T
forall (ABCD : Type) (f : A -> C) (g : B -> D)
(x : T A) (y : T B),
map f x ⊗ map g y = map (map_tensor f g) (x ⊗ y)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C, D: Type f: A -> C g: B -> D x: T A y: T B
map f x ⊗ map g y = map (map_tensor f g) (x ⊗ y)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C, D: Type f: A -> C g: B -> D x: T A y: T B
bind (funa : C => strength (a, map g y)) (map f x) =
map (map_tensor f g)
(bind (funa : A => strength (a, y)) x)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C, D: Type f: A -> C g: B -> D x: T A y: T B
(bind (funa : C => strength (a, map g y)) ∘ map f) x =
(map (map_tensor f g)
∘ bind (funa : A => strength (a, y))) x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C, D: Type f: A -> C g: B -> D x: T A y: T B
bind ((funa : C => strength (a, map g y)) ∘ f) x =
(map (map_tensor f g)
∘ bind (funa : A => strength (a, y))) x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C, D: Type f: A -> C g: B -> D x: T A y: T B
bind ((funa : C => strength (a, map g y)) ∘ f) x =
bind
(map (map_tensor f g)
∘ (funa : A => strength (a, y))) x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C, D: Type f: A -> C g: B -> D x: T A y: T B
(funa : C => strength (a, map g y)) ∘ f =
map (map_tensor f g) ∘ (funa : A => strength (a, y))
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C, D: Type f: A -> C g: B -> D x: T A y: T B c: A
map (pair (f c)) (map g y) =
map (map_tensor f g) (map (pair c) y)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C, D: Type f: A -> C g: B -> D x: T A y: T B c: A
(map (pair (f c)) ∘ map g) y =
(map (map_tensor f g) ∘ map (pair c)) y
nowrewrite2(fun_map_map (F := T)).Qed.
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T
forall (ABC : Type) (x : T A) (y : T B) (z : T C),
map α (x ⊗ y ⊗ z) = x ⊗ (y ⊗ z)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T
forall (ABC : Type) (x : T A) (y : T B) (z : T C),
map α (x ⊗ y ⊗ z) = x ⊗ (y ⊗ z)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C
map α (x ⊗ y ⊗ z) = x ⊗ (y ⊗ z)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C
map α
(bind (funa : A * B => strength (a, z))
(bind (funa : A => strength (a, y)) x)) =
bind
(funa : A =>
strength
(a, bind (funa0 : B => strength (a0, z)) y)) x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C
map α
((bind (funa : A * B => strength (a, z))
∘ bind (funa : A => strength (a, y))) x) =
bind
(funa : A =>
strength
(a, bind (funa0 : B => strength (a0, z)) y)) x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C
map α
(bind
(kc (funa : A * B => strength (a, z))
(funa : A => strength (a, y))) x) =
bind
(funa : A =>
strength
(a, bind (funa0 : B => strength (a0, z)) y)) x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C
(map α
∘ bind
(kc (funa : A * B => strength (a, z))
(funa : A => strength (a, y)))) x =
bind
(funa : A =>
strength
(a, bind (funa0 : B => strength (a0, z)) y)) x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C
bind
(map α
∘ kc (funa : A * B => strength (a, z))
(funa : A => strength (a, y))) x =
bind
(funa : A =>
strength
(a, bind (funa0 : B => strength (a0, z)) y)) x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C
map α
∘ kc (funa : A * B => strength (a, z))
(funa : A => strength (a, y)) =
(funa : A =>
strength (a, bind (funa0 : B => strength (a0, z)) y))
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A
map α
(kc (funa : A * B => map (pair a) z)
(funa : A => map (pair a) y) a) =
map (pair a) (bind (funa : B => map (pair a) z) y)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A
map α
(kc (funa : A * B => map (pair a) z)
(funa : A => map (pair a) y) a) =
(map (pair a) ∘ bind (funa : B => map (pair a) z)) y
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A
map α
(kc (funa : A * B => map (pair a) z)
(funa : A => map (pair a) y) a) =
bind (map (pair a) ∘ (funa : B => map (pair a) z)) y
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A
map α
(kc (funa : A * B => map (pair a) z)
(funa : A => map (pair a) y) a) =
bind (funa0 : B => map (pair a) (map (pair a0) z)) y
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A
map α
(kc (funa : A * B => map (pair a) z)
(funa : A => map (pair a) y) a) =
bind (funa0 : B => (map (pair a) ∘ map (pair a0)) z)
y
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A
map α
((bind (funa : A * B => map (pair a) z)
∘ (funa : A => map (pair a) y)) a) =
bind (funa0 : B => (map (pair a) ∘ map (pair a0)) z)
y
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A
map α
(bind (funa : A * B => map (pair a) z)
(map (pair a) y)) =
bind (funa0 : B => map (pair a) (map (pair a0) z)) y
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A
map α
((bind (funa : A * B => map (pair a) z)
∘ map (pair a)) y) =
bind (funa0 : B => map (pair a) (map (pair a0) z)) y
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A
map α
(bind ((funa : A * B => map (pair a) z) ∘ pair a) y) =
bind (funa0 : B => map (pair a) (map (pair a0) z)) y
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A
(map α
∘ bind ((funa : A * B => map (pair a) z) ∘ pair a))
y =
bind (funa0 : B => map (pair a) (map (pair a0) z)) y
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A
bind
(map α
∘ ((funa : A * B => map (pair a) z) ∘ pair a)) y =
bind (funa0 : B => map (pair a) (map (pair a0) z)) y
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A
map α ∘ ((funa : A * B => map (pair a) z) ∘ pair a) =
(funa0 : B => map (pair a) (map (pair a0) z))
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A b: B
(map α ∘ ((funa : A * B => map (pair a) z) ∘ pair a))
b = map (pair a) (map (pair b) z)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A b: B
map α (map (pair (a, b)) z) =
map (pair a) (map (pair b) z)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B, C: Type x: T A y: T B z: T C a: A b: B
(map α ∘ map (pair (a, b))) z =
(map (pair a) ∘ map (pair b)) z
nowdo2 (rewrite (fun_map_map (F := T))).Qed.
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T
forall (A : Type) (x : T A),
map left_unitor (pure tt ⊗ x) = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T
forall (A : Type) (x : T A),
map left_unitor (pure tt ⊗ x) = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
map left_unitor (pure tt ⊗ x) = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
map left_unitor
(bind (funa : unit => strength (a, x)) (ret tt)) =
x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
map left_unitor
((bind (funa : unit => strength (a, x)) ∘ ret) tt) =
x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
map left_unitor (strength (tt, x)) = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
map left_unitor (map (pair tt) x) = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
(map left_unitor ∘ map (pair tt)) x = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
map (left_unitor ∘ pair tt) x = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
map id x = x
nowrewrite (fun_map_id (F := T)).Qed.
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T
forall (A : Type) (x : T A),
map right_unitor (x ⊗ pure tt) = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T
forall (A : Type) (x : T A),
map right_unitor (x ⊗ pure tt) = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
map right_unitor (x ⊗ pure tt) = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
map right_unitor
(bind (funa : A => strength (a, ret tt)) x) = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
(map right_unitor
∘ bind (funa : A => strength (a, ret tt))) x = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
bind
(map right_unitor
∘ (funa : A => strength (a, ret tt))) x = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
bind ret x = x
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
ret =
map right_unitor ∘ (funa : A => strength (a, ret tt))
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A
ret =
map right_unitor ∘ (funa : A => strength (a, ret tt))
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A a: A
ret a = map right_unitor (map (pair a) (ret tt))
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A a: A
ret a = (map right_unitor ∘ map (pair a)) (ret tt)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A a: A
ret a = map (right_unitor ∘ pair a) (ret tt)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A a: A
ret a = (map (right_unitor ∘ pair a) ∘ ret) tt
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A: Type x: T A a: A
ret a = (ret ∘ map (right_unitor ∘ pair a)) tt
nowunfold compose; cbn.Qed.
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T
forall (AB : Type) (a : A) (b : B),
pure a ⊗ pure b = pure (a, b)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T
forall (AB : Type) (a : A) (b : B),
pure a ⊗ pure b = pure (a, b)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B: Type a: A b: B
pure a ⊗ pure b = pure (a, b)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B: Type a: A b: B
pure a ⊗ pure b = pure (a, b)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B: Type a: A b: B
bind (funa : A => strength (a, ret b)) (ret a) =
ret (a, b)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B: Type a: A b: B
(bind (funa : A => strength (a, ret b)) ∘ ret) a =
ret (a, b)
T: Type -> Type H: Map T H0: Return T H1: Join T H2: Categorical.Monad.Monad T A, B: Type a: A b: B