module Cat.Functor.Constant where
Constant functors🔗
A constant functor is a functor that sends every object of to a single object and every morphism of to the identity morphism.
module _ {o ℓ o' ℓ'} {C : Precategory o ℓ} {D : Precategory o' ℓ'} where private module C = Cat.Reasoning C module D = Cat.Reasoning D open Functor open _=>_
Equivalently, constant functors are factorizations through the terminal category. We opt to take this notion as primitive for ergonomic reasons: it is useful to only be able to write constant functors in a single way.
Const : D.Ob → Functor C D Const X = !Const X F∘ !F
Natural transformations between constant functors are given by a single morphism, and natural isomorphisms by a single iso.
constⁿ : {X Y : D.Ob} → D.Hom X Y → Const X => Const Y constⁿ f = !constⁿ f ◂ !F const-isoⁿ : {X Y : D.Ob} → X D.≅ Y → Const X ≅ⁿ Const Y const-isoⁿ f = iso→isoⁿ (λ _ → f) (λ f → D.id-comm-sym)
-- Coherence lemmas for cones and cocones as natural transformations. to-coconeⁿ : ∀ {F : Functor C D} {K : Functor ⊤Cat D} → F => K F∘ !F → F => Const (K .F₀ tt) to-coconeⁿ {K = K} ψ .η = ψ .η to-coconeⁿ {K = K} ψ .is-natural x y f = ψ .is-natural x y f ∙ ap₂ D._∘_ (K .F-id) refl to-coneⁿ : ∀ {F : Functor C D} {K : Functor ⊤Cat D} → K F∘ !F => F → Const (K .F₀ tt) => F to-coneⁿ {K = K} ψ .η = ψ .η to-coneⁿ {K = K} ψ .is-natural x y f = ap₂ D._∘_ refl (sym (K .F-id)) ∙ ψ .is-natural x y f
Essentially constant functors🔗
A functor is essentially constant if it is (merely) isomorphic to a constant functor.
is-essentially-constant : Functor C D → Type _ is-essentially-constant F = ∃[ X ∈ D.Ob ] (F ≅ⁿ Const X)
module _ {ob ℓb oc ℓc od ℓd} {B : Precategory ob ℓb} {C : Precategory oc ℓc} {D : Precategory od ℓd} (F : Functor C D) (G : Functor B C) where private module D = Cat.Reasoning D module F = Cat.Functor.Reasoning F module G = Cat.Functor.Reasoning G open Isoⁿ open _=>_
Essentially constant functors are closed under pre and postcomposition by arbitrary functors.
essentially-constant-∘l : is-essentially-constant F → is-essentially-constant (F F∘ G) essentially-constant-∘l = rec! λ d f → pure $ d , iso→isoⁿ (λ b → isoⁿ→iso f (G.₀ b)) (λ g → sym (f .to .is-natural _ _ (G.₁ g))) essentially-constant-∘r : is-essentially-constant G → is-essentially-constant (F F∘ G) essentially-constant-∘r = rec! λ c f → pure $ F.₀ c , iso→isoⁿ (λ b → F-map-iso F (isoⁿ→iso f b)) (λ g → ap₂ D._∘_ (sym (F.F-id)) refl ∙ F.weave (sym (f .to .is-natural _ _ g)))