2015-02-26 18:19:54 +00:00
|
|
|
/-
|
2015-03-17 00:08:45 +00:00
|
|
|
Copyright (c) 2015 Floris van Doorn. All rights reserved.
|
2015-02-26 18:19:54 +00:00
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Author: Floris van Doorn, Jakob von Raumer
|
|
|
|
-/
|
2015-02-28 06:16:20 +00:00
|
|
|
import .functor .iso
|
2015-03-13 22:27:29 +00:00
|
|
|
open eq category functor is_trunc equiv sigma.ops sigma is_equiv function pi funext iso
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-09-02 23:41:19 +00:00
|
|
|
structure nat_trans {C : Precategory} {D : Precategory} (F G : C ⇒ D)
|
|
|
|
: Type :=
|
2015-02-26 18:19:54 +00:00
|
|
|
(natural_map : Π (a : C), hom (F a) (G a))
|
|
|
|
(naturality : Π {a b : C} (f : hom a b), G f ∘ natural_map a = natural_map b ∘ F f)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
namespace nat_trans
|
2015-02-24 00:54:16 +00:00
|
|
|
|
2015-10-01 19:52:28 +00:00
|
|
|
infixl ` ⟹ `:25 := nat_trans -- \==>
|
2015-08-31 16:23:34 +00:00
|
|
|
variables {B C D E : Precategory} {F G H I : C ⇒ D} {F' G' : D ⇒ E} {F'' G'' : E ⇒ B} {J : C ⇒ C}
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-26 18:19:54 +00:00
|
|
|
attribute natural_map [coercion]
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-08-31 16:23:34 +00:00
|
|
|
protected definition compose [constructor] (η : G ⟹ H) (θ : F ⟹ G) : F ⟹ H :=
|
2015-02-21 00:30:32 +00:00
|
|
|
nat_trans.mk
|
2014-12-12 04:14:53 +00:00
|
|
|
(λ a, η a ∘ θ a)
|
|
|
|
(λ a b f,
|
2015-06-13 00:53:01 +00:00
|
|
|
abstract calc
|
2015-03-13 03:18:49 +00:00
|
|
|
H f ∘ (η a ∘ θ a) = (H f ∘ η a) ∘ θ a : by rewrite assoc
|
|
|
|
... = (η b ∘ G f) ∘ θ a : by rewrite naturality
|
|
|
|
... = η b ∘ (G f ∘ θ a) : by rewrite assoc
|
|
|
|
... = η b ∘ (θ b ∘ F f) : by rewrite naturality
|
2015-06-13 00:53:01 +00:00
|
|
|
... = (η b ∘ θ b) ∘ F f : by rewrite assoc
|
|
|
|
end)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-10-01 19:52:28 +00:00
|
|
|
infixr ` ∘n `:60 := nat_trans.compose
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-09-03 04:46:11 +00:00
|
|
|
protected definition id [reducible] [constructor] {F : C ⇒ D} : nat_trans F F :=
|
2015-02-27 05:45:21 +00:00
|
|
|
mk (λa, id) (λa b f, !id_right ⬝ !id_left⁻¹)
|
|
|
|
|
2015-09-03 04:46:11 +00:00
|
|
|
protected definition ID [reducible] [constructor] (F : C ⇒ D) : nat_trans F F :=
|
2015-05-19 05:35:18 +00:00
|
|
|
(@nat_trans.id C D F)
|
2015-02-27 05:45:21 +00:00
|
|
|
|
2015-08-31 16:23:34 +00:00
|
|
|
notation 1 := nat_trans.id
|
|
|
|
|
2015-04-27 21:29:56 +00:00
|
|
|
definition nat_trans_mk_eq {η₁ η₂ : Π (a : C), hom (F a) (G a)}
|
2015-01-01 00:30:17 +00:00
|
|
|
(nat₁ : Π (a b : C) (f : hom a b), G f ∘ η₁ a = η₁ b ∘ F f)
|
|
|
|
(nat₂ : Π (a b : C) (f : hom a b), G f ∘ η₂ a = η₂ b ∘ F f)
|
2015-06-17 19:58:58 +00:00
|
|
|
(p : η₁ ~ η₂)
|
2015-02-24 00:54:16 +00:00
|
|
|
: nat_trans.mk η₁ nat₁ = nat_trans.mk η₂ nat₂ :=
|
2015-04-24 21:00:32 +00:00
|
|
|
apd011 nat_trans.mk (eq_of_homotopy p) !is_hprop.elim
|
2015-01-01 00:30:17 +00:00
|
|
|
|
2015-06-17 19:58:58 +00:00
|
|
|
definition nat_trans_eq {η₁ η₂ : F ⟹ G} : natural_map η₁ ~ natural_map η₂ → η₁ = η₂ :=
|
2015-08-31 16:23:34 +00:00
|
|
|
by induction η₁; induction η₂; apply nat_trans_mk_eq
|
2015-01-01 04:07:29 +00:00
|
|
|
|
2015-01-01 00:30:17 +00:00
|
|
|
protected definition assoc (η₃ : H ⟹ I) (η₂ : G ⟹ H) (η₁ : F ⟹ G) :
|
2014-12-12 19:19:06 +00:00
|
|
|
η₃ ∘n (η₂ ∘n η₁) = (η₃ ∘n η₂) ∘n η₁ :=
|
2015-04-27 21:29:56 +00:00
|
|
|
nat_trans_eq (λa, !assoc)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-08-31 16:23:34 +00:00
|
|
|
protected definition id_left (η : F ⟹ G) : 1 ∘n η = η :=
|
2015-04-27 21:29:56 +00:00
|
|
|
nat_trans_eq (λa, !id_left)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-08-31 16:23:34 +00:00
|
|
|
protected definition id_right (η : F ⟹ G) : η ∘n 1 = η :=
|
2015-04-27 21:29:56 +00:00
|
|
|
nat_trans_eq (λa, !id_right)
|
2015-01-01 00:30:17 +00:00
|
|
|
|
2015-01-01 04:07:29 +00:00
|
|
|
protected definition sigma_char (F G : C ⇒ D) :
|
|
|
|
(Σ (η : Π (a : C), hom (F a) (G a)), Π (a b : C) (f : hom a b), G f ∘ η a = η b ∘ F f) ≃ (F ⟹ G) :=
|
|
|
|
begin
|
2015-01-01 00:30:17 +00:00
|
|
|
fapply equiv.mk,
|
2015-04-06 20:23:38 +00:00
|
|
|
-- TODO(Leo): investigate why we need to use rexact in the following line
|
|
|
|
{intro S, apply nat_trans.mk, rexact (S.2)},
|
2015-01-01 00:30:17 +00:00
|
|
|
fapply adjointify,
|
2015-01-01 04:07:29 +00:00
|
|
|
intro H,
|
|
|
|
fapply sigma.mk,
|
|
|
|
intro a, exact (H a),
|
2015-04-30 18:00:39 +00:00
|
|
|
intro a b f, exact (naturality H f),
|
2015-04-27 21:29:56 +00:00
|
|
|
intro η, apply nat_trans_eq, intro a, apply idp,
|
2015-01-01 04:07:29 +00:00
|
|
|
intro S,
|
2015-02-21 00:30:32 +00:00
|
|
|
fapply sigma_eq,
|
2015-05-22 08:35:44 +00:00
|
|
|
{ apply eq_of_homotopy, intro a, apply idp},
|
|
|
|
{ apply is_hprop.elimo}
|
2015-01-01 04:07:29 +00:00
|
|
|
end
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-04-25 03:04:24 +00:00
|
|
|
definition is_hset_nat_trans [instance] : is_hset (F ⟹ G) :=
|
2015-05-19 05:35:18 +00:00
|
|
|
by apply is_trunc_is_equiv_closed; apply (equiv.to_is_equiv !nat_trans.sigma_char)
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-08-31 16:23:34 +00:00
|
|
|
definition change_natural_map [constructor] (η : F ⟹ G) (f : Π (a : C), F a ⟶ G a)
|
|
|
|
(p : Πa, η a = f a) : F ⟹ G :=
|
|
|
|
nat_trans.mk f (λa b g, p a ▸ p b ▸ naturality η g)
|
|
|
|
|
|
|
|
definition nat_trans_functor_compose [constructor] (η : G ⟹ H) (F : E ⇒ C)
|
|
|
|
: G ∘f F ⟹ H ∘f F :=
|
2015-03-13 22:27:29 +00:00
|
|
|
nat_trans.mk
|
|
|
|
(λ a, η (F a))
|
|
|
|
(λ a b f, naturality η (F f))
|
|
|
|
|
2015-08-31 16:23:34 +00:00
|
|
|
definition functor_nat_trans_compose [constructor] (F : D ⇒ E) (η : G ⟹ H)
|
|
|
|
: F ∘f G ⟹ F ∘f H :=
|
2015-03-13 22:27:29 +00:00
|
|
|
nat_trans.mk
|
|
|
|
(λ a, F (η a))
|
|
|
|
(λ a b f, calc
|
2015-03-24 02:55:01 +00:00
|
|
|
F (H f) ∘ F (η a) = F (H f ∘ η a) : by rewrite respect_comp
|
|
|
|
... = F (η b ∘ G f) : by rewrite (naturality η f)
|
|
|
|
... = F (η b) ∘ F (G f) : by rewrite respect_comp)
|
2015-03-13 22:27:29 +00:00
|
|
|
|
2015-08-31 16:23:34 +00:00
|
|
|
definition nat_trans_id_functor_compose [constructor] (η : J ⟹ 1) (F : E ⇒ C)
|
|
|
|
: J ∘f F ⟹ F :=
|
|
|
|
nat_trans.mk
|
|
|
|
(λ a, η (F a))
|
|
|
|
(λ a b f, naturality η (F f))
|
|
|
|
|
|
|
|
definition id_nat_trans_functor_compose [constructor] (η : 1 ⟹ J) (F : E ⇒ C)
|
|
|
|
: F ⟹ J ∘f F :=
|
|
|
|
nat_trans.mk
|
|
|
|
(λ a, η (F a))
|
|
|
|
(λ a b f, naturality η (F f))
|
|
|
|
|
|
|
|
definition functor_nat_trans_id_compose [constructor] (F : C ⇒ D) (η : J ⟹ 1)
|
|
|
|
: F ∘f J ⟹ F :=
|
|
|
|
nat_trans.mk
|
|
|
|
(λ a, F (η a))
|
|
|
|
(λ a b f, calc
|
|
|
|
F f ∘ F (η a) = F (f ∘ η a) : by rewrite respect_comp
|
|
|
|
... = F (η b ∘ J f) : by rewrite (naturality η f)
|
|
|
|
... = F (η b) ∘ F (J f) : by rewrite respect_comp)
|
|
|
|
|
|
|
|
definition functor_id_nat_trans_compose [constructor] (F : C ⇒ D) (η : 1 ⟹ J)
|
|
|
|
: F ⟹ F ∘f J :=
|
|
|
|
nat_trans.mk
|
|
|
|
(λ a, F (η a))
|
|
|
|
(λ a b f, calc
|
|
|
|
F (J f) ∘ F (η a) = F (J f ∘ η a) : by rewrite respect_comp
|
|
|
|
... = F (η b ∘ f) : by rewrite (naturality η f)
|
|
|
|
... = F (η b) ∘ F f : by rewrite respect_comp)
|
|
|
|
|
2015-10-01 19:52:28 +00:00
|
|
|
infixr ` ∘nf ` :62 := nat_trans_functor_compose
|
|
|
|
infixr ` ∘fn ` :62 := functor_nat_trans_compose
|
|
|
|
infixr ` ∘n1f `:62 := nat_trans_id_functor_compose
|
|
|
|
infixr ` ∘1nf `:62 := id_nat_trans_functor_compose
|
|
|
|
infixr ` ∘f1n `:62 := functor_id_nat_trans_compose
|
|
|
|
infixr ` ∘fn1 `:62 := functor_nat_trans_id_compose
|
2015-03-13 22:27:29 +00:00
|
|
|
|
2015-04-29 00:48:39 +00:00
|
|
|
definition nf_fn_eq_fn_nf_pt (η : F ⟹ G) (θ : F' ⟹ G') (c : C)
|
|
|
|
: (θ (G c)) ∘ (F' (η c)) = (G' (η c)) ∘ (θ (F c)) :=
|
|
|
|
(naturality θ (η c))⁻¹
|
|
|
|
|
2015-08-31 16:23:34 +00:00
|
|
|
variable (F')
|
|
|
|
definition nf_fn_eq_fn_nf_pt' (η : F ⟹ G) (θ : F'' ⟹ G'') (c : C)
|
|
|
|
: (θ (F' (G c))) ∘ (F'' (F' (η c))) = (G'' (F' (η c))) ∘ (θ (F' (F c))) :=
|
|
|
|
(naturality θ (F' (η c)))⁻¹
|
|
|
|
variable {F'}
|
|
|
|
|
2015-04-29 00:48:39 +00:00
|
|
|
definition nf_fn_eq_fn_nf (η : F ⟹ G) (θ : F' ⟹ G')
|
2015-03-13 22:27:29 +00:00
|
|
|
: (θ ∘nf G) ∘n (F' ∘fn η) = (G' ∘fn η) ∘n (θ ∘nf F) :=
|
2015-06-27 00:09:50 +00:00
|
|
|
nat_trans_eq (λ c, nf_fn_eq_fn_nf_pt η θ c)
|
2015-03-13 22:27:29 +00:00
|
|
|
|
2015-04-19 20:03:52 +00:00
|
|
|
definition fn_n_distrib (F' : D ⇒ E) (η : G ⟹ H) (θ : F ⟹ G)
|
|
|
|
: F' ∘fn (η ∘n θ) = (F' ∘fn η) ∘n (F' ∘fn θ) :=
|
2015-06-27 00:09:50 +00:00
|
|
|
nat_trans_eq (λc, by apply respect_comp)
|
2015-04-19 20:03:52 +00:00
|
|
|
|
|
|
|
definition n_nf_distrib (η : G ⟹ H) (θ : F ⟹ G) (F' : B ⇒ C)
|
|
|
|
: (η ∘n θ) ∘nf F' = (η ∘nf F') ∘n (θ ∘nf F') :=
|
2015-04-27 21:29:56 +00:00
|
|
|
nat_trans_eq (λc, idp)
|
2015-04-19 20:03:52 +00:00
|
|
|
|
2015-08-31 16:23:34 +00:00
|
|
|
definition fn_id (F' : D ⇒ E) : F' ∘fn nat_trans.ID F = 1 :=
|
2015-06-27 00:09:50 +00:00
|
|
|
nat_trans_eq (λc, by apply respect_id)
|
2015-04-19 20:03:52 +00:00
|
|
|
|
2015-08-31 16:23:34 +00:00
|
|
|
definition id_nf (F' : B ⇒ C) : nat_trans.ID F ∘nf F' = 1 :=
|
2015-04-27 21:29:56 +00:00
|
|
|
nat_trans_eq (λc, idp)
|
2015-04-19 20:03:52 +00:00
|
|
|
|
2015-08-31 16:23:34 +00:00
|
|
|
definition id_fn (η : G ⟹ H) (c : C) : (1 ∘fn η) c = η c :=
|
2015-04-19 20:03:52 +00:00
|
|
|
idp
|
|
|
|
|
2015-08-31 16:23:34 +00:00
|
|
|
definition nf_id (η : G ⟹ H) (c : C) : (η ∘nf 1) c = η c :=
|
2015-04-19 20:03:52 +00:00
|
|
|
idp
|
|
|
|
|
2015-03-13 22:27:29 +00:00
|
|
|
definition nat_trans_of_eq [reducible] (p : F = G) : F ⟹ G :=
|
|
|
|
nat_trans.mk (λc, hom_of_eq (ap010 to_fun_ob p c))
|
|
|
|
(λa b f, eq.rec_on p (!id_right ⬝ !id_left⁻¹))
|
2015-08-31 16:23:34 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
end nat_trans
|