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.
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.
: D.Ob → Functor C D
Const = !Const X F∘ !F Const X
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 ◂ !F
constⁿ f
const-isoⁿ: {X Y : D.Ob}
→ X D.≅ Y
→ Const X ≅ⁿ Const Y
=
const-isoⁿ f (λ _ → f) (λ f → D.id-comm-sym) iso→isoⁿ
Essentially constant functors🔗
A functor is essentially constant if it is (merely) isomorphic to a constant functor.
: Functor C D → Type _
is-essentially-constant = ∃[ X ∈ D.Ob ] (F ≅ⁿ Const X) is-essentially-constant F
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 λ d f →
rec!
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 λ c f →
rec! .₀ c ,
pure $ F
iso→isoⁿ(λ b → F-map-iso F (isoⁿ→iso f b))
(λ g →
._∘_ (sym (F.F-id)) refl
ap₂ D.weave (sym (f .to .is-natural _ _ g))) ∙ F