Module docstring
{"# Retracts
Defines retracts of objects and morphisms.
"}
{"# Retracts
Defines retracts of objects and morphisms.
"}
CategoryTheory.Retract
      structure
     (X Y : C)
        
      CategoryTheory.Retract.map
      definition
     (F : C ⥤ D) : Retract (F.obj X) (F.obj Y)
        
      CategoryTheory.Retract.splitEpi
      definition
     : SplitEpi h.r
        /-- a retract determines a split epimorphism. -/
@[simps] def splitEpi : SplitEpi h.r where
  section_ := h.i
        CategoryTheory.Retract.splitMono
      definition
     : SplitMono h.i
        /-- a retract determines a split monomorphism. -/
@[simps] def splitMono : SplitMono h.i where
  retraction := h.r
        CategoryTheory.Retract.instIsSplitEpiR
      instance
     : IsSplitEpi h.r
        instance : IsSplitEpi h.r := ⟨⟨h.splitEpi⟩⟩
        CategoryTheory.Retract.instIsSplitMonoI
      instance
     : IsSplitMono h.i
        instance : IsSplitMono h.i := ⟨⟨h.splitMono⟩⟩
        CategoryTheory.Retract.refl
      definition
     : Retract X X
        /-- Any object is a retract of itself. -/
@[simps]
def refl : Retract X X where
  i := 𝟙 X
  r := 𝟙 X
        CategoryTheory.Retract.trans
      definition
     {Z : C} (h' : Retract Y Z) : Retract X Z
        /-- A retract of a retract is a retract. -/
@[simps]
def trans {Z : C} (h' : Retract Y Z) : Retract X Z where
  i := h.i ≫ h'.i
  r := h'.r ≫ h.r
        CategoryTheory.Retract.ofIso
      definition
     (e : X ≅ Y) : Retract X Y
        /-- If `e : X ≅ Y`, then `X` is a retract of `Y`. -/
def ofIso (e : X ≅ Y) : Retract X Y where
  i := e.hom
  r := e.inv
        CategoryTheory.RetractArrow
      abbrev
     {X Y Z W : C} (f : X ⟶ Y) (g : Z ⟶ W)
        /--
```
  X -------> Z -------> X
  |          |          |
  f          g          f
  |          |          |
  v          v          v
  Y -------> W -------> Y
```
A morphism `f : X ⟶ Y` is a retract of `g : Z ⟶ W` if there are morphisms `i : f ⟶ g`
and `r : g ⟶ f` in the arrow category such that `i ≫ r = 𝟙 f`. -/
abbrev RetractArrow {X Y Z W : C} (f : X ⟶ Y) (g : Z ⟶ W) := Retract (Arrow.mk f) (Arrow.mk g)
        CategoryTheory.RetractArrow.i_w
      theorem
     : h.i.left ≫ g = f ≫ h.i.right
        @[reassoc]
lemma i_w : h.i.left ≫ g = f ≫ h.i.right := h.i.w
        CategoryTheory.RetractArrow.r_w
      theorem
     : h.r.left ≫ f = g ≫ h.r.right
        @[reassoc]
lemma r_w : h.r.left ≫ f = g ≫ h.r.right := h.r.w
        CategoryTheory.RetractArrow.left
      definition
     : Retract X Z
        /-- The top of a retract diagram of morphisms determines a retract of objects. -/
@[simps!]
def left : Retract X Z := h.map Arrow.leftFunc
        CategoryTheory.RetractArrow.right
      definition
     : Retract Y W
        /-- The bottom of a retract diagram of morphisms determines a retract of objects. -/
@[simps!]
def right : Retract Y W := h.map Arrow.rightFunc
        CategoryTheory.RetractArrow.retract_left
      theorem
     : h.i.left ≫ h.r.left = 𝟙 X
        @[reassoc (attr := simp)]
lemma retract_left : h.i.left ≫ h.r.left = 𝟙 X := h.left.retract
        CategoryTheory.RetractArrow.retract_right
      theorem
     : h.i.right ≫ h.r.right = 𝟙 Y
        @[reassoc (attr := simp)]
lemma retract_right : h.i.right ≫ h.r.right = 𝟙 Y := h.right.retract
        CategoryTheory.RetractArrow.instIsSplitEpiLeftRArrow
      instance
     : IsSplitEpi h.r.left
        instance : IsSplitEpi h.r.left := ⟨⟨h.left.splitEpi⟩⟩
        CategoryTheory.RetractArrow.instIsSplitEpiRightRArrow
      instance
     : IsSplitEpi h.r.right
        instance : IsSplitEpi h.r.right := ⟨⟨h.right.splitEpi⟩⟩
        CategoryTheory.RetractArrow.instIsSplitMonoLeftIArrow
      instance
     : IsSplitMono h.i.left
        instance : IsSplitMono h.i.left := ⟨⟨h.left.splitMono⟩⟩
        CategoryTheory.RetractArrow.instIsSplitMonoRightIArrow
      instance
     : IsSplitMono h.i.right
        instance : IsSplitMono h.i.right := ⟨⟨h.right.splitMono⟩⟩
        CategoryTheory.Iso.retract
      definition
     {X Y : C} (e : X ≅ Y) : Retract X Y
        /-- If `X` is isomorphic to `Y`, then `X` is a retract of `Y`. -/
@[simps]
def retract {X Y : C} (e : X ≅ Y) : Retract X Y where
  i := e.hom
  r := e.inv