File: Mathlib/CategoryTheory/Category/Basic.lean

full_name: CategoryTheory.CategoryStruct.comp
code: /-- A preliminary structure on the way to defining a category,
containing the data, but none of the axioms. -/
@[pp_with_univ]
class CategoryStruct (obj : Type u) extends Quiver.{v + 1} obj : Type max u (v + 1) where
  /-- The identity morphism on an object. -/
  id : ∀ X : obj, Hom X X
  /-- Composition of morphisms in a category, written `f ≫ g`. -/
  comp : ∀ {X Y Z : obj}, (X ⟶ Y) → (Y ⟶ Z) → (X ⟶ Z)
goal: (X ⟶ Y) → (Y ⟶ Z) → (X ⟶ Z)

full_name: CategoryTheory.CategoryStruct.id
code: /-- A preliminary structure on the way to defining a category,
containing the data, but none of the axioms. -/
@[pp_with_univ]
class CategoryStruct (obj : Type u) extends Quiver.{v + 1} obj : Type max u (v + 1) where
  /-- The identity morphism on an object. -/
  id : ∀ X : obj, Hom X X
  /-- Composition of morphisms in a category, written `f ≫ g`. -/
  comp : ∀ {X Y Z : obj}, (X ⟶ Y) → (Y ⟶ Z) → (X ⟶ Z)
goal: X ⟶ X

full_name: CategoryTheory.CategoryStruct
code: /-- A preliminary structure on the way to defining a category,
containing the data, but none of the axioms. -/
@[pp_with_univ]
class CategoryStruct (obj : Type u) extends Quiver.{v + 1} obj : Type max u (v + 1) where
  /-- The identity morphism on an object. -/
  id : ∀ X : obj, Hom X X
  /-- Composition of morphisms in a category, written `f ≫ g`. -/
  comp : ∀ {X Y Z : obj}, (X ⟶ Y) → (Y ⟶ Z) → (X ⟶ Z)
goal: Type (max u (v + 1))

full_name: CategoryTheory._aux_Mathlib_CategoryTheory_Category_Basic___unexpand_CategoryTheory_CategoryStruct_id_1
code: /-- Notation for the identity morphism in a category. -/
scoped notation "𝟙" => CategoryStruct.id
goal: Lean.PrettyPrinter.Unexpander

full_name: CategoryTheory.«_aux_Mathlib_CategoryTheory_Category_Basic___macroRules_CategoryTheory_term𝟙_1»
code: /-- Notation for the identity morphism in a category. -/
scoped notation "𝟙" => CategoryStruct.id
goal: Lean.Macro

full_name: CategoryTheory._aux_Mathlib_CategoryTheory_Category_Basic___unexpand_CategoryTheory_CategoryStruct_comp_1
code: /-- Notation for composition of morphisms in a category. -/
scoped infixr:80 " ≫ " => CategoryStruct.comp
goal: Lean.PrettyPrinter.Unexpander

full_name: CategoryTheory.«_aux_Mathlib_CategoryTheory_Category_Basic___macroRules_CategoryTheory_term_≫__1»
code: /-- Notation for composition of morphisms in a category. -/
scoped infixr:80 " ≫ " => CategoryStruct.comp
goal: Lean.Macro

full_name: CategoryTheory.sorryIfSorry
code: /-- Close the main goal with `sorry` if its type contains `sorry`, and fail otherwise. -/
syntax (name := sorryIfSorry) "sorry_if_sorry" : tactic
goal: Lean.ParserDescr

full_name: CategoryTheory.evalSorryIfSorry
code: @[tactic sorryIfSorry, inherit_doc sorryIfSorry] def evalSorryIfSorry : Tactic 
goal: Lean.Elab.Tactic.Tactic

full_name: CategoryTheory._aux_Mathlib_CategoryTheory_Category_Basic___macroRules_CategoryTheory_aesop_cat_1
code: macro (name := aesop_cat) "aesop_cat" c:Aesop.tactic_clause* : tactic =>
`(tactic|
  first | sorry_if_sorry |
  aesop $c* (config := { introsTransparency? := some .default, terminal := true })
            (rule_sets := [$(Lean.mkIdent `CategoryTheory):ident]))
