Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit fe7cd33

Browse files
committed
refactor(category_theory/products): tweak PR after merge
1 parent 02cf7a6 commit fe7cd33

File tree

7 files changed

+55
-59
lines changed

7 files changed

+55
-59
lines changed

analysis/nnreal.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ noncomputable theory
1111
open lattice filter
1212
variables {α : Type*}
1313

14-
definition nnreal := {r : ℝ // 0 ≤ r}
14+
def nnreal := {r : ℝ // 0 ≤ r}
1515
local notation ` ℝ≥0 ` := nnreal
1616

1717
namespace nnreal

category_theory/functor.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Authors: Tim Baumann, Stephen Morgan, Scott Morrison
55
66
Defines a functor between categories.
77
8-
(As it is a 'bundled' object rather than the `is_functorial` typeclass parametrised
8+
(As it is a 'bundled' object rather than the `is_functorial` typeclass parametrised
99
by the underlying function on objects, the name is capitalised.)
1010
1111
Introduces notations
@@ -16,14 +16,14 @@ Introduces notations
1616
import .category
1717

1818
namespace category_theory
19-
19+
2020
universes u₁ v₁ u₂ v₂ u₃ v₃
2121

2222
/--
23-
`functor C D` represents a functor between categories `C` and `D`.
23+
`functor C D` represents a functor between categories `C` and `D`.
2424
2525
To apply a functor `F` to an object use `F X`, and to a morphism use `F.map f`.
26-
26+
2727
The axiom `map_id_lemma` expresses preservation of identities, and
2828
`map_comp_lemma` expresses functoriality.
2929
-/
@@ -37,7 +37,7 @@ restate_axiom functor.map_id
3737
restate_axiom functor.map_comp
3838
attribute [simp,ematch] functor.map_id_lemma functor.map_comp_lemma
3939

40-
infixr ` ↝ `:70 := functor -- type as \lea --
40+
infixr ` ↝ `:70 := functor -- type as \lea --
4141

4242
namespace functor
4343

@@ -57,7 +57,7 @@ variables (C : Type u₁) [𝒞 : category.{u₁ v₁} C]
5757
include 𝒞
5858

5959
/-- `functor.id C` is the identity functor on a category `C`. -/
60-
protected definition id : C ↝ C :=
60+
protected def id : C ↝ C :=
6161
{ obj := λ X, X,
6262
map := λ _ _ f, f,
6363
map_id := begin /- `obviously'` says: -/ intros, refl end,
@@ -76,7 +76,7 @@ include 𝒞 𝒟 ℰ
7676
/--
7777
`F ⋙ G` is the composition of a functor `F` and a functor `G` (`F` first, then `G`).
7878
-/
79-
definition comp (F : C ↝ D) (G : D ↝ E) : C ↝ E :=
79+
def comp (F : C ↝ D) (G : D ↝ E) : C ↝ E :=
8080
{ obj := λ X, G.obj (F.obj X),
8181
map := λ _ _ f, G.map (F.map f),
8282
map_id := begin /- `obviously'` says: -/ intros, simp end,

category_theory/functor_category.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,41 @@ universes u₁ v₁ u₂ v₂ u₃ v₃
1111
open nat_trans
1212

1313
/--
14-
`functor_category C D` gives the category structure on functor and natural transformations between categories `C` and `D`.
14+
`functor.category C D` gives the category structure on functor and natural transformations between categories `C` and `D`.
1515
1616
Notice that if `C` and `D` are both small categories at the same universe level, this is another small category at that level.
1717
However if `C` and `D` are both large categories at the same universe level, this is a small category at the next higher level.
1818
-/
19-
instance functor_category (C : Type u₁) [category.{u₁ v₁} C] (D : Type u₂) [category.{u₂ v₂} D] : category.{(max u₁ v₁ u₂ v₂) (max u₁ v₂)} (C ↝ D) :=
19+
instance functor.category (C : Type u₁) [category.{u₁ v₁} C] (D : Type u₂) [category.{u₂ v₂} D] : category.{(max u₁ v₁ u₂ v₂) (max u₁ v₂)} (C ↝ D) :=
2020
{ Hom := λ F G, F ⟹ G,
2121
id := λ F, nat_trans.id F,
2222
comp := λ _ _ _ α β, α ⊟ β,
2323
id_comp := begin /- `obviously'` says: -/ intros, ext, intros, dsimp, simp end,
2424
comp_id := begin /- `obviously'` says: -/ intros, ext, intros, dsimp, simp end,
2525
assoc := begin /- `obviously'` says: -/ intros, ext, intros, simp end }
2626

27-
namespace functor_category
27+
namespace functor.category
2828

2929
section
3030
variables {C : Type u₁} [𝒞 : category.{u₁ v₁} C] {D : Type u₂} [𝒟 : category.{u₂ v₂} D]
3131
include 𝒞 𝒟
3232

33-
@[simp,ematch] lemma id_app (F : C ↝ D) (X : C) : (𝟙 F : F ⟹ F) X = 𝟙 (F X) := rfl
34-
@[simp,ematch] lemma comp_app {F G H : C ↝ D} (α : F ⟶ G) (β : G ⟶ H) (X : C) : ((α ≫ β) : F ⟹ H) X = (α : F ⟹ G) X ≫ (β : G ⟹ H) X := rfl
33+
@[simp, ematch] lemma id_app (F : C ↝ D) (X : C) : (𝟙 F : F ⟹ F) X = 𝟙 (F X) := rfl
34+
@[simp, ematch] lemma comp_app {F G H : C ↝ D} (α : F ⟶ G) (β : G ⟶ H) (X : C) : ((α ≫ β) : F ⟹ H) X = (α : F ⟹ G) X ≫ (β : G ⟹ H) X := rfl
3535
end
3636

3737
namespace nat_trans
3838
-- This section gives two lemmas about natural transformations between functors into functor categories, spelling them out in components.
3939

4040
variables {C : Type u₁} [𝒞 : category.{u₁ v₁} C] {D : Type u₂} [𝒟 : category.{u₂ v₂} D] {E : Type u₃} [ℰ : category.{u₃ v₃} E]
41-
include 𝒞 𝒟 ℰ
41+
include 𝒞 𝒟 ℰ
4242

4343
@[ematch] lemma app_naturality {F G : C ↝ (D ↝ E)} (T : F ⟹ G) (X : C) {Y Z : D} (f : Y ⟶ Z) : ((F X).map f) ≫ ((T X) Z) = ((T X) Y) ≫ ((G X).map f) := (T X).naturality f
4444

4545
@[ematch] lemma naturality_app {F G : C ↝ (D ↝ E)} (T : F ⟹ G) (Z : D) {X Y : C} (f : X ⟶ Y) : ((F.map f) Z) ≫ ((T Y) Z) = ((T X) Z) ≫ ((G.map f) Z) := congr_fun (congr_arg app (T.naturality f)) Z
4646

4747
end nat_trans
4848

49-
end functor_category
49+
end functor.category
5050

5151
end category_theory

category_theory/natural_transformation.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ instance {F G : C ↝ D} : has_coe_to_fun (F ⟹ G) :=
4747
@[simp] lemma coe_def {F G : C ↝ D} (α : F ⟹ G) (X : C) : α X = α.app X := rfl
4848

4949
/-- `nat_trans.id F` is the identity natural transformation on a functor `F`. -/
50-
protected definition id (F : C ↝ D) : F ⟹ F :=
50+
protected def id (F : C ↝ D) : F ⟹ F :=
5151
{ app := λ X, 𝟙 (F X),
5252
naturality := begin /- `obviously'` says: -/ intros, dsimp, simp end }
5353

@@ -69,11 +69,11 @@ begin
6969
end
7070

7171
/-- `vcomp α β` is the vertical compositions of natural transformations. -/
72-
definition vcomp (α : F ⟹ G) (β : G ⟹ H) : F ⟹ H :=
72+
def vcomp (α : F ⟹ G) (β : G ⟹ H) : F ⟹ H :=
7373
{ app := λ X, (α X) ≫ (β X),
7474
naturality := begin /- `obviously'` says: -/ intros, simp, rw [←assoc_lemma, naturality_lemma, assoc_lemma, ←naturality_lemma], end }
7575

76-
notation α `⊟` β:80 := vcomp α β
76+
notation α `⊟` β:80 := vcomp α β
7777

7878
@[simp] lemma vcomp_app (α : F ⟹ G) (β : G ⟹ H) (X : C) : (α ⊟ β) X = (α X) ≫ (β X) := rfl
7979
@[ematch] lemma vcomp_assoc (α : F ⟹ G) (β : G ⟹ H) (γ : H ⟹ I) : (α ⊟ β) ⊟ γ = (α ⊟ (β ⊟ γ)) := begin ext, intros, dsimp, rw [assoc] end
@@ -83,9 +83,9 @@ variables {E : Type u₃} [ℰ : category.{u₃ v₃} E]
8383
include
8484

8585
/-- `hcomp α β` is the horizontal composition of natural transformations. -/
86-
definition hcomp {F G : C ↝ D} {H I : D ↝ E} (α : F ⟹ G) (β : H ⟹ I) : (F ⋙ H) ⟹ (G ⋙ I) :=
87-
{ app := λ X : C, (β (F X)) ≫ (I.map (α X)),
88-
naturality := begin
86+
def hcomp {F G : C ↝ D} {H I : D ↝ E} (α : F ⟹ G) (β : H ⟹ I) : (F ⋙ H) ⟹ (G ⋙ I) :=
87+
{ app := λ X : C, (β (F X)) ≫ (I.map (α X)),
88+
naturality := begin
8989
/- `obviously'` says: -/
9090
intros,
9191
dsimp,
@@ -101,7 +101,7 @@ notation α `◫` β:80 := hcomp α β
101101

102102
-- Note that we don't yet prove a `hcomp_assoc` lemma here: even stating it is painful, because we need to use associativity of functor composition
103103

104-
@[ematch] lemma exchange {F G H : C ↝ D} {I J K : D ↝ E} (α : F ⟹ G) (β : G ⟹ H) (γ : I ⟹ J) (δ : J ⟹ K) : ((α ⊟ β) ◫ (γ ⊟ δ)) = ((α ◫ γ) ⊟ (β ◫ δ)) :=
104+
@[ematch] lemma exchange {F G H : C ↝ D} {I J K : D ↝ E} (α : F ⟹ G) (β : G ⟹ H) (γ : I ⟹ J) (δ : J ⟹ K) : ((α ⊟ β) ◫ (γ ⊟ δ)) = ((α ◫ γ) ⊟ (β ◫ δ)) :=
105105
begin
106106
-- `obviously'` says:
107107
ext,

category_theory/products.lean

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,96 +11,92 @@ section
1111
variables (C : Type u₁) [category.{u₁ v₁} C] (D : Type u₂) [category.{u₂ v₂} D]
1212

1313
/--
14-
`product_category C D` gives the cartesian product of two categories.
14+
`prod.category C D` gives the cartesian product of two categories.
1515
-/
16-
instance product_category : category.{(max u₁ u₂) (max v₁ v₂)} (C × D) :=
16+
instance prod.category : category.{(max u₁ u₂) (max v₁ v₂)} (C × D) :=
1717
{ Hom := λ X Y, ((X.1) ⟶ (Y.1)) × ((X.2) ⟶ (Y.2)),
1818
id := λ X, ⟨ 𝟙 (X.1), 𝟙 (X.2) ⟩,
1919
comp := λ _ _ _ f g, (f.1 ≫ g.1, f.2 ≫ g.2),
2020
id_comp := begin /- `obviously'` says: -/ intros, cases X, cases Y, cases f, dsimp at *, simp end,
2121
comp_id := begin /- `obviously'` says: -/ intros, cases X, cases Y, cases f, dsimp at *, simp end,
22-
assoc := begin /- `obviously'` says: -/ intros, cases W, cases X, cases Y, cases Z, cases f, cases g, cases h, dsimp at *, simp end }
23-
end
22+
assoc := begin /- `obviously'` says: -/ intros, cases W, cases X, cases Y, cases Z, cases f, cases g, cases h, dsimp at *, simp end }
23+
end
2424

25-
namespace product_category
25+
namespace prod.category
2626

27-
section -- rfl lemmas for product_category
27+
section -- rfl lemmas for prod.category
2828
variables {C : Type u₁} [𝒞 : category.{u₁ v₁} C] {D : Type u₂} [𝒟 : category.{u₂ v₂} D]
2929
include 𝒞 𝒟
3030

31-
@[simp,ematch] lemma id (X : C) (Y : D) : 𝟙 (X, Y) = (𝟙 X, 𝟙 Y) := rfl
32-
@[simp,ematch] lemma comp {P Q R : C} {S T U : D} (f : (P, S) ⟶ (Q, T)) (g : (Q, T) ⟶ (R, U)) : f ≫ g = (f.1 ≫ g.1, f.2 ≫ g.2) := rfl
31+
@[simp, ematch] lemma id (X : C) (Y : D) : 𝟙 (X, Y) = (𝟙 X, 𝟙 Y) := rfl
32+
@[simp, ematch] lemma comp {P Q R : C} {S T U : D} (f : (P, S) ⟶ (Q, T)) (g : (Q, T) ⟶ (R, U)) : f ≫ g = (f.1 ≫ g.1, f.2 ≫ g.2) := rfl
3333
end
3434

35-
section
35+
section
3636
variables (C : Type u₁) [𝒞 : category.{u₁ v₁} C] (D : Type u₁) [𝒟 : category.{u₁ v₁} D]
3737
include 𝒞 𝒟
3838

39-
/--
40-
`product_category.uniform C D` is an additional instance specialised so both factors have the same universe levels. This helps typeclass resolution.
39+
/--
40+
`prod.category.uniform C D` is an additional instance specialised so both factors have the same universe levels. This helps typeclass resolution.
4141
-/
42-
instance uniform : category.{u₁ v₁} (C × D) := category_theory.product_category C D
42+
instance uniform : category (C × D) := prod.category C D
4343
end
4444

4545
-- Next we define the natural functors into and out of product categories. For now this doesn't address the universal properties.
4646

47-
/-- `right_injection_at C Z` is the functor `X ↦ (X, Z)`. -/
48-
definition right_injection_at (C : Type u₁) [category.{u₁ v₁} C] {D : Type u₁} [category.{u₁ v₁} D] (Z : D) : C ↝ (C × D) :=
47+
/-- `inl C Z` is the functor `X ↦ (X, Z)`. -/
48+
def inl (C : Type u₁) [category.{u₁ v₁} C] {D : Type u₁} [category.{u₁ v₁} D] (Z : D) : C ↝ (C × D) :=
4949
{ obj := λ X, (X, Z),
5050
map := λ X Y f, (f, 𝟙 Z),
5151
map_id := begin /- `obviously'` says: -/ intros, refl end,
5252
map_comp := begin /- `obviously'` says: -/ intros, dsimp, simp end }
5353

54-
/-- `left_injection_at Z D` is the functor `X ↦ (Z, X)`. -/
55-
definition left_injection_at {C : Type u₁} [category.{u₁ v₁} C] (Z : C) (D : Type u₁) [category.{u₁ v₁} D] : D ↝ (C × D) :=
54+
/-- `inr D Z` is the functor `X ↦ (Z, X)`. -/
55+
def inr {C : Type u₁} [category.{u₁ v₁} C] (D : Type u₁) [category.{u₁ v₁} D] (Z : C) : D ↝ (C × D) :=
5656
{ obj := λ X, (Z, X),
5757
map := λ X Y f, (𝟙 Z, f),
5858
map_id := begin /- `obviously'` says: -/ intros, refl end,
5959
map_comp := begin /- `obviously'` says: -/ intros, dsimp, simp end }
6060

61-
/-- `left_projection` is the functor `(X, Y) ↦ X`. -/
62-
definition left_projection (C : Type u₁) [category.{u₁ v₁} C] (Z : C) (D : Type u₁) [category.{u₁ v₁} D] : (C × D) ↝ C :=
61+
/-- `fst` is the functor `(X, Y) ↦ X`. -/
62+
def fst (C : Type u₁) [category.{u₁ v₁} C] (Z : C) (D : Type u₁) [category.{u₁ v₁} D] : (C × D) ↝ C :=
6363
{ obj := λ X, X.1,
6464
map := λ X Y f, f.1,
6565
map_id := begin /- `obviously'` says: -/ intros, refl end,
6666
map_comp := begin /- `obviously'` says: -/ intros, refl end }
6767

68-
/-- `right_projection` is the functor `(X, Y) ↦ Y`. -/
69-
definition right_projection (C : Type u₁) [category.{u₁ v₁} C] (Z : C) (D : Type u₁) [category.{u₁ v₁} D] : (C × D) ↝ D :=
68+
/-- `snd` is the functor `(X, Y) ↦ Y`. -/
69+
def snd (C : Type u₁) [category.{u₁ v₁} C] (Z : C) (D : Type u₁) [category.{u₁ v₁} D] : (C × D) ↝ D :=
7070
{ obj := λ X, X.2,
7171
map := λ X Y f, f.2,
7272
map_id := begin /- `obviously'` says: -/ intros, refl end,
7373
map_comp := begin /- `obviously'` says: -/ intros, refl end }
7474

75-
end product_category
75+
end prod.category
7676

7777
variables {A : Type u₁} [𝒜 : category.{u₁ v₁} A] {B : Type u₂} [ℬ : category.{u₂ v₂} B] {C : Type u₃} [𝒞 : category.{u₃ v₃} C] {D : Type u₄} [𝒟 : category.{u₄ v₄} D]
7878
include 𝒜 ℬ 𝒞 𝒟
7979

8080
namespace functor
8181
/-- The cartesion product of two functors. -/
82-
definition product (F : A ↝ B) (G : C ↝ D) : (A × C) ↝ (B × D) :=
82+
def prod (F : A ↝ B) (G : C ↝ D) : (A × C) ↝ (B × D) :=
8383
{ obj := λ X, (F X.1, G X.2),
8484
map := λ _ _ f, (F.map f.1, G.map f.2),
8585
map_id := begin /- `obviously'` says: -/ intros, cases X, dsimp, rw map_id_lemma, rw map_id_lemma end,
8686
map_comp := begin /- `obviously'` says: -/ intros, cases Z, cases Y, cases X, cases f, cases g, dsimp at *, rw map_comp_lemma, rw map_comp_lemma end }
8787

88-
notation F `×` G := product F G
89-
90-
@[simp,ematch] lemma product_obj (F : A ↝ B) (G : C ↝ D) (a : A) (c : C) : (F × G) (a, c) = (F a, G c) := rfl
91-
@[simp,ematch] lemma product_map (F : A ↝ B) (G : C ↝ D) {a a' : A} {c c' : C} (f : (a, c) ⟶ (a', c')) : (F × G).map f = (F.map f.1, G.map f.2) := rfl
88+
@[simp, ematch] lemma prod_obj (F : A ↝ B) (G : C ↝ D) (a : A) (c : C) : F.prod G (a, c) = (F a, G c) := rfl
89+
@[simp, ematch] lemma prod_map (F : A ↝ B) (G : C ↝ D) {a a' : A} {c c' : C} (f : (a, c) ⟶ (a', c')) : (F.prod G).map f = (F.map f.1, G.map f.2) := rfl
9290
end functor
9391

9492
namespace nat_trans
9593

9694
/-- The cartesian product of two natural transformations. -/
97-
definition product {F G : A ↝ B} {H I : C ↝ D} (α : F ⟹ G) (β : H ⟹ I) : (F × H)(G × I) :=
95+
def prod {F G : A ↝ B} {H I : C ↝ D} (α : F ⟹ G) (β : H ⟹ I) : F.prod HG.prod I :=
9896
{ app := λ X, (α X.1, β X.2),
9997
naturality := begin /- `obviously'` says: -/ intros, cases f, cases Y, cases X, dsimp at *, simp, split, rw naturality_lemma, rw naturality_lemma end }
10098

101-
notation α `×` β := product α β
102-
103-
@[simp,ematch] lemma product_app {F G : A ↝ B} {H I : C ↝ D} (α : F ⟹ G) (β : H ⟹ I) (a : A) (c : C) : (α × β) (a, c) = (α a, β c) := rfl
99+
@[simp, ematch] lemma prod_app {F G : A ↝ B} {H I : C ↝ D} (α : F ⟹ G) (β : H ⟹ I) (a : A) (c : C) : α.prod β (a, c) = (α a, β c) := rfl
104100
end nat_trans
105101

106102
end category_theory

order/bounds.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ section preorder
1515

1616
variables [preorder α] [preorder β] {f : α → β}
1717

18-
definition upper_bounds (s : set α) : set α := { x | ∀a ∈ s, a ≤ x }
19-
definition lower_bounds (s : set α) : set α := { x | ∀a ∈ s, x ≤ a }
20-
definition is_least (s : set α) (a : α) : Prop := a ∈ s ∧ a ∈ lower_bounds s
21-
definition is_greatest (s : set α) (a : α) : Prop := a ∈ s ∧ a ∈ upper_bounds s
22-
definition is_lub (s : set α) : α → Prop := is_least (upper_bounds s)
23-
definition is_glb (s : set α) : α → Prop := is_greatest (lower_bounds s)
18+
def upper_bounds (s : set α) : set α := { x | ∀a ∈ s, a ≤ x }
19+
def lower_bounds (s : set α) : set α := { x | ∀a ∈ s, x ≤ a }
20+
def is_least (s : set α) (a : α) : Prop := a ∈ s ∧ a ∈ lower_bounds s
21+
def is_greatest (s : set α) (a : α) : Prop := a ∈ s ∧ a ∈ upper_bounds s
22+
def is_lub (s : set α) : α → Prop := is_least (upper_bounds s)
23+
def is_glb (s : set α) : α → Prop := is_greatest (lower_bounds s)
2424

2525
lemma mem_upper_bounds_image (Hf : monotone f) (Ha : a ∈ upper_bounds s) :
2626
f a ∈ upper_bounds (f '' s) :=

tactic/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ end environment
4646

4747
namespace tactic
4848

49-
meta definition mk_local (n : name) : expr :=
49+
meta def mk_local (n : name) : expr :=
5050
expr.local_const n n binder_info.default (expr.const n [])
5151

5252
meta def exact_dec_trivial : tactic unit := `[exact dec_trivial]

0 commit comments

Comments
 (0)