2014-12-12 04:14:53 +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, Jakob von Raumer
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
import .functor
|
|
|
|
open eq precategory functor is_trunc equiv sigma.ops sigma is_equiv function pi
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
inductive nat_trans {C D : Precategory} (F G : C ⇒ D) : Type :=
|
2014-12-12 04:14:53 +00:00
|
|
|
mk : Π (η : Π (a : C), hom (F a) (G a))
|
2014-12-12 19:19:06 +00:00
|
|
|
(nat : Π {a b : C} (f : hom a b), G f ∘ η a = η b ∘ F f),
|
2015-02-21 00:30:32 +00:00
|
|
|
nat_trans F G
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
infixl `⟹`:25 := nat_trans -- \==>
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
namespace nat_trans
|
2014-12-12 04:14:53 +00:00
|
|
|
variables {C D : Precategory} {F G H I : functor C D}
|
|
|
|
|
2015-01-01 00:30:17 +00:00
|
|
|
definition natural_map [coercion] (η : F ⟹ G) : Π (a : C), F a ⟶ G a :=
|
2015-02-21 00:30:32 +00:00
|
|
|
nat_trans.rec (λ x y, x) η
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2014-12-12 19:19:06 +00:00
|
|
|
theorem naturality (η : F ⟹ G) : Π⦃a b : C⦄ (f : a ⟶ b), G f ∘ η a = η b ∘ F f :=
|
2015-02-21 00:30:32 +00:00
|
|
|
nat_trans.rec (λ x y, y) η
|
2014-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
protected definition compose (η : 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,
|
|
|
|
calc
|
2015-02-07 01:27:56 +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-12-12 04:14:53 +00:00
|
|
|
|
|
|
|
infixr `∘n`:60 := compose
|
|
|
|
|
2015-01-01 00:30:17 +00:00
|
|
|
protected theorem congr
|
|
|
|
{C : Precategory} {D : Precategory}
|
|
|
|
(F G : C ⇒ D)
|
|
|
|
(η₁ η₂ : Π (a : C), hom (F a) (G a))
|
|
|
|
(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)
|
|
|
|
(p₁ : η₁ = η₂) (p₂ : p₁ ▹ nat₁ = nat₂)
|
2015-02-21 00:30:32 +00:00
|
|
|
: @nat_trans.mk C D F G η₁ nat₁ = @nat_trans.mk C D F G η₂ nat₂
|
2015-01-01 00:30:17 +00:00
|
|
|
:=
|
|
|
|
begin
|
2015-02-21 00:30:32 +00:00
|
|
|
apply (apD011 (@nat_trans.mk C D F G) p₁ p₂),
|
2015-01-01 00:30:17 +00:00
|
|
|
end
|
|
|
|
|
2015-02-07 01:27:56 +00:00
|
|
|
set_option apply.class_instance false -- disable class instance resolution in the apply tactic
|
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-01-01 00:30:17 +00:00
|
|
|
begin
|
2015-02-21 00:30:32 +00:00
|
|
|
apply (nat_trans.rec_on η₃), intros (η₃1, η₃2),
|
|
|
|
apply (nat_trans.rec_on η₂), intros (η₂1, η₂2),
|
|
|
|
apply (nat_trans.rec_on η₁), intros (η₁1, η₁2),
|
|
|
|
fapply nat_trans.congr,
|
|
|
|
apply funext.eq_of_homotopy, intro a,
|
2015-01-01 00:30:17 +00:00
|
|
|
apply assoc,
|
2015-02-21 00:30:32 +00:00
|
|
|
apply funext.eq_of_homotopy, intro a,
|
|
|
|
apply funext.eq_of_homotopy, intro b,
|
|
|
|
apply funext.eq_of_homotopy, intro f,
|
2015-01-01 00:30:17 +00:00
|
|
|
apply (@is_hset.elim), apply !homH,
|
|
|
|
end
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
protected definition id {C D : Precategory} {F : functor C D} : nat_trans F F :=
|
2014-12-12 04:14:53 +00:00
|
|
|
mk (λa, id) (λa b f, !id_right ⬝ (!id_left⁻¹))
|
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
protected definition ID {C D : Precategory} (F : functor C D) : nat_trans F F :=
|
2015-01-01 00:30:17 +00:00
|
|
|
id
|
|
|
|
|
|
|
|
protected definition id_left (η : F ⟹ G) : id ∘n η = η :=
|
|
|
|
begin
|
2015-02-21 00:30:32 +00:00
|
|
|
apply (nat_trans.rec_on η), intros (η₁, nat₁),
|
|
|
|
fapply (nat_trans.congr F G),
|
|
|
|
apply funext.eq_of_homotopy, intro a,
|
2015-01-01 00:30:17 +00:00
|
|
|
apply id_left,
|
2015-02-21 00:30:32 +00:00
|
|
|
apply funext.eq_of_homotopy, intro a,
|
|
|
|
apply funext.eq_of_homotopy, intro b,
|
|
|
|
apply funext.eq_of_homotopy, intro f,
|
2015-01-01 00:30:17 +00:00
|
|
|
apply (@is_hset.elim), apply !homH,
|
|
|
|
end
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-01-01 00:30:17 +00:00
|
|
|
protected definition id_right (η : F ⟹ G) : η ∘n id = η :=
|
|
|
|
begin
|
2015-02-21 00:30:32 +00:00
|
|
|
apply (nat_trans.rec_on η), intros (η₁, nat₁),
|
|
|
|
fapply (nat_trans.congr F G),
|
|
|
|
apply funext.eq_of_homotopy, intro a,
|
2015-01-01 00:30:17 +00:00
|
|
|
apply id_right,
|
2015-02-21 00:30:32 +00:00
|
|
|
apply funext.eq_of_homotopy, intro a,
|
|
|
|
apply funext.eq_of_homotopy, intro b,
|
|
|
|
apply funext.eq_of_homotopy, intro f,
|
2015-01-01 00:30:17 +00:00
|
|
|
apply (@is_hset.elim), apply !homH,
|
|
|
|
end
|
|
|
|
|
2015-01-01 04:07:29 +00:00
|
|
|
--set_option pp.implicit true
|
|
|
|
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-02-21 00:30:32 +00:00
|
|
|
intro S, apply nat_trans.mk, exact (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),
|
|
|
|
intros (a, b, f), exact (naturality H f),
|
2015-02-21 00:30:32 +00:00
|
|
|
intro H, apply (nat_trans.rec_on H),
|
2015-01-01 04:07:29 +00:00
|
|
|
intros (eta, nat), unfold function.id,
|
2015-02-21 00:30:32 +00:00
|
|
|
fapply nat_trans.congr,
|
2015-01-01 04:07:29 +00:00
|
|
|
apply idp,
|
2015-02-21 00:30:32 +00:00
|
|
|
repeat ( apply funext.eq_of_homotopy ; intro a ),
|
2015-01-01 04:07:29 +00:00
|
|
|
apply (@is_hset.elim), apply !homH,
|
|
|
|
intro S,
|
2015-02-21 00:30:32 +00:00
|
|
|
fapply sigma_eq,
|
|
|
|
apply funext.eq_of_homotopy, intro a,
|
2015-01-01 04:07:29 +00:00
|
|
|
apply idp,
|
2015-02-21 00:30:32 +00:00
|
|
|
repeat ( apply funext.eq_of_homotopy ; intro a ),
|
2015-01-01 04:07:29 +00:00
|
|
|
apply (@is_hset.elim), apply !homH,
|
|
|
|
end
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-01-01 00:30:17 +00:00
|
|
|
protected definition to_hset : is_hset (F ⟹ G) :=
|
|
|
|
begin
|
2015-02-21 00:30:32 +00:00
|
|
|
apply is_trunc_is_equiv_closed, apply (equiv.to_is_equiv !sigma_char),
|
|
|
|
apply is_trunc_sigma,
|
|
|
|
apply is_trunc_pi, intro a, exact (@homH (objects D) _ (F a) (G a)),
|
|
|
|
intro η, apply is_trunc_pi, intro a,
|
|
|
|
apply is_trunc_pi, intro b, apply is_trunc_pi, intro f,
|
|
|
|
apply is_trunc_eq, apply is_trunc_succ, exact (@homH (objects D) _ (F a) (G b)),
|
2015-01-01 00:30:17 +00:00
|
|
|
end
|
2014-12-12 04:14:53 +00:00
|
|
|
|
2015-02-21 00:30:32 +00:00
|
|
|
end nat_trans
|