goal: Lean.Macro

full_name: CategoryTheory.aesop_cat
code: macro (name := aesop_cat) "aesop_cat" c:Aesop.tactic_clause* : tactic =>
`(tactic|
  first | sorry_if_sorry |
  aesop $c* (config := { introsTransparency? := some .default, terminal := true })
            (rule_sets := [$(Lean.mkIdent `CategoryTheory):ident]))
goal: Lean.ParserDescr

full_name: CategoryTheory.aesop_cat?
code: macro (name := aesop_cat?) "aesop_cat?" c:Aesop.tactic_clause* : tactic =>
`(tactic|
  first | sorry_if_sorry |
  aesop? $c* (config := { introsTransparency? := some .default, terminal := true })
             (rule_sets := [$(Lean.mkIdent `CategoryTheory):ident]))
goal: Lean.ParserDescr

full_name: CategoryTheory._aux_Mathlib_CategoryTheory_Category_Basic___macroRules_CategoryTheory_aesop_cat?_1
code: macro (name := aesop_cat?) "aesop_cat?" c:Aesop.tactic_clause* : tactic =>
`(tactic|
  first | sorry_if_sorry |
  aesop? $c* (config := { introsTransparency? := some .default, terminal := true })
             (rule_sets := [$(Lean.mkIdent `CategoryTheory):ident]))
goal: Lean.Macro

full_name: CategoryTheory._aux_Mathlib_CategoryTheory_Category_Basic___macroRules_CategoryTheory_aesop_cat_nonterminal_1
code: macro (name := aesop_cat_nonterminal) "aesop_cat_nonterminal" c:Aesop.tactic_clause* : tactic =>
  `(tactic|
    aesop $c* (config := { introsTransparency? := some .default, warnOnNonterminal := false })
              (rule_sets := [$(Lean.mkIdent `CategoryTheory):ident]))
goal: Lean.Macro

full_name: CategoryTheory.aesop_cat_nonterminal
code: macro (name := aesop_cat_nonterminal) "aesop_cat_nonterminal" c:Aesop.tactic_clause* : tactic =>
  `(tactic|
    aesop $c* (config := { introsTransparency? := some .default, warnOnNonterminal := false })
              (rule_sets := [$(Lean.mkIdent `CategoryTheory):ident]))
goal: Lean.ParserDescr

full_name: CategoryTheory.Category.assoc
code: /-- The typeclass `Category C` describes morphisms associated to objects of type `C`.
The universe levels of the objects and morphisms are unconstrained, and will often need to be
specified explicitly, as `Category.{v} C`. (See also `LargeCategory` and `SmallCategory`.)

See <https://stacks.math.columbia.edu/tag/0014>.
-/
@[pp_with_univ]
class Category (obj : Type u) extends CategoryStruct.{v} obj : Type max u (v + 1) where
  /-- Identity morphisms are left identities for composition. -/
  id_comp : ∀ {X Y : obj} (f : X ⟶ Y), 𝟙 X ≫ f = f := by aesop_cat
  /-- Identity morphisms are right identities for composition. -/
  comp_id : ∀ {X Y : obj} (f : X ⟶ Y), f ≫ 𝟙 Y = f := by aesop_cat
  /-- Composition in a category is associative. -/
  assoc : ∀ {W X Y Z : obj} (f : W ⟶ X) (g : X ⟶ Y) (h : Y ⟶ Z), (f ≫ g) ≫ h = f ≫ g ≫ h := by
    aesop_cat
goal: CategoryTheory.CategoryStruct.comp (CategoryTheory.CategoryStruct.comp f g) h =
  CategoryTheory.CategoryStruct.comp f (CategoryTheory.CategoryStruct.comp g h)

full_name: CategoryTheory.Category
code: /-- The typeclass `Category C` describes morphisms associated to objects of type `C`.
The universe levels of the objects and morphisms are unconstrained, and will often need to be
specified explicitly, as `Category.{v} C`. (See also `LargeCategory` and `SmallCategory`.)

