-- Mathlib/CategoryTheory/Localization/CalculusOfFractions/Fractions.lean
lemma exists_leftFraction₂ {X Y : C} (f f' : L.obj X ⟶ L.obj Y) :
    ∃ (φ : W.LeftFraction₂ X Y), f = φ.fst.map L (inverts L W) ∧
      f' = φ.snd.map L (inverts L W)

Proof state:
C : Type u_1
D : Type u_2
inst✝³ : Category.{u_4, u_1} C
inst✝² : Category.{u_3, u_2} D
L : C ⥤ D
W : MorphismProperty C
inst✝¹ : L.IsLocalization W
inst✝ : W.HasLeftCalculusOfFractions
X Y : C
f f' : L.obj X ⟶ L.obj Y
φ : W.LeftFraction X Y
hφ : f = φ.map L ⋯
φ' : W.LeftFraction X Y
hφ' : f' = φ'.map L ⋯
α : W.LeftFraction φ.Y' φ'.Y'
hα : (RightFraction.mk φ.s ⋯ φ'.s).f ≫ α.s = (RightFraction.mk φ.s ⋯ φ'.s).s ≫ α.f
ψ : W.LeftFraction₂ X Y := LeftFraction₂.mk (φ.f ≫ α.f) (φ'.f ≫ α.s) (φ'.s ≫ α.s) ⋯
this✝ : IsIso (L.map φ'.s)
this : IsIso (L.map α.s)
⊢ IsIso (L.map φ'.s ≫ L.map α.s)

Tactic:
infer_instance

Result:
no goals

Proof state:
case intro
C : Type u_1
D : Type u_2
inst✝³ : Category.{u_4, u_1} C
inst✝² : Category.{u_3, u_2} D
L : C ⥤ D
W : MorphismProperty C
inst✝¹ : L.IsLocalization W
inst✝ : W.HasLeftCalculusOfFractions
X Y : C
f f' : L.obj X ⟶ L.obj Y
φ : W.LeftFraction X Y
hφ : f = φ.map L ⋯
φ' : W.LeftFraction X Y
hφ' : f' = φ'.map L ⋯
α : W.LeftFraction φ.Y' φ'.Y'
hα : (RightFraction.mk φ.s ⋯ φ'.s).f ≫ α.s = (RightFraction.mk φ.s ⋯ φ'.s).s ≫ α.f
ψ : W.LeftFraction₂ X Y := LeftFraction₂.mk (φ.f ≫ α.f) (φ'.f ≫ α.s) (φ'.s ≫ α.s) ⋯
this✝¹ : IsIso (L.map φ'.s)
this✝ : IsIso (L.map α.s)
this : IsIso (L.map (φ'.s ≫ α.s))
⊢ ∃ φ, f = φ.fst.map L ⋯ ∧ f' = φ.snd.map L ⋯

Tactic:
refine ⟨ψ, ?_, ?_⟩

Result:
case intro.refine_1
C : Type u_1
D : Type u_2
inst✝³ : Category.{u_4, u_1} C
inst✝² : Category.{u_3, u_2} D
L : C ⥤ D
W : MorphismProperty C
inst✝¹ : L.IsLocalization W
inst✝ : W.HasLeftCalculusOfFractions
X Y : C
f f' : L.obj X ⟶ L.obj Y
φ : W.LeftFraction X Y
hφ : f = φ.map L ⋯
φ' : W.LeftFraction X Y
hφ' : f' = φ'.map L ⋯
α : W.LeftFraction φ.Y' φ'.Y'
hα : (RightFraction.mk φ.s ⋯ φ'.s).f ≫ α.s = (RightFraction.mk φ.s ⋯ φ'.s).s ≫ α.f
ψ : W.LeftFraction₂ X Y := LeftFraction₂.mk (φ.f ≫ α.f) (φ'.f ≫ α.s) (φ'.s ≫ α.s) ⋯
this✝¹ : IsIso (L.map φ'.s)
this✝ : IsIso (L.map α.s)
this : IsIso (L.map (φ'.s ≫ α.s))
⊢ f = ψ.fst.map L ⋯

case intro.refine_2
C : Type u_1
D : Type u_2
inst✝³ : Category.{u_4, u_1} C
inst✝² : Category.{u_3, u_2} D
L : C ⥤ D
W : MorphismProperty C
inst✝¹ : L.IsLocalization W
inst✝ : W.HasLeftCalculusOfFractions
X Y : C
f f' : L.obj X ⟶ L.obj Y
φ : W.LeftFraction X Y
hφ : f = φ.map L ⋯
φ' : W.LeftFraction X Y
hφ' : f' = φ'.map L ⋯
α : W.LeftFraction φ.Y' φ'.Y'
hα : (RightFraction.mk φ.s ⋯ φ'.s).f ≫ α.s = (RightFraction.mk φ.s ⋯ φ'.s).s ≫ α.f
ψ : W.LeftFraction₂ X Y := LeftFraction₂.mk (φ.f ≫ α.f) (φ'.f ≫ α.s) (φ'.s ≫ α.s) ⋯
this✝¹ : IsIso (L.map φ'.s)
this✝ : IsIso (L.map α.s)
this : IsIso (L.map (φ'.s ≫ α.s))
⊢ f' = ψ.snd.map L ⋯

Proof state:
case intro.refine_1
C : Type u_1
D : Type u_2
inst✝³ : Category.{u_4, u_1} C
inst✝² : Category.{u_3, u_2} D
L : C ⥤ D
W : MorphismProperty C
inst✝¹ : L.IsLocalization W
inst✝ : W.HasLeftCalculusOfFractions
X Y : C
f f' : L.obj X ⟶ L.obj Y
φ : W.LeftFraction X Y
hφ : f = φ.map L ⋯
φ' : W.LeftFraction X Y
hφ' : f' = φ'.map L ⋯
α : W.LeftFraction φ.Y' φ'.Y'
hα : (RightFraction.mk φ.s ⋯ φ'.s).f ≫ α.s = (RightFraction.mk φ.s ⋯ φ'.s).s ≫ α.f
ψ : W.LeftFraction₂ X Y := LeftFraction₂.mk (φ.f ≫ α.f) (φ'.f ≫ α.s) (φ'.s ≫ α.s) ⋯
this✝¹ : IsIso (L.map φ'.s)
this✝ : IsIso (L.map α.s)
this : IsIso (L.map (φ'.s ≫ α.s))
⊢ f = ψ.fst.map L ⋯

Tactic:
rw [← cancel_mono (L.map (φ'.s ≫ α.s)), LeftFraction.map_comp_map_s,
  hα, L.map_comp, hφ, LeftFraction.map_comp_map_s_assoc,
  L.map_comp]

Result:
no goals

Proof state:
case intro.refine_2
C : Type u_1
D : Type u_2
inst✝³ : Category.{u_4, u_1} C
inst✝² : Category.{u_3, u_2} D
L : C ⥤ D
W : MorphismProperty C
inst✝¹ : L.IsLocalization W
inst✝ : W.HasLeftCalculusOfFractions
X Y : C
f f' : L.obj X ⟶ L.obj Y
φ : W.LeftFraction X Y
hφ : f = φ.map L ⋯
φ' : W.LeftFraction X Y
hφ' : f' = φ'.map L ⋯
α : W.LeftFraction φ.Y' φ'.Y'
hα : (RightFraction.mk φ.s ⋯ φ'.s).f ≫ α.s = (RightFraction.mk φ.s ⋯ φ'.s).s ≫ α.f
ψ : W.LeftFraction₂ X Y := LeftFraction₂.mk (φ.f ≫ α.f) (φ'.f ≫ α.s) (φ'.s ≫ α.s) ⋯
this✝¹ : IsIso (L.map φ'.s)
this✝ : IsIso (L.map α.s)
this : IsIso (L.map (φ'.s ≫ α.s))
⊢ f' = ψ.snd.map L ⋯

Tactic:
rw [← cancel_mono (L.map (φ'.s ≫ α.s)), hφ']

Result:
case intro.refine_2
C : Type u_1
D : Type u_2
inst✝³ : Category.{u_4, u_1} C
inst✝² : Category.{u_3, u_2} D
L : C ⥤ D
W : MorphismProperty C
inst✝¹ : L.IsLocalization W
inst✝ : W.HasLeftCalculusOfFractions
X Y : C
f f' : L.obj X ⟶ L.obj Y
φ : W.LeftFraction X Y
hφ : f = φ.map L ⋯
φ' : W.LeftFraction X Y
hφ' : f' = φ'.map L ⋯
α : W.LeftFraction φ.Y' φ'.Y'
hα : (RightFraction.mk φ.s ⋯ φ'.s).f ≫ α.s = (RightFraction.mk φ.s ⋯ φ'.s).s ≫ α.f
ψ : W.LeftFraction₂ X Y := LeftFraction₂.mk (φ.f ≫ α.f) (φ'.f ≫ α.s) (φ'.s ≫ α.s) ⋯
this✝¹ : IsIso (L.map φ'.s)
this✝ : IsIso (L.map α.s)
this : IsIso (L.map (φ'.s ≫ α.s))
⊢ φ'.map L ⋯ ≫ L.map (φ'.s ≫ α.s) = ψ.snd.map L ⋯ ≫ L.map (φ'.s ≫ α.s)

Proof state:
C : Type u_1
D : Type u_2
inst✝³ : Category.{u_4, u_1} C
inst✝² : Category.{u_3, u_2} D
L : C ⥤ D
W : MorphismProperty C
inst✝¹ : L.IsLocalization W
inst✝ : W.HasLeftCalculusOfFractions
X Y : C
f f' : L.obj X ⟶ L.obj Y
⊢ ∃ φ, f = φ.fst.map L ⋯ ∧ f' = φ.snd.map L ⋯

Tactic:
have ⟨φ, hφ⟩ := exists_leftFraction L W f

Result:
C : Type u_1
D : Type u_2
inst✝³ : Category.{u_4, u_1} C
inst✝² : Category.{u_3, u_2} D
L : C ⥤ D
W : MorphismProperty C
inst✝¹ : L.IsLocalization W
inst✝ : W.HasLeftCalculusOfFractions
X Y : C
f f' : L.obj X ⟶ L.obj Y
φ : W.LeftFraction X Y
hφ : f = φ.map L ⋯
⊢ ∃ φ, f = φ.fst.map L ⋯ ∧ f' = φ.snd.map L ⋯

Proof state:
case intro
C : Type u_1
D : Type u_2
inst✝³ : Category.{u_4, u_1} C
inst✝² : Category.{u_3, u_2} D
L : C ⥤ D
W : MorphismProperty C
inst✝¹ : L.IsLocalization W
inst✝ : W.HasLeftCalculusOfFractions
X Y : C
f f' : L.obj X ⟶ L.obj Y
φ : W.LeftFraction X Y
hφ : f = φ.map L ⋯
φ' : W.LeftFraction X Y
hφ' : f' = φ'.map L ⋯
α : W.LeftFraction φ.Y' φ'.Y'
hα : (RightFraction.mk φ.s ⋯ φ'.s).f ≫ α.s = (RightFraction.mk φ.s ⋯ φ'.s).s ≫ α.f
⊢ ∃ φ, f = φ.fst.map L ⋯ ∧ f' = φ.snd.map L ⋯

Tactic:
let ψ : W.LeftFraction₂ X Y :=
  { Y' := α.Y'
    f := φ.f ≫ α.f
    f' := φ'.f ≫ α.s
    s := φ'.s ≫ α.s
    hs := W.comp_mem _ _ φ'.hs α.hs }

Result:
case intro
C : Type u_1
D : Type u_2
inst✝³ : Category.{u_4, u_1} C
inst✝² : Category.{u_3, u_2} D
L : C ⥤ D
W : MorphismProperty C
inst✝¹ : L.IsLocalization W
inst✝ : W.HasLeftCalculusOfFractions
X Y : C
f f' : L.obj X ⟶ L.obj Y
φ : W.LeftFraction X Y
hφ : f = φ.map L ⋯
φ' : W.LeftFraction X Y
hφ' : f' = φ'.map L ⋯
α : W.LeftFraction φ.Y' φ'.Y'
hα : (RightFraction.mk φ.s ⋯ φ'.s).f ≫ α.s = (RightFraction.mk φ.s ⋯ φ'.s).s ≫ α.f
ψ : W.LeftFraction₂ X Y := LeftFraction₂.mk (φ.f ≫ α.f) (φ'.f ≫ α.s) (φ'.s ≫ α.s) ⋯
⊢ ∃ φ, f = φ.fst.map L ⋯ ∧ f' = φ.snd.map L ⋯

Proof state:
C : Type u_1
D : Type u_2
inst✝³ : Category.{u_4, u_1} C
inst✝² : Category.{u_3, u_2} D
L : C ⥤ D
W : MorphismProperty C
inst✝¹ : L.IsLocalization W
inst✝ : W.HasLeftCalculusOfFractions
X Y : C
f f' : L.obj X ⟶ L.obj Y
φ : W.LeftFraction X Y
hφ : f = φ.map L ⋯
⊢ ∃ φ, f = φ.fst.map L ⋯ ∧ f' = φ.snd.map L ⋯

Tactic:
have ⟨φ', hφ'⟩ := exists_leftFraction L W f'

Result:
C : Type u_1
D : Type u_2
inst✝³ : Category.{u_4, u_1} C
inst✝² : Category.{u_3, u_2} D
L : C ⥤ D
W : MorphismProperty C
inst✝¹ : L.IsLocalization W
inst✝ : W.HasLeftCalculusOfFractions
X Y : C
f f' : L.obj X ⟶ L.obj Y
φ : W.LeftFraction X Y
hφ : f = φ.map L ⋯
φ' : W.LeftFraction X Y
hφ' : f' = φ'.map L ⋯
⊢ ∃ φ, f = φ.fst.map L ⋯ ∧ f' = φ.snd.map L ⋯