Theorem: CategoryTheory.Abelian.Pseudoelement.epi_of_pseudo_surjective
File: Mathlib/CategoryTheory/Abelian/Pseudoelements.lean

tactic: intro h
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
⊢ Function.Surjective (pseudoApply f) → Epi f

tactic: have ⟨pbar, hpbar⟩ := h (𝟙 Q)
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
h : Function.Surjective (pseudoApply f)
⊢ Epi f

tactic: have ⟨p, hp⟩ := Quotient.exists_rep pbar
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
h : Function.Surjective (pseudoApply f)
pbar : Pseudoelement P
hpbar : pseudoApply f pbar = Quot.mk (PseudoEqual Q) (Over.mk (𝟙 Q))
⊢ Epi f

tactic: have : ⟦(p.hom ≫ f : Over Q)⟧ = ⟦↑(𝟙 Q)⟧ := by
  rw [← hp] at hpbar
  exact hpbar
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
h : Function.Surjective (pseudoApply f)
pbar : Pseudoelement P
hpbar : pseudoApply f pbar = Quot.mk (PseudoEqual Q) (Over.mk (𝟙 Q))
p : Over P
hp : Quotient.mk (setoid P) p = pbar
⊢ Epi f

tactic: have ⟨R, x, y, _, ey, comm⟩ := Quotient.exact this
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
h : Function.Surjective (pseudoApply f)
pbar : Pseudoelement P
hpbar : pseudoApply f pbar = Quot.mk (PseudoEqual Q) (Over.mk (𝟙 Q))
p : Over P
hp : Quotient.mk (setoid P) p = pbar
this : Quotient.mk (setoid Q) (Over.mk (p.hom ≫ f)) = Quotient.mk (setoid Q) (Over.mk (𝟙 Q))
⊢ Epi f

tactic: apply @epi_of_epi_fac _ _ _ _ _ (x ≫ p.hom) f y ey
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
h : Function.Surjective (pseudoApply f)
pbar : Pseudoelement P
hpbar : pseudoApply f pbar = Quot.mk (PseudoEqual Q) (Over.mk (𝟙 Q))
p : Over P
hp : Quotient.mk (setoid P) p = pbar
this : Quotient.mk (setoid Q) (Over.mk (p.hom ≫ f)) = Quotient.mk (setoid Q) (Over.mk (𝟙 Q))
R : C
x : R ⟶ (Over.mk (p.hom ≫ f)).left
y : R ⟶ (Over.mk (𝟙 Q)).left
w✝ : Epi x
ey : Epi y
comm : x ≫ (Over.mk (p.hom ≫ f)).hom = y ≫ (Over.mk (𝟙 Q)).hom
⊢ Epi f

tactic: dsimp at comm
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
h : Function.Surjective (pseudoApply f)
pbar : Pseudoelement P
hpbar : pseudoApply f pbar = Quot.mk (PseudoEqual Q) (Over.mk (𝟙 Q))
p : Over P
hp : Quotient.mk (setoid P) p = pbar
this : Quotient.mk (setoid Q) (Over.mk (p.hom ≫ f)) = Quotient.mk (setoid Q) (Over.mk (𝟙 Q))
R : C
x : R ⟶ (Over.mk (p.hom ≫ f)).left
y : R ⟶ (Over.mk (𝟙 Q)).left
w✝ : Epi x
ey : Epi y
comm : x ≫ (Over.mk (p.hom ≫ f)).hom = y ≫ (Over.mk (𝟙 Q)).hom
⊢ (x ≫ p.hom) ≫ f = y

tactic: rw [Category.assoc, comm]
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
h : Function.Surjective (pseudoApply f)
pbar : Pseudoelement P
hpbar : pseudoApply f pbar = Quot.mk (PseudoEqual Q) (Over.mk (𝟙 Q))
p : Over P
hp : Quotient.mk (setoid P) p = pbar
this : Quotient.mk (setoid Q) (Over.mk (p.hom ≫ f)) = Quotient.mk (setoid Q) (Over.mk (𝟙 Q))
R : C
x : R ⟶ (Over.mk (p.hom ≫ f)).left
y : R ⟶ (Over.mk (𝟙 Q)).left
w✝ : Epi x
ey : Epi y
comm : x ≫ p.hom ≫ f = y ≫ 𝟙 Q
⊢ (x ≫ p.hom) ≫ f = y

tactic: apply Category.comp_id
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
h : Function.Surjective (pseudoApply f)
pbar : Pseudoelement P
hpbar : pseudoApply f pbar = Quot.mk (PseudoEqual Q) (Over.mk (𝟙 Q))
p : Over P
hp : Quotient.mk (setoid P) p = pbar
this : Quotient.mk (setoid Q) (Over.mk (p.hom ≫ f)) = Quotient.mk (setoid Q) (Over.mk (𝟙 Q))
R : C
x : R ⟶ (Over.mk (p.hom ≫ f)).left
y : R ⟶ (Over.mk (𝟙 Q)).left
w✝ : Epi x
ey : Epi y
comm : x ≫ p.hom ≫ f = y ≫ 𝟙 Q
⊢ y ≫ 𝟙 Q = y

tactic: rw [← hp] at hpbar
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
h : Function.Surjective (pseudoApply f)
pbar : Pseudoelement P
hpbar : pseudoApply f pbar = Quot.mk (PseudoEqual Q) (Over.mk (𝟙 Q))
p : Over P
hp : Quotient.mk (setoid P) p = pbar
⊢ Quotient.mk ?m.415411 (Over.mk (p.hom ≫ f)) = Quotient.mk ?m.415411 (Over.mk (𝟙 Q))

tactic: exact hpbar
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
h : Function.Surjective (pseudoApply f)
pbar : Pseudoelement P
hpbar✝ : pseudoApply f pbar = Quot.mk (PseudoEqual Q) (Over.mk (𝟙 Q))
p : Over P
hpbar : pseudoApply f (Quotient.mk (setoid P) p) = Quot.mk (PseudoEqual Q) (Over.mk (𝟙 Q))
hp : Quotient.mk (setoid P) p = pbar
⊢ Quotient.mk (?m.445621 hp) (Over.mk (p.hom ≫ f)) = Quotient.mk (?m.445621 hp) (Over.mk (𝟙 Q))