See <https://stacks.math.columbia.edu/tag/0014>.
-/
@[pp_with_univ]
class Category (obj : Type u) extends CategoryStruct.{v} obj : Type max u (v + 1) where
  /-- Identity morphisms are left identities for composition. -/
  id_comp : ∀ {X Y : obj} (f : X ⟶ Y), 𝟙 X ≫ f = f := by aesop_cat
  /-- Identity morphisms are right identities for composition. -/
  comp_id : ∀ {X Y : obj} (f : X ⟶ Y), f ≫ 𝟙 Y = f := by aesop_cat
  /-- Composition in a category is associative. -/
  assoc : ∀ {W X Y Z : obj} (f : W ⟶ X) (g : X ⟶ Y) (h : Y ⟶ Z), (f ≫ g) ≫ h = f ≫ g ≫ h := by
    aesop_cat
goal: Type (max u (v + 1))

full_name: CategoryTheory.Category.comp_id
code: /-- The typeclass `Category C` describes morphisms associated to objects of type `C`.
The universe levels of the objects and morphisms are unconstrained, and will often need to be
specified explicitly, as `Category.{v} C`. (See also `LargeCategory` and `SmallCategory`.)

See <https://stacks.math.columbia.edu/tag/0014>.
-/
@[pp_with_univ]
class Category (obj : Type u) extends CategoryStruct.{v} obj : Type max u (v + 1) where
  /-- Identity morphisms are left identities for composition. -/
  id_comp : ∀ {X Y : obj} (f : X ⟶ Y), 𝟙 X ≫ f = f := by aesop_cat
  /-- Identity morphisms are right identities for composition. -/
  comp_id : ∀ {X Y : obj} (f : X ⟶ Y), f ≫ 𝟙 Y = f := by aesop_cat
  /-- Composition in a category is associative. -/
  assoc : ∀ {W X Y Z : obj} (f : W ⟶ X) (g : X ⟶ Y) (h : Y ⟶ Z), (f ≫ g) ≫ h = f ≫ g ≫ h := by
    aesop_cat
goal: CategoryTheory.CategoryStruct.comp f (CategoryTheory.CategoryStruct.id Y) = f

full_name: CategoryTheory.Category.id_comp
code: /-- The typeclass `Category C` describes morphisms associated to objects of type `C`.
The universe levels of the objects and morphisms are unconstrained, and will often need to be
specified explicitly, as `Category.{v} C`. (See also `LargeCategory` and `SmallCategory`.)

See <https://stacks.math.columbia.edu/tag/0014>.
-/
@[pp_with_univ]
class Category (obj : Type u) extends CategoryStruct.{v} obj : Type max u (v + 1) where
  /-- Identity morphisms are left identities for composition. -/
  id_comp : ∀ {X Y : obj} (f : X ⟶ Y), 𝟙 X ≫ f = f := by aesop_cat
  /-- Identity morphisms are right identities for composition. -/
  comp_id : ∀ {X Y : obj} (f : X ⟶ Y), f ≫ 𝟙 Y = f := by aesop_cat
  /-- Composition in a category is associative. -/
  assoc : ∀ {W X Y Z : obj} (f : W ⟶ X) (g : X ⟶ Y) (h : Y ⟶ Z), (f ≫ g) ≫ h = f ≫ g ≫ h := by
    aesop_cat
goal: CategoryTheory.CategoryStruct.comp (CategoryTheory.CategoryStruct.id X) f = f

full_name: CategoryTheory.LargeCategory
code: /-- A `LargeCategory` has objects in one universe level higher than the universe level of
the morphisms. It is useful for examples such as the category of types, or the category
of groups, etc.
-/
abbrev LargeCategory (C : Type (u + 1)) : Type (u + 1) 
goal: Type (u + 1)

full_name: CategoryTheory.SmallCategory
code: /-- A `SmallCategory` has objects and morphisms in the same universe level.
-/
abbrev SmallCategory (C : Type u) : Type (u + 1) 
goal: Type (u + 1)

full_name: CategoryTheory.eq_whisker
code: /-- postcompose an equation between morphisms by another morphism -/
theorem eq_whisker {f g : X ⟶ Y} (w : f = g) (h : Y ⟶ Z) : f ≫ h = g ≫ h 
goal: CategoryTheory.CategoryStruct.comp f h = CategoryTheory.CategoryStruct.comp g h

