-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(category_theory): basic definitions #152
Changes from 6 commits
933f4a0
46e694c
88dd1f0
4341b14
26dde34
062d55f
456594a
eb4dc51
efe51ee
fff0238
ce7194d
c46e78b
0205498
e2d0ca4
a949270
10d77a8
7d3cadd
176a12f
3eb8c2a
0e3229d
3a49fea
14117a0
c030b8d
2b4621d
433aae7
52ed9b7
ac4b311
c3984f0
b68bc6e
8f59e1a
d23e348
e29fda0
b832f05
cb93d51
eaac4c0
1ce8b0a
14ba452
18db512
3aa69cb
569241e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,8 @@ structure functor (C : Type u₁) [category.{u₁ v₁} C] (D : Type u₂) [cate | |
(map_id : ∀ (X : C), map (𝟙 X) = 𝟙 (obj X) . obviously) | ||
(map_comp : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z), map (f ≫ g) = (map f) ≫ (map g) . obviously) | ||
|
||
make_lemma functor.map_id | ||
make_lemma functor.map_comp | ||
restate_axiom functor.map_id | ||
restate_axiom functor.map_comp | ||
attribute [simp,ematch] functor.map_id_lemma functor.map_comp_lemma | ||
|
||
infixr ` ↝ `:70 := functor -- type as \lea -- | ||
|
@@ -60,8 +60,8 @@ instance has_one : has_one (C ↝ C) := | |
|
||
variable {C} | ||
|
||
@[simp] lemma identity.on_objects (X : C) : (identity C) X = X := rfl | ||
@[simp] lemma identity.on_morphisms {X Y : C} (f : X ⟶ Y) : (identity C).map f = f := rfl | ||
@[simp] lemma identity_to_has_one : (identity C) = 1 := rfl | ||
|
||
@[simp] lemma has_one.on_objects (X : C) : (1 : C ↝ C) X = X := rfl | ||
@[simp] lemma has_one.on_morphisms {X Y : C} (f : X ⟶ Y) : (1 : C ↝ C).map f = f := rfl | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need both of these? I would prefer to have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
What is the relation between this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I missed this comment. I agree it would be nice to be clearer here. Suggestions for renamings very welcome! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about Edit: oh wait, |
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,39 +21,40 @@ universes u₁ v₁ u₂ v₂ u₃ v₃ | |
variables {C : Type u₁} [𝒞 : category.{u₁ v₁} C] {D : Type u₂} [𝒟 : category.{u₂ v₂} D] | ||
include 𝒞 𝒟 | ||
|
||
structure natural_transformation (F G : C ↝ D) : Type (max u₁ v₂) := | ||
(components : Π X : C, (F X) ⟶ (G X)) | ||
(naturality : ∀ {X Y : C} (f : X ⟶ Y), (F.map f) ≫ (components Y) = (components X) ≫ (G.map f) . obviously) | ||
structure nat_trans (F G : C ↝ D) : Type (max u₁ v₂) := | ||
(app : Π X : C, (F X) ⟶ (G X)) | ||
(naturality : ∀ {X Y : C} (f : X ⟶ Y), (F.map f) ≫ (app Y) = (app X) ≫ (G.map f) . obviously) | ||
|
||
make_lemma natural_transformation.naturality | ||
attribute [ematch] natural_transformation.naturality_lemma | ||
restate_axiom nat_trans.naturality | ||
attribute [ematch] nat_trans.naturality_lemma | ||
|
||
infixr ` ⟹ `:50 := natural_transformation -- type as \==> or ⟹ | ||
infixr ` ⟹ `:50 := nat_trans -- type as \==> or ⟹ | ||
|
||
namespace natural_transformation | ||
namespace nat_trans | ||
|
||
instance {F G : C ↝ D} : has_coe_to_fun (F ⟹ G) := | ||
{ F := λ α, Π X : C, (F X) ⟶ (G X), | ||
coe := λ α, α.components } | ||
coe := λ α, α.app } | ||
|
||
@[simp] lemma coe_def {F G : C ↝ D} (α : F ⟹ G) (X : C) : α X = α.components X := rfl | ||
@[simp] lemma coe_def {F G : C ↝ D} (α : F ⟹ G) (X : C) : α X = α.app X := rfl | ||
|
||
end natural_transformation | ||
end nat_trans | ||
|
||
namespace functor | ||
definition identity (F : C ↝ D) : F ⟹ F := | ||
{ components := λ X, 𝟙 (F X), | ||
{ app := λ X, 𝟙 (F X), | ||
naturality := begin /- `obviously'` says: -/ intros, dsimp, simp end } | ||
|
||
instance has_one (F : C ↝ D) : has_one (F ⟹ F) := | ||
{ one := identity F } | ||
|
||
@[simp] lemma identity.components (F : C ↝ D) (X : C) : (identity F) X = 𝟙 (F X) := rfl | ||
@[simp] lemma has_one.components (F : C ↝ D) (X : C) : (1 : F ⟹ F) X = 𝟙 (F X) := rfl | ||
@[simp] lemma identity_to_has_one (F : C ↝ D) : identity F = 1 := rfl | ||
|
||
@[simp] lemma has_one.app (F : C ↝ D) (X : C) : (1 : F ⟹ F) X = 𝟙 (F X) := rfl | ||
|
||
end functor | ||
|
||
namespace natural_transformation | ||
namespace nat_trans | ||
|
||
open category | ||
open category_theory.functor | ||
|
@@ -62,7 +63,7 @@ section | |
variables {F G H : C ↝ D} | ||
|
||
-- We'll want to be able to prove that two natural transformations are equal if they are componentwise equal. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like this is an intermezzo between vertical and horizontal composition of natural transformations. Is that on purpose? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it wasn't on purpose; I've rearranged now. |
||
@[extensionality] lemma componentwise_equal (α β : F ⟹ G) (w : ∀ X : C, α X = β X) : α = β := | ||
@[extensionality] lemma ext (α β : F ⟹ G) (w : ∀ X : C, α X = β X) : α = β := | ||
begin | ||
induction α with α_components α_naturality, | ||
induction β with β_components β_naturality, | ||
|
@@ -71,7 +72,7 @@ begin | |
end | ||
|
||
definition vcomp (α : F ⟹ G) (β : G ⟹ H) : F ⟹ H := | ||
{ components := λ X, (α X) ≫ (β X), | ||
{ app := λ X, (α X) ≫ (β X), | ||
naturality := begin /- `obviously'` says: -/ intros, simp, rw [←assoc_lemma, naturality_lemma, assoc_lemma, ←naturality_lemma], end } | ||
|
||
notation α `⊟` β:80 := vcomp α β | ||
|
@@ -84,7 +85,7 @@ variable [ℰ : category.{u₃ v₃} E] | |
include ℰ | ||
|
||
definition hcomp {F G : C ↝ D} {H I : D ↝ E} (α : F ⟹ G) (β : H ⟹ I) : (F ⋙ H) ⟹ (G ⋙ I) := | ||
{ components := λ X : C, (β (F X)) ≫ (I.map (α X)), | ||
{ app := λ X : C, (β (F X)) ≫ (I.map (α X)), | ||
naturality := begin | ||
/- `obviously'` says: -/ | ||
intros, | ||
|
@@ -102,13 +103,13 @@ notation α `◫` β:80 := hcomp α β | |
@[ematch] lemma exchange {F G H : C ↝ D} {I J K : D ↝ E} (α : F ⟹ G) (β : G ⟹ H) (γ : I ⟹ J) (δ : J ⟹ K) : ((α ⊟ β) ◫ (γ ⊟ δ)) = ((α ◫ γ) ⊟ (β ◫ δ)) := | ||
begin | ||
-- `obviously'` says: | ||
apply componentwise_equal, | ||
ext, | ||
intros, | ||
dsimp, | ||
simp, | ||
-- again, this isn't actually what obviously says, but it achieves the same effect. | ||
conv { to_lhs, congr, skip, rw [←assoc_lemma, ←naturality_lemma, assoc_lemma] } | ||
end | ||
|
||
end natural_transformation | ||
end nat_trans | ||
end category_theory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missed a spot (
make_lemma
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.