File: Mathlib/CategoryTheory/CommSq.lean

full_name: CategoryTheory.CommSq.w
code: /-- The proposition that a square
```
  W ---f---> X
  |          |
  g          h
  |          |
  v          v
  Y ---i---> Z

```
is a commuting square.
-/
structure CommSq {W X Y Z : C} (f : W ⟶ X) (g : W ⟶ Y) (h : X ⟶ Z) (i : Y ⟶ Z) : Prop where
  /-- The square commutes. -/
  w : f ≫ h = g ≫ i
goal: CategoryTheory.CategoryStruct.comp f h = CategoryTheory.CategoryStruct.comp g i

full_name: CategoryTheory.CommSq
code: /-- The proposition that a square
```
  W ---f---> X
  |          |
  g          h
  |          |
  v          v
  Y ---i---> Z

```
is a commuting square.
-/
structure CommSq {W X Y Z : C} (f : W ⟶ X) (g : W ⟶ Y) (h : X ⟶ Z) (i : Y ⟶ Z) : Prop where
  /-- The square commutes. -/
  w : f ≫ h = g ≫ i
goal: Prop

full_name: CategoryTheory.CommSq.flip
code: theorem flip (p : CommSq f g h i) : CommSq g f i h 
goal: CategoryTheory.CommSq g f i h

full_name: CategoryTheory.CommSq.of_arrow
code: theorem of_arrow {f g : Arrow C} (h : f ⟶ g) : CommSq f.hom h.left h.right g.hom 
goal: CategoryTheory.CommSq f.hom h.left h.right g.hom

full_name: CategoryTheory.CommSq.op
code: /-- The commutative square in the opposite category associated to a commutative square. -/
theorem op (p : CommSq f g h i) : CommSq i.op h.op g.op f.op 
goal: CategoryTheory.CommSq i.op h.op g.op f.op

full_name: CategoryTheory.CommSq.unop
code: /-- The commutative square associated to a commutative square in the opposite category. -/
theorem unop {W X Y Z : Cᵒᵖ} {f : W ⟶ X} {g : W ⟶ Y} {h : X ⟶ Z} {i : Y ⟶ Z} (p : CommSq f g h i) :
    CommSq i.unop h.unop g.unop f.unop 
goal: CategoryTheory.CommSq i.unop h.unop g.unop f.unop

full_name: CategoryTheory.CommSq.vert_inv
code: theorem vert_inv {g : W ≅ Y} {h : X ≅ Z} (p : CommSq f g.hom h.hom i) :
    CommSq i g.inv h.inv f 
goal: CategoryTheory.CommSq i g.inv h.inv f

full_name: CategoryTheory.CommSq.horiz_inv
code: theorem horiz_inv {f : W ≅ X} {i : Y ≅ Z} (p : CommSq f.hom g h i.hom) :
    CommSq f.inv h g i.inv 
goal: CategoryTheory.CommSq f.inv h g i.inv