full_name: CategoryTheory.whisker_eq
code: /-- precompose an equation between morphisms by another morphism -/
theorem whisker_eq (f : X ⟶ Y) {g h : Y ⟶ Z} (w : g = h) : f ≫ g = f ≫ h 
goal: CategoryTheory.CategoryStruct.comp f g = CategoryTheory.CategoryStruct.comp f h

full_name: CategoryTheory.«_aux_Mathlib_CategoryTheory_Category_Basic___macroRules_CategoryTheory_term_=≫__1»
code: /--
Notation for whiskering an equation by a morphism (on the right).
If `f g : X ⟶ Y` and `w : f = g` and `h : Y ⟶ Z`, then `w =≫ h : f ≫ h = g ≫ h`.
-/
scoped infixr:80 " =≫ " => eq_whisker
goal: Lean.Macro

full_name: CategoryTheory._aux_Mathlib_CategoryTheory_Category_Basic___unexpand_CategoryTheory_eq_whisker_1
code: /--
Notation for whiskering an equation by a morphism (on the right).
If `f g : X ⟶ Y` and `w : f = g` and `h : Y ⟶ Z`, then `w =≫ h : f ≫ h = g ≫ h`.
-/
scoped infixr:80 " =≫ " => eq_whisker
goal: Lean.PrettyPrinter.Unexpander

full_name: CategoryTheory.«_aux_Mathlib_CategoryTheory_Category_Basic___macroRules_CategoryTheory_term_≫=__1»
code: /--
Notation for whiskering an equation by a morphism (on the left).
If `g h : Y ⟶ Z` and `w : g = h` and `h : X ⟶ Y`, then `f ≫= w : f ≫ g = f ≫ h`.
-/
scoped infixr:80 " ≫= " => whisker_eq
goal: Lean.Macro

full_name: CategoryTheory._aux_Mathlib_CategoryTheory_Category_Basic___unexpand_CategoryTheory_whisker_eq_1
code: /--
Notation for whiskering an equation by a morphism (on the left).
If `g h : Y ⟶ Z` and `w : g = h` and `h : X ⟶ Y`, then `f ≫= w : f ≫ g = f ≫ h`.
-/
scoped infixr:80 " ≫= " => whisker_eq
goal: Lean.PrettyPrinter.Unexpander

full_name: CategoryTheory.eq_of_comp_left_eq
code: theorem eq_of_comp_left_eq {f g : X ⟶ Y} (w : ∀ {Z : C} (h : Y ⟶ Z), f ≫ h = g ≫ h) :
    f = g 
goal: f = g

full_name: CategoryTheory.eq_of_comp_right_eq
code: theorem eq_of_comp_right_eq {f g : Y ⟶ Z} (w : ∀ {X : C} (h : X ⟶ Y), h ≫ f = h ≫ g) :
    f = g 
goal: f = g

full_name: CategoryTheory.eq_of_comp_left_eq'
code: theorem eq_of_comp_left_eq' (f g : X ⟶ Y)
    (w : (fun {Z} (h : Y ⟶ Z) => f ≫ h) = fun {Z} (h : Y ⟶ Z) => g ≫ h) : f = g 
goal: f = g

full_name: CategoryTheory.eq_of_comp_right_eq'
code: theorem eq_of_comp_right_eq' (f g : Y ⟶ Z)
    (w : (fun {X} (h : X ⟶ Y) => h ≫ f) = fun {X} (h : X ⟶ Y) => h ≫ g) : f = g 
goal: f = g

full_name: CategoryTheory.id_of_comp_left_id
code: theorem id_of_comp_left_id (f : X ⟶ X) (w : ∀ {Y : C} (g : X ⟶ Y), f ≫ g = g) : f = 𝟙 X 
goal: f = CategoryTheory.CategoryStruct.id X

full_name: CategoryTheory.id_of_comp_right_id
code: theorem id_of_comp_right_id (f : X ⟶ X) (w : ∀ {Y : C} (g : Y ⟶ X), g ≫ f = g) : f = 𝟙 X 
goal: f = CategoryTheory.CategoryStruct.id X

