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.#[local] Generalizable VariablesF G.(** It is sometimes necessary to explicitly unfold<<compose>> in the type arguments of a <<compose>> in order to rewritewith naturality laws without using <<Set Keyed Unification>>. *)Ltacunfold_compose_in_compose :=
repeatmatch goal with
| |- context [@compose ?A?B?C] =>
letA' := evalunfold compose in A inletB' := evalunfold compose in B inletC' := evalunfold compose in C inprogress (change (@compose A B C) with
(@compose A' B' C'))
end.(** * The Composition of Two Functors *)(**********************************************************************)SectionFunctor_composition.Context
(GF: Type -> Type)
`{Functor F}
`{Functor G}.(* bump up the weight from 2~>3 to encourage using <Map_compose> only as a last resort during typeclass resolution *)#[export] InstanceMap_compose: Map (G ∘ F) | 3 :=
funABf => map (F := G) (map (F := F) f).#[export, program] InstanceFunctor_compose: Functor (G ∘ F).Solve Obligations with
(intros; unfold transparent tcs;
unfold_compose_in_compose;
(do2rewrite fun_map_id) +
(do2rewrite fun_map_map);
reflexivity).EndFunctor_composition.(** ** Composition with the Identity Functor *)(**********************************************************************)Require Import Tealeaves.Functors.Identity.Sectionlemmas.Context
`{Functor F}.
F: Type -> Type Map_F: Map F H: Functor F
Map_compose (funA : Type => A) F = @map F Map_F
F: Type -> Type Map_F: Map F H: Functor F
Map_compose (funA : Type => A) F = @map F Map_F
reflexivity.Qed.
F: Type -> Type Map_F: Map F H: Functor F
Map_compose F (funA : Type => A) = @map F Map_F
F: Type -> Type Map_F: Map F H: Functor F
Map_compose F (funA : Type => A) = @map F Map_F
reflexivity.Qed.
F: Type -> Type Map_F: Map F H: Functor F
forall (AB : Type) (f : A -> B), map f = map f
F: Type -> Type Map_F: Map F H: Functor F
forall (AB : Type) (f : A -> B), map f = map f
reflexivity.Qed.
F: Type -> Type Map_F: Map F H: Functor F
forall (AB : Type) (f : A -> B), map f = map f
F: Type -> Type Map_F: Map F H: Functor F
forall (AB : Type) (f : A -> B), map f = map f
reflexivity.Qed.Endlemmas.Import Functor.Notations.(** ** Composition of Natural Transformations *)(**********************************************************************)(* Do not export this instance or typeclass resolution goes hog wild *)
F1: Type -> Type H: Map F1 F2: Type -> Type H0: Map F2 F3: Type -> Type H1: Map F3 ϕ1: F1 ⇒ F2 ϕ2: F2 ⇒ F3 Natural0: Natural ϕ1 Natural1: Natural ϕ2
Natural (funA : Type => ϕ2 A ∘ ϕ1 A)
F1: Type -> Type H: Map F1 F2: Type -> Type H0: Map F2 F3: Type -> Type H1: Map F3 ϕ1: F1 ⇒ F2 ϕ2: F2 ⇒ F3 Natural0: Natural ϕ1 Natural1: Natural ϕ2
Natural (funA : Type => ϕ2 A ∘ ϕ1 A)
F1: Type -> Type H: Map F1 F2: Type -> Type H0: Map F2 F3: Type -> Type H1: Map F3 ϕ1: F1 ⇒ F2 ϕ2: F2 ⇒ F3 Natural0: Natural ϕ1 Natural1: Natural ϕ2 H2: Functor F1
Natural (funA : Type => ϕ2 A ∘ ϕ1 A)
F1: Type -> Type H: Map F1 F2: Type -> Type H0: Map F2 F3: Type -> Type H1: Map F3 ϕ1: F1 ⇒ F2 ϕ2: F2 ⇒ F3 Natural0: Natural ϕ1 Natural1: Natural ϕ2 H2: Functor F1 H3: Functor F3
Natural (funA : Type => ϕ2 A ∘ ϕ1 A)
F1: Type -> Type H: Map F1 F2: Type -> Type H0: Map F2 F3: Type -> Type H1: Map F3 ϕ1: F1 ⇒ F2 ϕ2: F2 ⇒ F3 Natural0: Natural ϕ1 Natural1: Natural ϕ2 H2: Functor F1 H3: Functor F3
forall (AB : Type) (f : A -> B),
map f ∘ (ϕ2 A ∘ ϕ1 A) = ϕ2 B ∘ ϕ1 B ∘ map f
F1: Type -> Type H: Map F1 F2: Type -> Type H0: Map F2 F3: Type -> Type H1: Map F3 ϕ1: F1 ⇒ F2 ϕ2: F2 ⇒ F3 Natural0: Natural ϕ1 Natural1: Natural ϕ2 H2: Functor F1 H3: Functor F3 A, B: Type f: A -> B
map f ∘ (ϕ2 A ∘ ϕ1 A) = ϕ2 B ∘ ϕ1 B ∘ map f
F1: Type -> Type H: Map F1 F2: Type -> Type H0: Map F2 F3: Type -> Type H1: Map F3 ϕ1: F1 ⇒ F2 ϕ2: F2 ⇒ F3 Natural0: Natural ϕ1 Natural1: Natural ϕ2 H2: Functor F1 H3: Functor F3 A, B: Type f: A -> B
map f ∘ ϕ2 A ∘ ϕ1 A = ϕ2 B ∘ ϕ1 B ∘ map f
F1: Type -> Type H: Map F1 F2: Type -> Type H0: Map F2 F3: Type -> Type H1: Map F3 ϕ1: F1 ⇒ F2 ϕ2: F2 ⇒ F3 Natural0: Natural ϕ1 Natural1: Natural ϕ2 H2: Functor F1 H3: Functor F3 A, B: Type f: A -> B
ϕ2 B ∘ map f ∘ ϕ1 A = ϕ2 B ∘ ϕ1 B ∘ map f
F1: Type -> Type H: Map F1 F2: Type -> Type H0: Map F2 F3: Type -> Type H1: Map F3 ϕ1: F1 ⇒ F2 ϕ2: F2 ⇒ F3 Natural0: Natural ϕ1 Natural1: Natural ϕ2 H2: Functor F1 H3: Functor F3 A, B: Type f: A -> B
ϕ2 B ∘ (map f ∘ ϕ1 A) = ϕ2 B ∘ ϕ1 B ∘ map f
F1: Type -> Type H: Map F1 F2: Type -> Type H0: Map F2 F3: Type -> Type H1: Map F3 ϕ1: F1 ⇒ F2 ϕ2: F2 ⇒ F3 Natural0: Natural ϕ1 Natural1: Natural ϕ2 H2: Functor F1 H3: Functor F3 A, B: Type f: A -> B