2014-12-22 20:33:29 +00:00
|
|
|
/-
|
|
|
|
Copyright (c) 2014 Floris van Doorn. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Author: Floris van Doorn
|
|
|
|
-/
|
2014-11-04 00:22:30 +00:00
|
|
|
|
|
|
|
import .functor
|
|
|
|
open category eq eq.ops functor
|
|
|
|
|
|
|
|
inductive natural_transformation {C D : Category} (F G : C ⇒ D) : Type :=
|
|
|
|
mk : Π (η : Π(a : C), hom (F a) (G a)), (Π{a b : C} (f : hom a b), G f ∘ η a = η b ∘ F f)
|
|
|
|
→ natural_transformation F G
|
|
|
|
|
|
|
|
infixl `⟹`:25 := natural_transformation -- \==>
|
|
|
|
|
|
|
|
namespace natural_transformation
|
|
|
|
variables {C D : Category} {F G H I : functor C D}
|
|
|
|
|
|
|
|
definition natural_map [coercion] (η : F ⟹ G) : Π(a : C), F a ⟶ G a :=
|
2015-02-11 20:49:27 +00:00
|
|
|
natural_transformation.rec (λ x y, x) η
|
2014-11-04 00:22:30 +00:00
|
|
|
|
|
|
|
theorem naturality (η : F ⟹ G) : Π⦃a b : C⦄ (f : a ⟶ b), G f ∘ η a = η b ∘ F f :=
|
2015-02-11 20:49:27 +00:00
|
|
|
natural_transformation.rec (λ x y, y) η
|
2014-11-04 00:22:30 +00:00
|
|
|
|
|
|
|
protected definition compose (η : G ⟹ H) (θ : F ⟹ G) : F ⟹ H :=
|
|
|
|
natural_transformation.mk
|
|
|
|
(λ a, η a ∘ θ a)
|
|
|
|
(λ a b f,
|
|
|
|
calc
|
2015-02-11 20:49:27 +00:00
|
|
|
H f ∘ (η a ∘ θ a) = (H f ∘ η a) ∘ θ a : assoc
|
|
|
|
... = (η b ∘ G f) ∘ θ a : naturality η f
|
|
|
|
... = η b ∘ (G f ∘ θ a) : assoc
|
|
|
|
... = η b ∘ (θ b ∘ F f) : naturality θ f
|
|
|
|
... = (η b ∘ θ b) ∘ F f : assoc)
|
2014-11-04 00:22:30 +00:00
|
|
|
--congr_arg (λx, η b ∘ x) (naturality θ f) -- this needed to be explicit for some reason (on Oct 24)
|
|
|
|
|
2015-05-19 05:35:18 +00:00
|
|
|
infixr `∘n`:60 := natural_transformation.compose
|
2014-11-04 00:22:30 +00:00
|
|
|
protected theorem assoc (η₃ : H ⟹ I) (η₂ : G ⟹ H) (η₁ : F ⟹ G) :
|
|
|
|
η₃ ∘n (η₂ ∘n η₁) = (η₃ ∘n η₂) ∘n η₁ :=
|
|
|
|
dcongr_arg2 mk (funext (take x, !assoc)) !proof_irrel
|
|
|
|
|
|
|
|
protected definition id {C D : Category} {F : functor C D} : natural_transformation F F :=
|
|
|
|
mk (λa, id) (λa b f, !id_right ⬝ symm !id_left)
|
2015-05-18 22:45:23 +00:00
|
|
|
protected definition ID {C D : Category} (F : functor C D) : natural_transformation F F := natural_transformation.id
|
2014-11-04 00:22:30 +00:00
|
|
|
|
2015-05-18 22:45:23 +00:00
|
|
|
protected theorem id_left (η : F ⟹ G) : natural_transformation.compose natural_transformation.id η = η :=
|
2015-02-11 20:49:27 +00:00
|
|
|
natural_transformation.rec (λf H, dcongr_arg2 mk (funext (take x, !id_left)) !proof_irrel) η
|
2014-11-04 00:22:30 +00:00
|
|
|
|
2015-05-18 22:45:23 +00:00
|
|
|
protected theorem id_right (η : F ⟹ G) : natural_transformation.compose η natural_transformation.id = η :=
|
2015-02-11 20:49:27 +00:00
|
|
|
natural_transformation.rec (λf H, dcongr_arg2 mk (funext (take x, !id_right)) !proof_irrel) η
|
2014-11-04 00:22:30 +00:00
|
|
|
end natural_transformation
|