full_name: CategoryTheory.comp_ite
code: theorem comp_ite {P : Prop} [Decidable P] {X Y Z : C} (f : X ⟶ Y) (g g' : Y ⟶ Z) :
    (f ≫ if P then g else g') = if P then f ≫ g else f ≫ g' 
goal: CategoryTheory.CategoryStruct.comp f (if P then g else g') =
  if P then CategoryTheory.CategoryStruct.comp f g else CategoryTheory.CategoryStruct.comp f g'

full_name: CategoryTheory.ite_comp
code: theorem ite_comp {P : Prop} [Decidable P] {X Y Z : C} (f f' : X ⟶ Y) (g : Y ⟶ Z) :
    (if P then f else f') ≫ g = if P then f ≫ g else f' ≫ g 
goal: CategoryTheory.CategoryStruct.comp (if P then f else f') g =
  if P then CategoryTheory.CategoryStruct.comp f g else CategoryTheory.CategoryStruct.comp f' g

full_name: CategoryTheory.comp_dite
code: theorem comp_dite {P : Prop} [Decidable P]
    {X Y Z : C} (f : X ⟶ Y) (g : P → (Y ⟶ Z)) (g' : ¬P → (Y ⟶ Z)) :
    (f ≫ if h : P then g h else g' h) = if h : P then f ≫ g h else f ≫ g' h 
goal: CategoryTheory.CategoryStruct.comp f (if h : P then g h else g' h) =
  if h : P then CategoryTheory.CategoryStruct.comp f (g h) else CategoryTheory.CategoryStruct.comp f (g' h)

full_name: CategoryTheory.dite_comp
code: theorem dite_comp {P : Prop} [Decidable P]
    {X Y Z : C} (f : P → (X ⟶ Y)) (f' : ¬P → (X ⟶ Y)) (g : Y ⟶ Z) :
    (if h : P then f h else f' h) ≫ g = if h : P then f h ≫ g else f' h ≫ g 
goal: CategoryTheory.CategoryStruct.comp (if h : P then f h else f' h) g =
  if h : P then CategoryTheory.CategoryStruct.comp (f h) g else CategoryTheory.CategoryStruct.comp (f' h) g

full_name: CategoryTheory.Epi.left_cancellation
code: /-- A morphism `f` is an epimorphism if it can be cancelled when precomposed:
`f ≫ g = f ≫ h` implies `g = h`.

See <https://stacks.math.columbia.edu/tag/003B>.
-/
class Epi (f : X ⟶ Y) : Prop where
  /-- A morphism `f` is an epimorphism if it can be cancelled when precomposed. -/
  left_cancellation : ∀ {Z : C} (g h : Y ⟶ Z), f ≫ g = f ≫ h → g = h
goal: CategoryTheory.CategoryStruct.comp f g = CategoryTheory.CategoryStruct.comp f h → g = h

full_name: CategoryTheory.Epi
code: /-- A morphism `f` is an epimorphism if it can be cancelled when precomposed:
`f ≫ g = f ≫ h` implies `g = h`.

See <https://stacks.math.columbia.edu/tag/003B>.
-/
class Epi (f : X ⟶ Y) : Prop where
  /-- A morphism `f` is an epimorphism if it can be cancelled when precomposed. -/
  left_cancellation : ∀ {Z : C} (g h : Y ⟶ Z), f ≫ g = f ≫ h → g = h
goal: Prop

full_name: CategoryTheory.Mono.right_cancellation
code: /-- A morphism `f` is a monomorphism if it can be cancelled when postcomposed:
`g ≫ f = h ≫ f` implies `g = h`.

See <https://stacks.math.columbia.edu/tag/003B>.
-/
class Mono (f : X ⟶ Y) : Prop where
  /-- A morphism `f` is a monomorphism if it can be cancelled when postcomposed. -/
  right_cancellation : ∀ {Z : C} (g h : Z ⟶ X), g ≫ f = h ≫ f → g = h
goal: CategoryTheory.CategoryStruct.comp g f = CategoryTheory.CategoryStruct.comp h f → g = h

full_name: CategoryTheory.Mono
code: /-- A morphism `f` is a monomorphism if it can be cancelled when postcomposed:
`g ≫ f = h ≫ f` implies `g = h`.

See <https://stacks.math.columbia.edu/tag/003B>.
-/
class Mono (f : X ⟶ Y) : Prop where
  /-- A morphism `f` is a monomorphism if it can be cancelled when postcomposed. -/
  right_cancellation : ∀ {Z : C} (g h : Z ⟶ X), g ≫ f = h ≫ f → g = h
goal: Prop

full_name: CategoryTheory.instEpiId
code: instance (X : C) : Epi (𝟙 X) 
goal: CategoryTheory.Epi (CategoryTheory.CategoryStruct.id X)

full_name: CategoryTheory.instMonoId
code: instance (X : C) : Mono (𝟙 X) 
goal: CategoryTheory.Mono (CategoryTheory.CategoryStruct.id X)

full_name: CategoryTheory.cancel_epi
code: theorem cancel_epi (f : X ⟶ Y) [Epi f] {g h : Y ⟶ Z} : f ≫ g = f ≫ h ↔ g = h 
goal: CategoryTheory.CategoryStruct.comp f g = CategoryTheory.CategoryStruct.comp f h ↔ g = h

full_name: CategoryTheory.cancel_mono
code: theorem cancel_mono (f : X ⟶ Y) [Mono f] {g h : Z ⟶ X} : g ≫ f = h ≫ f ↔ g = h 
goal: CategoryTheory.CategoryStruct.comp g f = CategoryTheory.CategoryStruct.comp h f ↔ g = h

full_name: CategoryTheory.cancel_epi_id
code: theorem cancel_epi_id (f : X ⟶ Y) [Epi f] {h : Y ⟶ Y} : f ≫ h = f ↔ h = 𝟙 Y 
goal: CategoryTheory.CategoryStruct.comp f h = f ↔ h = CategoryTheory.CategoryStruct.id Y

full_name: CategoryTheory.cancel_mono_id
code: theorem cancel_mono_id (f : X ⟶ Y) [Mono f] {g : X ⟶ X} : g ≫ f = f ↔ g = 𝟙 X 
goal: CategoryTheory.CategoryStruct.comp g f = f ↔ g = CategoryTheory.CategoryStruct.id X

full_name: CategoryTheory.epi_comp
code: theorem epi_comp {X Y Z : C} (f : X ⟶ Y) [Epi f] (g : Y ⟶ Z) [Epi g] : Epi (f ≫ g) 
goal: CategoryTheory.Epi (CategoryTheory.CategoryStruct.comp f g)

full_name: CategoryTheory.mono_comp
code: theorem mono_comp {X Y Z : C} (f : X ⟶ Y) [Mono f] (g : Y ⟶ Z) [Mono g] : Mono (f ≫ g) 
goal: CategoryTheory.Mono (CategoryTheory.CategoryStruct.comp f g)

full_name: CategoryTheory.mono_of_mono
code: theorem mono_of_mono {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Mono (f ≫ g)] : Mono f 
goal: CategoryTheory.Mono f

full_name: CategoryTheory.mono_of_mono_fac
code: theorem mono_of_mono_fac {X Y Z : C} {f : X ⟶ Y} {g : Y ⟶ Z} {h : X ⟶ Z} [Mono h]
    (w : f ≫ g = h) : Mono f 
goal: CategoryTheory.Mono f

full_name: CategoryTheory.epi_of_epi
code: theorem epi_of_epi {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [Epi (f ≫ g)] : Epi g 
goal: CategoryTheory.Epi g

full_name: CategoryTheory.epi_of_epi_fac
code: theorem epi_of_epi_fac {X Y Z : C} {f : X ⟶ Y} {g : Y ⟶ Z} {h : X ⟶ Z} [Epi h]
    (w : f ≫ g = h) : Epi g 
goal: CategoryTheory.Epi g

full_name: CategoryTheory.instMono
code: instance : Mono f 
goal: CategoryTheory.Mono f

full_name: CategoryTheory.instEpi
code: instance : Epi f 
goal: CategoryTheory.Epi f

full_name: CategoryTheory.uliftCategory
code: instance uliftCategory : Category.{v} (ULift.{u'} C) 
goal: CategoryTheory.Category.{v, max u' u} (ULift.{u', u} C)