full_name: CategoryTheory.CommSq.horiz_comp
code: /-- The horizontal composition of two commutative squares as below is a commutative square.
```
  W ---f---> X ---f'--> X'
  |          |          |
  g          h          h'
  |          |          |
  v          v          v
  Y ---i---> Z ---i'--> Z'

```
-/
lemma horiz_comp {W X X' Y Z Z' : C} {f : W ⟶ X} {f' : X ⟶ X'} {g : W ⟶ Y} {h : X ⟶ Z}
    {h' : X' ⟶ Z'} {i : Y ⟶ Z} {i' : Z ⟶ Z'} (hsq₁ : CommSq f g h i) (hsq₂ : CommSq f' h h' i') :
    CommSq (f ≫ f') g h' (i ≫ i') 
goal: CategoryTheory.CommSq (CategoryTheory.CategoryStruct.comp f f') g h' (CategoryTheory.CategoryStruct.comp i i')

full_name: CategoryTheory.CommSq.vert_comp
code: /-- The vertical composition of two commutative squares as below is a commutative square.
```
  W ---f---> X
  |          |
  g          h
  |          |
  v          v
  Y ---i---> Z
  |          |
  g'         h'
  |          |
  v          v
  Y'---i'--> Z'

```
-/
lemma vert_comp {W X Y Y' Z Z' : C} {f : W ⟶ X} {g : W ⟶ Y} {g' : Y ⟶ Y'} {h : X ⟶ Z}
    {h' : Z ⟶ Z'} {i : Y ⟶ Z} {i' : Y' ⟶ Z'} (hsq₁ : CommSq f g h i) (hsq₂ : CommSq i g' h' i') :
    CommSq f (g ≫ g') (h ≫ h') i' 
goal: CategoryTheory.CommSq f (CategoryTheory.CategoryStruct.comp g g') (CategoryTheory.CategoryStruct.comp h h') i'

full_name: CategoryTheory.Functor.map_commSq
code: theorem map_commSq (s : CommSq f g h i) : CommSq (F.map f) (F.map g) (F.map h) (F.map i) 
goal: CategoryTheory.CommSq (F.map f) (F.map g) (F.map h) (F.map i)

full_name: CategoryTheory.CommSq.LiftStruct
code: /-- Now we consider a square:
```
  A ---f---> X
  |          |
  i          p
  |          |
  v          v
  B ---g---> Y
```

The datum of a lift in a commutative square, i.e. an up-right-diagonal
morphism which makes both triangles commute. -/
-- porting note (#5171): removed @[nolint has_nonempty_instance]
@[ext]
structure LiftStruct (sq : CommSq f i p g) where
  /-- The lift. -/
  l : B ⟶ X
  /-- The upper left triangle commutes. -/
  fac_left : i ≫ l = f
  /-- The lower right triangle commutes. -/
  fac_right : l ≫ p = g
goal: Type u_2

full_name: CategoryTheory.CommSq.LiftStruct.fac_left
code: /-- Now we consider a square:
```
  A ---f---> X
  |          |
  i          p
  |          |
  v          v
  B ---g---> Y
```

The datum of a lift in a commutative square, i.e. an up-right-diagonal
morphism which makes both triangles commute. -/
-- porting note (#5171): removed @[nolint has_nonempty_instance]
@[ext]
structure LiftStruct (sq : CommSq f i p g) where
  /-- The lift. -/
  l : B ⟶ X
  /-- The upper left triangle commutes. -/
  fac_left : i ≫ l = f
  /-- The lower right triangle commutes. -/
  fac_right : l ≫ p = g
goal: CategoryTheory.CategoryStruct.comp i self.l = f

full_name: CategoryTheory.CommSq.LiftStruct.l
code: /-- Now we consider a square:
```
  A ---f---> X
  |          |
  i          p
  |          |
  v          v
  B ---g---> Y
```

The datum of a lift in a commutative square, i.e. an up-right-diagonal
morphism which makes both triangles commute. -/
-- porting note (#5171): removed @[nolint has_nonempty_instance]
@[ext]
structure LiftStruct (sq : CommSq f i p g) where
  /-- The lift. -/
  l : B ⟶ X
  /-- The upper left triangle commutes. -/
  fac_left : i ≫ l = f
  /-- The lower right triangle commutes. -/
  fac_right : l ≫ p = g
goal: B ⟶ X

full_name: CategoryTheory.CommSq.LiftStruct.fac_right
code: /-- Now we consider a square:
```
  A ---f---> X
  |          |
  i          p
  |          |
  v          v
  B ---g---> Y
```

The datum of a lift in a commutative square, i.e. an up-right-diagonal
morphism which makes both triangles commute. -/
-- porting note (#5171): removed @[nolint has_nonempty_instance]
@[ext]
structure LiftStruct (sq : CommSq f i p g) where
  /-- The lift. -/
  l : B ⟶ X
  /-- The upper left triangle commutes. -/
  fac_left : i ≫ l = f
  /-- The lower right triangle commutes. -/
  fac_right : l ≫ p = g
goal: CategoryTheory.CategoryStruct.comp self.l p = g

full_name: CategoryTheory.CommSq.LiftStruct.op
code: /-- A `LiftStruct` for a commutative square gives a `LiftStruct` for the
corresponding square in the opposite category. -/
@[simps]
def op {sq : CommSq f i p g} (l : LiftStruct sq) : LiftStruct sq.op 
goal: ⋯.LiftStruct

full_name: CategoryTheory.CommSq.LiftStruct.op_l
code: /-- A `LiftStruct` for a commutative square gives a `LiftStruct` for the
corresponding square in the opposite category. -/
@[simps]
def op {sq : CommSq f i p g} (l : LiftStruct sq) : LiftStruct sq.op 
goal: l.op.l = l.l.op

full_name: CategoryTheory.CommSq.LiftStruct.unop_l
code: /-- A `LiftStruct` for a commutative square in the opposite category
gives a `LiftStruct` for the corresponding square in the original category. -/
@[simps]
def unop {A B X Y : Cᵒᵖ} {f : A ⟶ X} {i : A ⟶ B} {p : X ⟶ Y} {g : B ⟶ Y} {sq : CommSq f i p g}
    (l : LiftStruct sq) : LiftStruct sq.unop 
goal: l.unop.l = l.l.unop

full_name: CategoryTheory.CommSq.LiftStruct.unop
code: /-- A `LiftStruct` for a commutative square in the opposite category
gives a `LiftStruct` for the corresponding square in the original category. -/
@[simps]
def unop {A B X Y : Cᵒᵖ} {f : A ⟶ X} {i : A ⟶ B} {p : X ⟶ Y} {g : B ⟶ Y} {sq : CommSq f i p g}
    (l : LiftStruct sq) : LiftStruct sq.unop 
goal: ⋯.LiftStruct

full_name: CategoryTheory.CommSq.LiftStruct.opEquiv_apply
code: /-- Equivalences of `LiftStruct` for a square and the corresponding square
in the opposite category. -/
@[simps]
def opEquiv (sq : CommSq f i p g) : LiftStruct sq ≃ LiftStruct sq.op 
goal: (CategoryTheory.CommSq.LiftStruct.opEquiv sq) l = l.op

full_name: CategoryTheory.CommSq.LiftStruct.opEquiv
code: /-- Equivalences of `LiftStruct` for a square and the corresponding square
in the opposite category. -/
@[simps]
def opEquiv (sq : CommSq f i p g) : LiftStruct sq ≃ LiftStruct sq.op 
goal: sq.LiftStruct ≃ ⋯.LiftStruct

full_name: CategoryTheory.CommSq.LiftStruct.opEquiv_symm_apply
code: /-- Equivalences of `LiftStruct` for a square and the corresponding square
in the opposite category. -/
@[simps]
def opEquiv (sq : CommSq f i p g) : LiftStruct sq ≃ LiftStruct sq.op 
goal: (CategoryTheory.CommSq.LiftStruct.opEquiv sq).symm l = l.unop

full_name: CategoryTheory.CommSq.LiftStruct.unopEquiv
code: /-- Equivalences of `LiftStruct` for a square in the oppositive category and
the corresponding square in the original category. -/
def unopEquiv {A B X Y : Cᵒᵖ} {f : A ⟶ X} {i : A ⟶ B} {p : X ⟶ Y} {g : B ⟶ Y}
    (sq : CommSq f i p g) : LiftStruct sq ≃ LiftStruct sq.unop 
goal: sq.LiftStruct ≃ ⋯.LiftStruct

full_name: CategoryTheory.CommSq.subsingleton_liftStruct_of_epi
code: instance subsingleton_liftStruct_of_epi (sq : CommSq f i p g) [Epi i] :
    Subsingleton (LiftStruct sq) 
goal: Subsingleton sq.LiftStruct

full_name: CategoryTheory.CommSq.subsingleton_liftStruct_of_mono
code: instance subsingleton_liftStruct_of_mono (sq : CommSq f i p g) [Mono p] :
    Subsingleton (LiftStruct sq) 
goal: Subsingleton sq.LiftStruct

full_name: CategoryTheory.CommSq.HasLift
code: /-- The assertion that a square has a `LiftStruct`. -/
class HasLift : Prop where
  /-- Square has a `LiftStruct`. -/
  exists_lift : Nonempty sq.LiftStruct
goal: Prop

full_name: CategoryTheory.CommSq.HasLift.exists_lift
code: /-- The assertion that a square has a `LiftStruct`. -/
class HasLift : Prop where
  /-- Square has a `LiftStruct`. -/
  exists_lift : Nonempty sq.LiftStruct
goal: Nonempty sq.LiftStruct

full_name: CategoryTheory.CommSq.HasLift.mk'
code: theorem mk' (l : sq.LiftStruct) : HasLift sq 
goal: sq.HasLift

full_name: CategoryTheory.CommSq.HasLift.iff
code: theorem iff : HasLift sq ↔ Nonempty sq.LiftStruct 
goal: sq.HasLift ↔ Nonempty sq.LiftStruct

full_name: CategoryTheory.CommSq.HasLift.iff_op
code: theorem iff_op : HasLift sq ↔ HasLift sq.op 
goal: sq.HasLift ↔ ⋯.HasLift

full_name: CategoryTheory.CommSq.HasLift.iff_unop
code: theorem iff_unop {A B X Y : Cᵒᵖ} {f : A ⟶ X} {i : A ⟶ B} {p : X ⟶ Y} {g : B ⟶ Y}
    (sq : CommSq f i p g) : HasLift sq ↔ HasLift sq.unop 
goal: sq.HasLift ↔ ⋯.HasLift

full_name: CategoryTheory.CommSq.lift
code: /-- A choice of a diagonal morphism that is part of a `LiftStruct` when
the square has a lift. -/
noncomputable def lift [hsq : HasLift sq] : B ⟶ X 
goal: B ⟶ X

full_name: CategoryTheory.CommSq.fac_left
code: @[reassoc (attr := simp)]
theorem fac_left [hsq : HasLift sq] : i ≫ sq.lift = f 
goal: CategoryTheory.CategoryStruct.comp i sq.lift = f

full_name: CategoryTheory.CommSq.fac_right
code: @[reassoc (attr := simp)]
theorem fac_right [hsq : HasLift sq] : sq.lift ≫ p = g 
goal: CategoryTheory.CategoryStruct.comp sq.lift p = g