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

tactic: dsimp at comm
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
x y : Pseudoelement P
a a' : Over P
h : pseudoApply f (Quotient.mk (setoid P) a) = pseudoApply f (Quotient.mk (setoid P) a')
R : C
p : R ⟶ ((fun g => app f g) a).left
q : R ⟶ ((fun g => app f g) a').left
ep : Epi p
w✝ : Epi q
comm : p ≫ ((fun g => app f g) a).hom = q ≫ ((fun g => app f g) a').hom
a'' : R ⟶ P := p ≫ a.hom - q ≫ a'.hom
⊢ Quotient.mk (setoid Q) (Over.mk (a'' ≫ f)) = Quotient.mk (setoid Q) (Over.mk 0)

tactic: simp [sub_eq_zero.2 comm]
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
x y : Pseudoelement P
a a' : Over P
h : pseudoApply f (Quotient.mk (setoid P) a) = pseudoApply f (Quotient.mk (setoid P) a')
R : C
p : R ⟶ ((fun g => app f g) a).left
q : R ⟶ ((fun g => app f g) a').left
ep : Epi p
w✝ : Epi q
comm : p ≫ a.hom ≫ f = q ≫ a'.hom ≫ f
a'' : R ⟶ P := p ≫ a.hom - q ≫ a'.hom
⊢ Quotient.mk (setoid Q) (Over.mk (a'' ≫ f)) = Quotient.mk (setoid Q) (Over.mk 0)

tactic: obtain ⟨X, p', q', ep', _, comm'⟩ := Quotient.exact hh
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
x y : Pseudoelement P
a a' : Over P
h : pseudoApply f (Quotient.mk (setoid P) a) = pseudoApply f (Quotient.mk (setoid P) a')
R : C
p : R ⟶ ((fun g => app f g) a).left
q : R ⟶ ((fun g => app f g) a').left
ep : Epi p
w✝ : Epi q
comm : p ≫ ((fun g => app f g) a).hom = q ≫ ((fun g => app f g) a').hom
a'' : R ⟶ P := p ≫ a.hom - q ≫ a'.hom
Z : C
g : P ⟶ Z
hh : pseudoApply g (Quotient.mk (setoid P) a') = 0
⊢ pseudoApply g (Quot.mk (PseudoEqual P) (Over.mk a'')) = pseudoApply g (Quotient.mk (setoid P) a)

tactic: have : a'.hom ≫ g = 0 := by
  apply (epi_iff_cancel_zero _).1 ep' _ (a'.hom ≫ g)
  simpa using comm'
state_before: case intro.intro.intro.intro.intro
C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
x y : Pseudoelement P
a a' : Over P
h : pseudoApply f (Quotient.mk (setoid P) a) = pseudoApply f (Quotient.mk (setoid P) a')
R : C
p : R ⟶ ((fun g => app f g) a).left
q : R ⟶ ((fun g => app f g) a').left
ep : Epi p
w✝¹ : Epi q
comm : p ≫ ((fun g => app f g) a).hom = q ≫ ((fun g => app f g) a').hom
a'' : R ⟶ P := p ≫ a.hom - q ≫ a'.hom
Z : C
g : P ⟶ Z
hh : pseudoApply g (Quotient.mk (setoid P) a') = 0
X : C
p' : X ⟶ ((fun g_1 => app g g_1) a').left
q' : X ⟶ (Over.mk 0).left
ep' : Epi p'
w✝ : Epi q'
comm' : p' ≫ ((fun g_1 => app g g_1) a').hom = q' ≫ (Over.mk 0).hom
⊢ pseudoApply g (Quot.mk (PseudoEqual P) (Over.mk a'')) = pseudoApply g (Quotient.mk (setoid P) a)

tactic: apply Quotient.sound
state_before: case intro.intro.intro.intro.intro
C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
x y : Pseudoelement P
a a' : Over P
h : pseudoApply f (Quotient.mk (setoid P) a) = pseudoApply f (Quotient.mk (setoid P) a')
R : C
p : R ⟶ ((fun g => app f g) a).left
q : R ⟶ ((fun g => app f g) a').left
ep : Epi p
w✝¹ : Epi q
comm : p ≫ ((fun g => app f g) a).hom = q ≫ ((fun g => app f g) a').hom
a'' : R ⟶ P := p ≫ a.hom - q ≫ a'.hom
Z : C
g : P ⟶ Z
hh : pseudoApply g (Quotient.mk (setoid P) a') = 0
X : C
p' : X ⟶ ((fun g_1 => app g g_1) a').left
q' : X ⟶ (Over.mk 0).left
ep' : Epi p'
w✝ : Epi q'
comm' : p' ≫ ((fun g_1 => app g g_1) a').hom = q' ≫ (Over.mk 0).hom
this : a'.hom ≫ g = 0
⊢ pseudoApply g (Quot.mk (PseudoEqual P) (Over.mk a'')) = pseudoApply g (Quotient.mk (setoid P) a)

tactic: change app g (a'' : Over P) ≈ app g a
state_before: case intro.intro.intro.intro.intro.a
C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
x y : Pseudoelement P
a a' : Over P
h : pseudoApply f (Quotient.mk (setoid P) a) = pseudoApply f (Quotient.mk (setoid P) a')
R : C
p : R ⟶ ((fun g => app f g) a).left
q : R ⟶ ((fun g => app f g) a').left
ep : Epi p
w✝¹ : Epi q
comm : p ≫ ((fun g => app f g) a).hom = q ≫ ((fun g => app f g) a').hom
a'' : R ⟶ P := p ≫ a.hom - q ≫ a'.hom
Z : C
g : P ⟶ Z
hh : pseudoApply g (Quotient.mk (setoid P) a') = 0
X : C
p' : X ⟶ ((fun g_1 => app g g_1) a').left
q' : X ⟶ (Over.mk 0).left
ep' : Epi p'
w✝ : Epi q'
comm' : p' ≫ ((fun g_1 => app g g_1) a').hom = q' ≫ (Over.mk 0).hom
this : a'.hom ≫ g = 0
⊢ (fun g_1 => app g g_1) (Over.mk a'') ≈ (fun g_1 => app g g_1) a

tactic: exact ⟨R, 𝟙 R, p, inferInstance, ep, by simp [sub_eq_add_neg, this]⟩
state_before: case intro.intro.intro.intro.intro.a
C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
x y : Pseudoelement P
a a' : Over P
h : pseudoApply f (Quotient.mk (setoid P) a) = pseudoApply f (Quotient.mk (setoid P) a')
R : C
p : R ⟶ ((fun g => app f g) a).left
q : R ⟶ ((fun g => app f g) a').left
ep : Epi p
w✝¹ : Epi q
comm : p ≫ ((fun g => app f g) a).hom = q ≫ ((fun g => app f g) a').hom
a'' : R ⟶ P := p ≫ a.hom - q ≫ a'.hom
Z : C
g : P ⟶ Z
hh : pseudoApply g (Quotient.mk (setoid P) a') = 0
X : C
p' : X ⟶ ((fun g_1 => app g g_1) a').left
q' : X ⟶ (Over.mk 0).left
ep' : Epi p'
w✝ : Epi q'
comm' : p' ≫ ((fun g_1 => app g g_1) a').hom = q' ≫ (Over.mk 0).hom
this : a'.hom ≫ g = 0
⊢ app g (Over.mk a'') ≈ app g a

tactic: apply (epi_iff_cancel_zero _).1 ep' _ (a'.hom ≫ g)
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
x y : Pseudoelement P
a a' : Over P
h : pseudoApply f (Quotient.mk (setoid P) a) = pseudoApply f (Quotient.mk (setoid P) a')
R : C
p : R ⟶ ((fun g => app f g) a).left
q : R ⟶ ((fun g => app f g) a').left
ep : Epi p
w✝¹ : Epi q
comm : p ≫ ((fun g => app f g) a).hom = q ≫ ((fun g => app f g) a').hom
a'' : R ⟶ P := p ≫ a.hom - q ≫ a'.hom
Z : C
g : P ⟶ Z
hh : pseudoApply g (Quotient.mk (setoid P) a') = 0
X : C
p' : X ⟶ ((fun g_1 => app g g_1) a').left
q' : X ⟶ (Over.mk 0).left
ep' : Epi p'
w✝ : Epi q'
comm' : p' ≫ ((fun g_1 => app g g_1) a').hom = q' ≫ (Over.mk 0).hom
⊢ a'.hom ≫ g = 0

tactic: simpa using comm'
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
x y : Pseudoelement P
a a' : Over P
h : pseudoApply f (Quotient.mk (setoid P) a) = pseudoApply f (Quotient.mk (setoid P) a')
R : C
p : R ⟶ ((fun g => app f g) a).left
q : R ⟶ ((fun g => app f g) a').left
ep : Epi p
w✝¹ : Epi q
comm : p ≫ ((fun g => app f g) a).hom = q ≫ ((fun g => app f g) a').hom
a'' : R ⟶ P := p ≫ a.hom - q ≫ a'.hom
Z : C
g : P ⟶ Z
hh : pseudoApply g (Quotient.mk (setoid P) a') = 0
X : C
p' : X ⟶ ((fun g_1 => app g g_1) a').left
q' : X ⟶ (Over.mk 0).left
ep' : Epi p'
w✝ : Epi q'
comm' : p' ≫ ((fun g_1 => app g g_1) a').hom = q' ≫ (Over.mk 0).hom
⊢ p' ≫ a'.hom ≫ g = 0

tactic: simp [sub_eq_add_neg, this]
state_before: C : Type u
inst✝¹ : Category C
inst✝ : Abelian C
P Q : C
f : P ⟶ Q
x y : Pseudoelement P
a a' : Over P
h : pseudoApply f (Quotient.mk (setoid P) a) = pseudoApply f (Quotient.mk (setoid P) a')
R : C
p : R ⟶ ((fun g => app f g) a).left
q : R ⟶ ((fun g => app f g) a').left
ep : Epi p
w✝¹ : Epi q
comm : p ≫ ((fun g => app f g) a).hom = q ≫ ((fun g => app f g) a').hom
a'' : R ⟶ P := p ≫ a.hom - q ≫ a'.hom
Z : C
g : P ⟶ Z
hh : pseudoApply g (Quotient.mk (setoid P) a') = 0
X : C
p' : X ⟶ ((fun g_1 => app g g_1) a').left
q' : X ⟶ (Over.mk 0).left
ep' : Epi p'
w✝ : Epi q'
comm' : p' ≫ ((fun g_1 => app g g_1) a').hom = q' ≫ (Over.mk 0).hom
this : a'.hom ≫ g = 0
⊢ 𝟙 R ≫ (app g (Over.mk a'')).hom = p ≫ (app g a).hom