Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(category_theory/limit): limits and colimits
- Loading branch information
Scott Morrison
committed
Nov 13, 2018
1 parent
291015d
commit a95add1
Showing
35 changed files
with
3,757 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
-- Copyright (c) 2018 Scott Morrison. All rights reserved. | ||
-- Released under Apache 2.0 license as described in the file LICENSE. | ||
-- Authors: Scott Morrison | ||
|
||
import category_theory.types | ||
import category_theory.isomorphism | ||
import category_theory.whiskering | ||
|
||
namespace category_theory | ||
|
||
universes u₁ v₁ u₂ v₂ u₃ v₃ | ||
variables {A : Type u₁} [𝒜 : category.{u₁ v₁} A] | ||
variables {B : Type u₂} [ℬ : category.{u₂ v₂} B] | ||
variables {T : Type u₃} [𝒯 : category.{u₃ v₃} T] | ||
include 𝒜 ℬ 𝒯 | ||
|
||
structure comma (L : A ⥤ T) (R : B ⥤ T) := | ||
(left : A . obviously) | ||
(right : B . obviously) | ||
(hom : L.obj left ⟶ R.obj right) | ||
|
||
variables {L : A ⥤ T} {R : B ⥤ T} | ||
|
||
structure comma_morphism (X Y : comma L R) := | ||
(left : X.left ⟶ Y.left . obviously) | ||
(right : X.right ⟶ Y.right . obviously) | ||
(w' : L.map left ≫ Y.hom = X.hom ≫ R.map right . obviously) | ||
|
||
restate_axiom comma_morphism.w' | ||
|
||
namespace comma_morphism | ||
@[extensionality] lemma ext | ||
{X Y : comma L R} {f g : comma_morphism X Y} | ||
(l : f.left = g.left) (r : f.right = g.right) : f = g := | ||
begin | ||
cases f, cases g, | ||
congr; assumption | ||
end | ||
end comma_morphism | ||
|
||
instance comma_category : category (comma L R) := | ||
{ hom := comma_morphism, | ||
id := λ X, | ||
{ left := 𝟙 X.left, | ||
right := 𝟙 X.right }, | ||
comp := λ X Y Z f g, | ||
{ left := f.left ≫ g.left, | ||
right := f.right ≫ g.right, | ||
w' := | ||
begin | ||
rw [functor.map_comp, | ||
category.assoc, | ||
g.w, | ||
←category.assoc, | ||
f.w, | ||
functor.map_comp, | ||
category.assoc], | ||
end }} | ||
|
||
end category_theory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
-- Copyright (c) 2018 Scott Morrison. All rights reserved. | ||
-- Released under Apache 2.0 license as described in the file LICENSE. | ||
-- Authors: Scott Morrison | ||
|
||
import category_theory.functor_category | ||
import category_theory.yoneda | ||
|
||
universes u u' v | ||
|
||
open category_theory | ||
|
||
namespace category_theory.functor | ||
|
||
variables (J : Type v) [small_category J] | ||
variables {C : Type u} [𝒞 : category.{u v} C] | ||
include 𝒞 | ||
|
||
def const : C ⥤ (J ⥤ C) := | ||
{ obj := λ X, | ||
{ obj := λ j, X, | ||
map := λ j j' f, 𝟙 X }, | ||
map := λ X Y f, { app := λ j, f } } | ||
|
||
namespace const | ||
@[simp] lemma obj_obj (X : C) (j : J) : ((const J).obj X).obj j = X := rfl | ||
@[simp] lemma obj_map (X : C) {j j' : J} (f : j ⟶ j') : ((const J).obj X).map f = 𝟙 X := rfl | ||
@[simp] lemma map_app {X Y : C} (f : X ⟶ Y) (j : J) : ((const J).map f).app j = f := rfl | ||
end const | ||
|
||
variables (J) {C} | ||
|
||
section | ||
variables {D : Type u'} [𝒟 : category.{u' v} D] | ||
include 𝒟 | ||
|
||
@[simp] def const_compose (X : C) (F : C ⥤ D) : | ||
(const J).obj (F.obj X) ≅ (const J).obj X ⋙ F := | ||
{ hom := { app := λ _, 𝟙 _ }, | ||
inv := { app := λ _, 𝟙 _ } } | ||
|
||
@[simp] lemma const_compose_symm_app (X : C) (F : C ⥤ D) (j : J) : | ||
(const_compose J X F).inv.app j = 𝟙 _ := rfl | ||
|
||
end | ||
|
||
variables {J C} | ||
|
||
/-- | ||
`F.cones` is the functor assigning to an object `X` the type of | ||
natural transformations from the constant functor with value `X` to `F`. | ||
`cone F` is equivalent, in the obvious way, to `Σ X, F.cones X`. | ||
-/ | ||
def cones (F : J ⥤ C) : (Cᵒᵖ) ⥤ (Type v) := | ||
(const (Jᵒᵖ)) ⋙ (op_inv J C) ⋙ (yoneda.obj F) | ||
|
||
end category_theory.functor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
-- Copyright (c) 2017 Scott Morrison. All rights reserved. | ||
-- Released under Apache 2.0 license as described in the file LICENSE. | ||
-- Authors: Stephen Morgan, Scott Morrison | ||
|
||
import data.ulift | ||
import category_theory.natural_transformation | ||
import category_theory.isomorphism | ||
import category_theory.functor_category | ||
|
||
namespace category_theory | ||
|
||
universes u₁ v₁ u₂ v₂ | ||
|
||
def discrete (α : Type u₁) := α | ||
|
||
@[extensionality] lemma plift.ext {P : Prop} (a b : plift P) : a = b := | ||
begin | ||
cases a, cases b, refl | ||
end | ||
|
||
instance discrete_category (α : Type u₁) : small_category (discrete α) := | ||
{ hom := λ X Y, ulift (plift (X = Y)), | ||
id := by obviously, | ||
comp := by obviously } | ||
|
||
-- TODO this needs to wait for equivalences to arrive | ||
-- example : equivalence.{u₁ u₁ u₁ u₁} punit (discrete punit) := by obviously | ||
|
||
def discrete.lift {α : Type u₁} {β : Type u₂} (f : α → β) : (discrete α) ⥤ (discrete β) := | ||
{ obj := f, | ||
map := λ X Y g, begin cases g, cases g, cases g, exact 𝟙 (f X) end } | ||
|
||
variables (J : Type v₂) [small_category J] | ||
|
||
variables (C : Type u₂) [𝒞 : category.{u₂ v₂} C] | ||
include 𝒞 | ||
|
||
section forget | ||
|
||
@[simp] def discrete.forget : (J ⥤ C) ⥤ (discrete J ⥤ C) := | ||
{ obj := λ F, | ||
{ obj := F.obj, | ||
map := λ X Y f, F.map (eq_to_hom f.down.down) }, | ||
map := λ F G α, | ||
{ app := α.app } } | ||
|
||
end forget | ||
|
||
@[simp] lemma discrete.functor_map_id | ||
(F : discrete J ⥤ C) (j : discrete J) (f : j ⟶ j) : F.map f = 𝟙 (F.obj j) := | ||
begin | ||
have h : f = 𝟙 j, cases f, cases f, ext, | ||
rw h, | ||
simp, | ||
end | ||
|
||
variables {C} | ||
|
||
namespace functor | ||
|
||
@[simp] def of_function {I : Type u₁} (F : I → C) : (discrete I) ⥤ C := | ||
{ obj := F, | ||
map := λ X Y f, begin cases f, cases f, cases f, exact 𝟙 (F X) end } | ||
|
||
end functor | ||
|
||
namespace nat_trans | ||
|
||
@[simp] def of_function {I : Type u₁} {F G : I → C} (f : Π i : I, F i ⟶ G i) : | ||
(functor.of_function F) ⟹ (functor.of_function G) := | ||
{ app := λ i, f i, | ||
naturality' := λ X Y g, | ||
begin | ||
cases g, cases g, cases g, | ||
dsimp [functor.of_function], | ||
simp, | ||
end } | ||
|
||
end nat_trans | ||
|
||
end category_theory |
Oops, something went wrong.