l3lab/ntp-mathlib huggingface dataset:
theorem addVal_eq_top_iff {a : R} : addVal R a = ⊤ ↔ a = 0 := by
  have hi := (Classical.choose_spec (exists_prime R)).irreducible
  constructor
  · contrapose
    

Proof state:
case mp
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a : R
hi : Irreducible (choose (_ : ∃ ϖ, Prime ϖ))
⊢ ¬a = 0 → ¬(addVal R) a = ⊤

Next tactic:
intro h
theorem addVal_eq_top_iff {a : R} : addVal R a = ⊤ ↔ a = 0 := by
  have hi := (Classical.choose_spec (exists_prime R)).irreducible
  constructor
  · contrapose
    intro h
    

Proof state:
case mp
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a : R
hi : Irreducible (choose (_ : ∃ ϖ, Prime ϖ))
h : ¬a = 0
⊢ ¬(addVal R) a = ⊤

Next tactic:
obtain ⟨n, ha⟩ := associated_pow_irreducible h hi
theorem addVal_eq_top_iff {a : R} : addVal R a = ⊤ ↔ a = 0 := by
  have hi := (Classical.choose_spec (exists_prime R)).irreducible
  constructor
  · contrapose
    intro h
    obtain ⟨n, ha⟩ := associated_pow_irreducible h hi
    

Proof state:
case mp.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a : R
hi : Irreducible (choose (_ : ∃ ϖ, Prime ϖ))
h : ¬a = 0
n : ℕ
ha : Associated a (choose (_ : ∃ ϖ, Prime ϖ) ^ n)
⊢ ¬(addVal R) a = ⊤

Next tactic:
obtain ⟨u, rfl⟩ := ha.symm
theorem addVal_eq_top_iff {a : R} : addVal R a = ⊤ ↔ a = 0 := by
  have hi := (Classical.choose_spec (exists_prime R)).irreducible
  constructor
  · contrapose
    intro h
    obtain ⟨n, ha⟩ := associated_pow_irreducible h hi
    obtain ⟨u, rfl⟩ := ha.symm
    

Proof state:
case mp.intro.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
hi : Irreducible (choose (_ : ∃ ϖ, Prime ϖ))
n : ℕ
u : Rˣ
h : ¬choose (_ : ∃ ϖ, Prime ϖ) ^ n * ↑u = 0
ha : Associated (choose (_ : ∃ ϖ, Prime ϖ) ^ n * ↑u) (choose (_ : ∃ ϖ, Prime ϖ) ^ n)
⊢ ¬(addVal R) (choose (_ : ∃ ϖ, Prime ϖ) ^ n * ↑u) = ⊤

Next tactic:
rw [mul_comm, addVal_def' u hi n]
theorem addVal_eq_top_iff {a : R} : addVal R a = ⊤ ↔ a = 0 := by
  have hi := (Classical.choose_spec (exists_prime R)).irreducible
  constructor
  · contrapose
    intro h
    obtain ⟨n, ha⟩ := associated_pow_irreducible h hi
    obtain ⟨u, rfl⟩ := ha.symm
    rw [mul_comm, addVal_def' u hi n]
    

Proof state:
case mp.intro.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
hi : Irreducible (choose (_ : ∃ ϖ, Prime ϖ))
n : ℕ
u : Rˣ
h : ¬choose (_ : ∃ ϖ, Prime ϖ) ^ n * ↑u = 0
ha : Associated (choose (_ : ∃ ϖ, Prime ϖ) ^ n * ↑u) (choose (_ : ∃ ϖ, Prime ϖ) ^ n)
⊢ ¬↑n = ⊤

Next tactic:
exact PartENat.natCast_ne_top _
theorem addVal_eq_top_iff {a : R} : addVal R a = ⊤ ↔ a = 0 := by
  have hi := (Classical.choose_spec (exists_prime R)).irreducible
  constructor
  · contrapose
    intro h
    obtain ⟨n, ha⟩ := associated_pow_irreducible h hi
    obtain ⟨u, rfl⟩ := ha.symm
    rw [mul_comm, addVal_def' u hi n]
    exact PartENat.natCast_ne_top _
  · 

Proof state:
case mpr
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a : R
hi : Irreducible (choose (_ : ∃ ϖ, Prime ϖ))
⊢ a = 0 → (addVal R) a = ⊤

Next tactic:
rintro rfl
theorem addVal_eq_top_iff {a : R} : addVal R a = ⊤ ↔ a = 0 := by
  have hi := (Classical.choose_spec (exists_prime R)).irreducible
  constructor
  · contrapose
    intro h
    obtain ⟨n, ha⟩ := associated_pow_irreducible h hi
    obtain ⟨u, rfl⟩ := ha.symm
    rw [mul_comm, addVal_def' u hi n]
    exact PartENat.natCast_ne_top _
  · rintro rfl
    

Proof state:
case mpr
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
hi : Irreducible (choose (_ : ∃ ϖ, Prime ϖ))
⊢ (addVal R) 0 = ⊤

Next tactic:
exact addVal_zero
theorem addVal_le_iff_dvd {a b : R} : addVal R a ≤ addVal R b ↔ a ∣ b := by
  

Proof state:
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a b : R
⊢ (addVal R) a ≤ (addVal R) b ↔ a ∣ b

Next tactic:
have hp := Classical.choose_spec (exists_prime R)
theorem addVal_le_iff_dvd {a b : R} : addVal R a ≤ addVal R b ↔ a ∣ b := by
  have hp := Classical.choose_spec (exists_prime R)
  

Proof state:
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a b : R
hp : Prime (choose (_ : ∃ ϖ, Prime ϖ))
⊢ (addVal R) a ≤ (addVal R) b ↔ a ∣ b

Next tactic:
constructor
theorem addVal_le_iff_dvd {a b : R} : addVal R a ≤ addVal R b ↔ a ∣ b := by
  have hp := Classical.choose_spec (exists_prime R)
  constructor <;> 

Proof state:
case mp
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a b : R
hp : Prime (choose (_ : ∃ ϖ, Prime ϖ))
⊢ (addVal R) a ≤ (addVal R) b → a ∣ b

Next tactic:
intro h
theorem addVal_le_iff_dvd {a b : R} : addVal R a ≤ addVal R b ↔ a ∣ b := by
  have hp := Classical.choose_spec (exists_prime R)
  constructor <;> 

Proof state:
case mpr
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a b : R
hp : Prime (choose (_ : ∃ ϖ, Prime ϖ))
⊢ a ∣ b → (addVal R) a ≤ (addVal R) b

Next tactic:
intro h
theorem addVal_le_iff_dvd {a b : R} : addVal R a ≤ addVal R b ↔ a ∣ b := by
  have hp := Classical.choose_spec (exists_prime R)
  constructor <;> intro h
  · 

Proof state:
case mp
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a b : R
hp : Prime (choose (_ : ∃ ϖ, Prime ϖ))
h : (addVal R) a ≤ (addVal R) b
⊢ a ∣ b

Next tactic:
by_cases ha0 : a = 0
theorem addVal_le_iff_dvd {a b : R} : addVal R a ≤ addVal R b ↔ a ∣ b := by
  have hp := Classical.choose_spec (exists_prime R)
  constructor <;> intro h
  · by_cases ha0 : a = 0
    · 

Proof state:
case pos
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a b : R
hp : Prime (choose (_ : ∃ ϖ, Prime ϖ))
h : (addVal R) a ≤ (addVal R) b
ha0 : a = 0
⊢ a ∣ b

Next tactic:
rw [ha0, addVal_zero, top_le_iff, addVal_eq_top_iff] at h
theorem addVal_le_iff_dvd {a b : R} : addVal R a ≤ addVal R b ↔ a ∣ b := by
  have hp := Classical.choose_spec (exists_prime R)
  constructor <;> intro h
  · by_cases ha0 : a = 0
    · rw [ha0, addVal_zero, top_le_iff, addVal_eq_top_iff] at h
      

Proof state:
case pos
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a b : R
hp : Prime (choose (_ : ∃ ϖ, Prime ϖ))
h : b = 0
ha0 : a = 0
⊢ a ∣ b

Next tactic:
rw [h]
theorem addVal_le_iff_dvd {a b : R} : addVal R a ≤ addVal R b ↔ a ∣ b := by
  have hp := Classical.choose_spec (exists_prime R)
  constructor <;> intro h
  · by_cases ha0 : a = 0
    · rw [ha0, addVal_zero, top_le_iff, addVal_eq_top_iff] at h
      rw [h]
      

Proof state:
case pos
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a b : R
hp : Prime (choose (_ : ∃ ϖ, Prime ϖ))
h : b = 0
ha0 : a = 0
⊢ a ∣ 0

Next tactic:
apply dvd_zero
theorem addVal_le_iff_dvd {a b : R} : addVal R a ≤ addVal R b ↔ a ∣ b := by
  have hp := Classical.choose_spec (exists_prime R)
  constructor <;> intro h
  · by_cases ha0 : a = 0
    · rw [ha0, addVal_zero, top_le_iff, addVal_eq_top_iff] at h
      rw [h]
      apply dvd_zero
    

Proof state:
case neg
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a b : R
hp : Prime (choose (_ : ∃ ϖ, Prime ϖ))
h : (addVal R) a ≤ (addVal R) b
ha0 : ¬a = 0
⊢ a ∣ b

Next tactic:
obtain ⟨n, ha⟩ := associated_pow_irreducible ha0 hp.irreducible
theorem addVal_le_iff_dvd {a b : R} : addVal R a ≤ addVal R b ↔ a ∣ b := by
  have hp := Classical.choose_spec (exists_prime R)
  constructor <;> intro h
  · by_cases ha0 : a = 0
    · rw [ha0, addVal_zero, top_le_iff, addVal_eq_top_iff] at h
      rw [h]
      apply dvd_zero
    obtain ⟨n, ha⟩ := associated_pow_irreducible ha0 hp.irreducible
    

Proof state:
case neg.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a b : R
hp : Prime (choose (_ : ∃ ϖ, Prime ϖ))
h : (addVal R) a ≤ (addVal R) b
ha0 : ¬a = 0
n : ℕ
ha : Associated a (choose (_ : ∃ ϖ, Prime ϖ) ^ n)
⊢ a ∣ b

Next tactic:
rw [addVal, addValuation_apply, addValuation_apply, multiplicity_le_multiplicity_iff] at h
theorem addVal_le_iff_dvd {a b : R} : addVal R a ≤ addVal R b ↔ a ∣ b := by
  have hp := Classical.choose_spec (exists_prime R)
  constructor <;> intro h
  · by_cases ha0 : a = 0
    · rw [ha0, addVal_zero, top_le_iff, addVal_eq_top_iff] at h
      rw [h]
      apply dvd_zero
    obtain ⟨n, ha⟩ := associated_pow_irreducible ha0 hp.irreducible
    rw [addVal, addValuation_apply, addValuation_apply, multiplicity_le_multiplicity_iff] at h
    

Proof state:
case neg.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a b : R
hp : Prime (choose (_ : ∃ ϖ, Prime ϖ))
h : ∀ (n : ℕ), choose (_ : ∃ ϖ, Prime ϖ) ^ n ∣ a → choose (_ : ∃ ϖ, Prime ϖ) ^ n ∣ b
ha0 : ¬a = 0
n : ℕ
ha : Associated a (choose (_ : ∃ ϖ, Prime ϖ) ^ n)
⊢ a ∣ b

Next tactic:
exact ha.dvd.trans (h n ha.symm.dvd)
theorem addVal_le_iff_dvd {a b : R} : addVal R a ≤ addVal R b ↔ a ∣ b := by
  have hp := Classical.choose_spec (exists_prime R)
  constructor <;> intro h
  · by_cases ha0 : a = 0
    · rw [ha0, addVal_zero, top_le_iff, addVal_eq_top_iff] at h
      rw [h]
      apply dvd_zero
    obtain ⟨n, ha⟩ := associated_pow_irreducible ha0 hp.irreducible
    rw [addVal, addValuation_apply, addValuation_apply, multiplicity_le_multiplicity_iff] at h
    exact ha.dvd.trans (h n ha.symm.dvd)
  · 

Proof state:
case mpr
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a b : R
hp : Prime (choose (_ : ∃ ϖ, Prime ϖ))
h : a ∣ b
⊢ (addVal R) a ≤ (addVal R) b

Next tactic:
rw [addVal, addValuation_apply, addValuation_apply]
theorem addVal_le_iff_dvd {a b : R} : addVal R a ≤ addVal R b ↔ a ∣ b := by
  have hp := Classical.choose_spec (exists_prime R)
  constructor <;> intro h
  · by_cases ha0 : a = 0
    · rw [ha0, addVal_zero, top_le_iff, addVal_eq_top_iff] at h
      rw [h]
      apply dvd_zero
    obtain ⟨n, ha⟩ := associated_pow_irreducible ha0 hp.irreducible
    rw [addVal, addValuation_apply, addValuation_apply, multiplicity_le_multiplicity_iff] at h
    exact ha.dvd.trans (h n ha.symm.dvd)
  · rw [addVal, addValuation_apply, addValuation_apply]
    

Proof state:
case mpr
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
a b : R
hp : Prime (choose (_ : ∃ ϖ, Prime ϖ))
h : a ∣ b
⊢ multiplicity (choose (_ : ∃ ϖ, Prime ϖ)) a ≤ multiplicity (choose (_ : ∃ ϖ, Prime ϖ)) b

Next tactic:
exact multiplicity_le_multiplicity_of_dvd_right h
instance (R : Type*) [CommRing R] [IsDomain R] [DiscreteValuationRing R] :
    IsHausdorff (maximalIdeal R) R where
  haus' x hx := by
    

Proof state:
R✝ : Type u_1
R : Type u_2
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
x : R
hx : ∀ (n : ℕ), x ≡ 0 [SMOD maximalIdeal R ^ n • ⊤]
⊢ x = 0

Next tactic:
obtain ⟨ϖ, hϖ⟩ := exists_irreducible R
instance (R : Type*) [CommRing R] [IsDomain R] [DiscreteValuationRing R] :
    IsHausdorff (maximalIdeal R) R where
  haus' x hx := by
    obtain ⟨ϖ, hϖ⟩ := exists_irreducible R
    

Proof state:
case intro
R✝ : Type u_1
R : Type u_2
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
x : R
hx : ∀ (n : ℕ), x ≡ 0 [SMOD maximalIdeal R ^ n • ⊤]
ϖ : R
hϖ : Irreducible ϖ
⊢ x = 0

Next tactic:
simp only [← Ideal.one_eq_top, smul_eq_mul, mul_one, SModEq.zero, hϖ.maximalIdeal_eq,
      Ideal.span_singleton_pow, Ideal.mem_span_singleton, ← addVal_le_iff_dvd, hϖ.addVal_pow] at hx
instance (R : Type*) [CommRing R] [IsDomain R] [DiscreteValuationRing R] :
    IsHausdorff (maximalIdeal R) R where
  haus' x hx := by
    obtain ⟨ϖ, hϖ⟩ := exists_irreducible R
    simp only [← Ideal.one_eq_top, smul_eq_mul, mul_one, SModEq.zero, hϖ.maximalIdeal_eq,
      Ideal.span_singleton_pow, Ideal.mem_span_singleton, ← addVal_le_iff_dvd, hϖ.addVal_pow] at hx
    

Proof state:
case intro
R✝ : Type u_1
R : Type u_2
inst✝² : CommRing R
inst✝¹ : IsDomain R
inst✝ : DiscreteValuationRing R
x ϖ : R
hϖ : Irreducible ϖ
hx : ∀ (n : ℕ), ↑n ≤ (addVal R) x
⊢ x = 0

Next tactic:
rwa [← addVal_eq_top_iff, PartENat.eq_top_iff_forall_le]
@[simp]
theorem mk_eq (f : Arrow T) : Arrow.mk f.hom = f := by
  

Proof state:
T : Type u
inst✝ : Category.{v, u} T
f : Arrow T
⊢ mk f.hom = f

Next tactic:
cases f
@[simp]
theorem mk_eq (f : Arrow T) : Arrow.mk f.hom = f := by
  cases f
  

Proof state:
case mk
T : Type u
inst✝ : Category.{v, u} T
left✝ right✝ : T
hom✝ : (𝟭 T).obj left✝ ⟶ (𝟭 T).obj right✝
⊢ mk { left := left✝, right := right✝, hom := hom✝ }.hom = { left := left✝, right := right✝, hom := hom✝ }

Next tactic:
rfl
theorem mk_injective (A B : T) :
    Function.Injective (Arrow.mk : (A ⟶ B) → Arrow T) := fun f g h => by
  

Proof state:
T : Type u
inst✝ : Category.{v, u} T
A B : T
f g : A ⟶ B
h : mk f = mk g
⊢ f = g

Next tactic:
cases h
theorem mk_injective (A B : T) :
    Function.Injective (Arrow.mk : (A ⟶ B) → Arrow T) := fun f g h => by
  cases h
  

Proof state:
case refl
T : Type u
inst✝ : Category.{v, u} T
A B : T
f : A ⟶ B
⊢ f = f

Next tactic:
rfl
theorem isIso_of_isIso_left_of_isIso_right {f g : Arrow T} (ff : f ⟶ g) [IsIso ff.left]
    [IsIso ff.right] : IsIso ff where
  out := by
    

Proof state:
T : Type u
inst✝² : Category.{v, u} T
f g : Arrow T
ff : f ⟶ g
inst✝¹ : IsIso ff.left
inst✝ : IsIso ff.right
⊢ ∃ inv, ff ≫ inv = 𝟙 f ∧ inv ≫ ff = 𝟙 g

Next tactic:
let inverse : g ⟶ f := ⟨inv ff.left, inv ff.right, (by simp)⟩
theorem isIso_of_isIso_left_of_isIso_right {f g : Arrow T} (ff : f ⟶ g) [IsIso ff.left]
    [IsIso ff.right] : IsIso ff where
  out := by
    let inverse : g ⟶ f := ⟨inv ff.left, inv ff.right, (by 

Proof state:
T : Type u
inst✝² : Category.{v, u} T
f g : Arrow T
ff : f ⟶ g
inst✝¹ : IsIso ff.left
inst✝ : IsIso ff.right
⊢ (𝟭 T).map (inv ff.left) ≫ f.hom = g.hom ≫ (𝟭 T).map (inv ff.right)

Next tactic:
simp
theorem isIso_of_isIso_left_of_isIso_right {f g : Arrow T} (ff : f ⟶ g) [IsIso ff.left]
    [IsIso ff.right] : IsIso ff where
  out := by
    let inverse : g ⟶ f := ⟨inv ff.left, inv ff.right, (by simp)⟩
    

Proof state:
T : Type u
inst✝² : Category.{v, u} T
f g : Arrow T
ff : f ⟶ g
inst✝¹ : IsIso ff.left
inst✝ : IsIso ff.right
inverse : g ⟶ f := CommaMorphism.mk (inv ff.left) (inv ff.right)
⊢ ∃ inv, ff ≫ inv = 𝟙 f ∧ inv ≫ ff = 𝟙 g

Next tactic:
apply Exists.intro inverse
theorem isIso_of_isIso_left_of_isIso_right {f g : Arrow T} (ff : f ⟶ g) [IsIso ff.left]
    [IsIso ff.right] : IsIso ff where
  out := by
    let inverse : g ⟶ f := ⟨inv ff.left, inv ff.right, (by simp)⟩
    apply Exists.intro inverse
    

Proof state:
T : Type u
inst✝² : Category.{v, u} T
f g : Arrow T
ff : f ⟶ g
inst✝¹ : IsIso ff.left
inst✝ : IsIso ff.right
inverse : g ⟶ f := CommaMorphism.mk (inv ff.left) (inv ff.right)
⊢ ff ≫ inverse = 𝟙 f ∧ inverse ≫ ff = 𝟙 g

Next tactic:
aesop_cat
theorem hom.congr_left {f g : Arrow T} {φ₁ φ₂ : f ⟶ g} (h : φ₁ = φ₂) : φ₁.left = φ₂.left := by
  

Proof state:
T : Type u
inst✝ : Category.{v, u} T
f g : Arrow T
φ₁ φ₂ : f ⟶ g
h : φ₁ = φ₂
⊢ φ₁.left = φ₂.left

Next tactic:
rw [h]
@[simp]
theorem hom.congr_right {f g : Arrow T} {φ₁ φ₂ : f ⟶ g} (h : φ₁ = φ₂) : φ₁.right = φ₂.right := by
  

Proof state:
T : Type u
inst✝ : Category.{v, u} T
f g : Arrow T
φ₁ φ₂ : f ⟶ g
h : φ₁ = φ₂
⊢ φ₁.right = φ₂.right

Next tactic:
rw [h]
theorem iso_w {f g : Arrow T} (e : f ≅ g) : g.hom = e.inv.left ≫ f.hom ≫ e.hom.right := by
  

Proof state:
T : Type u
inst✝ : Category.{v, u} T
f g : Arrow T
e : f ≅ g
⊢ g.hom = e.inv.left ≫ f.hom ≫ e.hom.right

Next tactic:
have eq := Arrow.hom.congr_right e.inv_hom_id
theorem iso_w {f g : Arrow T} (e : f ≅ g) : g.hom = e.inv.left ≫ f.hom ≫ e.hom.right := by
  have eq := Arrow.hom.congr_right e.inv_hom_id
  

Proof state:
T : Type u
inst✝ : Category.{v, u} T
f g : Arrow T
e : f ≅ g
eq : (e.inv ≫ e.hom).right = (𝟙 g).right
⊢ g.hom = e.inv.left ≫ f.hom ≫ e.hom.right

Next tactic:
rw [Arrow.comp_right, Arrow.id_right] at eq
theorem iso_w {f g : Arrow T} (e : f ≅ g) : g.hom = e.inv.left ≫ f.hom ≫ e.hom.right := by
  have eq := Arrow.hom.congr_right e.inv_hom_id
  rw [Arrow.comp_right, Arrow.id_right] at eq
  

Proof state:
T : Type u
inst✝ : Category.{v, u} T
f g : Arrow T
e : f ≅ g
eq : e.inv.right ≫ e.hom.right = 𝟙 g.right
⊢ g.hom = e.inv.left ≫ f.hom ≫ e.hom.right

Next tactic:
erw [Arrow.w_assoc, eq, Category.comp_id]
instance isIso_left [IsIso sq] : IsIso sq.left where
  out := by
    

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : IsIso sq
⊢ ∃ inv, sq.left ≫ inv = 𝟙 f.left ∧ inv ≫ sq.left = 𝟙 g.left

Next tactic:
apply Exists.intro (inv sq).left
instance isIso_left [IsIso sq] : IsIso sq.left where
  out := by
    apply Exists.intro (inv sq).left
    

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : IsIso sq
⊢ sq.left ≫ (inv sq).left = 𝟙 f.left ∧ (inv sq).left ≫ sq.left = 𝟙 g.left

Next tactic:
simp only [← Comma.comp_left, IsIso.hom_inv_id, IsIso.inv_hom_id, Arrow.id_left,
      eq_self_iff_true, and_self_iff]
instance isIso_left [IsIso sq] : IsIso sq.left where
  out := by
    apply Exists.intro (inv sq).left
    simp only [← Comma.comp_left, IsIso.hom_inv_id, IsIso.inv_hom_id, Arrow.id_left,
      eq_self_iff_true, and_self_iff]
    

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : IsIso sq
⊢ (𝟙 f).left = 𝟙 f.left ∧ (𝟙 g).left = 𝟙 g.left

Next tactic:
simp
instance isIso_right [IsIso sq] : IsIso sq.right where
  out := by
    

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : IsIso sq
⊢ ∃ inv, sq.right ≫ inv = 𝟙 f.right ∧ inv ≫ sq.right = 𝟙 g.right

Next tactic:
apply Exists.intro (inv sq).right
instance isIso_right [IsIso sq] : IsIso sq.right where
  out := by
    apply Exists.intro (inv sq).right
    

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : IsIso sq
⊢ sq.right ≫ (inv sq).right = 𝟙 f.right ∧ (inv sq).right ≫ sq.right = 𝟙 g.right

Next tactic:
simp only [← Comma.comp_right, IsIso.hom_inv_id, IsIso.inv_hom_id, Arrow.id_right,
      eq_self_iff_true, and_self_iff]
instance isIso_right [IsIso sq] : IsIso sq.right where
  out := by
    apply Exists.intro (inv sq).right
    simp only [← Comma.comp_right, IsIso.hom_inv_id, IsIso.inv_hom_id, Arrow.id_right,
      eq_self_iff_true, and_self_iff]
    

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : IsIso sq
⊢ (𝟙 f).right = 𝟙 f.right ∧ (𝟙 g).right = 𝟙 g.right

Next tactic:
simp
@[simp]
theorem inv_left [IsIso sq] : (inv sq).left = inv sq.left :=
  IsIso.eq_inv_of_hom_inv_id <| by 

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : IsIso sq
⊢ sq.left ≫ (inv sq).left = 𝟙 f.left

Next tactic:
rw [← Comma.comp_left, IsIso.hom_inv_id, id_left]
@[simp]
theorem inv_right [IsIso sq] : (inv sq).right = inv sq.right :=
  IsIso.eq_inv_of_hom_inv_id <| by 

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : IsIso sq
⊢ sq.right ≫ (inv sq).right = 𝟙 f.right

Next tactic:
rw [← Comma.comp_right, IsIso.hom_inv_id, id_right]
theorem left_hom_inv_right [IsIso sq] : sq.left ≫ g.hom ≫ inv sq.right = f.hom := by
  

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : IsIso sq
⊢ sq.left ≫ g.hom ≫ inv sq.right = f.hom

Next tactic:
simp only [← Category.assoc, IsIso.comp_inv_eq, w]
theorem inv_left_hom_right [IsIso sq] : inv sq.left ≫ f.hom ≫ sq.right = g.hom := by
  

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : IsIso sq
⊢ inv sq.left ≫ f.hom ≫ sq.right = g.hom

Next tactic:
simp only [w, IsIso.inv_comp_eq]
instance mono_left [Mono sq] : Mono sq.left where
  right_cancellation {Z} φ ψ h := by
    

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : Mono sq
Z : T
φ ψ : Z ⟶ f.left
h : φ ≫ sq.left = ψ ≫ sq.left
⊢ φ = ψ

Next tactic:
let aux : (Z ⟶ f.left) → (Arrow.mk (𝟙 Z) ⟶ f) := fun φ =>
      { left := φ
        right := φ ≫ f.hom }
instance mono_left [Mono sq] : Mono sq.left where
  right_cancellation {Z} φ ψ h := by
    let aux : (Z ⟶ f.left) → (Arrow.mk (𝟙 Z) ⟶ f) := fun φ =>
      { left := φ
        right := φ ≫ f.hom }
    

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : Mono sq
Z : T
φ ψ : Z ⟶ f.left
h : φ ≫ sq.left = ψ ≫ sq.left
aux : (Z ⟶ f.left) → (mk (𝟙 Z) ⟶ f) := fun φ => CommaMorphism.mk φ (φ ≫ f.hom)
⊢ φ = ψ

Next tactic:
have : ∀ g, (aux g).right = g ≫ f.hom := fun g => by dsimp
instance mono_left [Mono sq] : Mono sq.left where
  right_cancellation {Z} φ ψ h := by
    let aux : (Z ⟶ f.left) → (Arrow.mk (𝟙 Z) ⟶ f) := fun φ =>
      { left := φ
        right := φ ≫ f.hom }
    have : ∀ g, (aux g).right = g ≫ f.hom := fun g => by 

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g✝ : Arrow T
sq : f ⟶ g✝
inst✝ : Mono sq
Z : T
φ ψ : Z ⟶ f.left
h : φ ≫ sq.left = ψ ≫ sq.left
aux : (Z ⟶ f.left) → (mk (𝟙 Z) ⟶ f) := fun φ => CommaMorphism.mk φ (φ ≫ f.hom)
g : Z ⟶ f.left
⊢ (aux g).right = g ≫ f.hom

Next tactic:
dsimp
instance mono_left [Mono sq] : Mono sq.left where
  right_cancellation {Z} φ ψ h := by
    let aux : (Z ⟶ f.left) → (Arrow.mk (𝟙 Z) ⟶ f) := fun φ =>
      { left := φ
        right := φ ≫ f.hom }
    have : ∀ g, (aux g).right = g ≫ f.hom := fun g => by dsimp
    

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : Mono sq
Z : T
φ ψ : Z ⟶ f.left
h : φ ≫ sq.left = ψ ≫ sq.left
aux : (Z ⟶ f.left) → (mk (𝟙 Z) ⟶ f) := fun φ => CommaMorphism.mk φ (φ ≫ f.hom)
this : ∀ (g : Z ⟶ f.left), (aux g).right = g ≫ f.hom
⊢ φ = ψ

Next tactic:
show (aux φ).left = (aux ψ).left
instance mono_left [Mono sq] : Mono sq.left where
  right_cancellation {Z} φ ψ h := by
    let aux : (Z ⟶ f.left) → (Arrow.mk (𝟙 Z) ⟶ f) := fun φ =>
      { left := φ
        right := φ ≫ f.hom }
    have : ∀ g, (aux g).right = g ≫ f.hom := fun g => by dsimp
    show (aux φ).left = (aux ψ).left
    

Proof state:
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : Mono sq
Z : T
φ ψ : Z ⟶ f.left
h : φ ≫ sq.left = ψ ≫ sq.left
aux : (Z ⟶ f.left) → (mk (𝟙 Z) ⟶ f) := fun φ => CommaMorphism.mk φ (φ ≫ f.hom)
this : ∀ (g : Z ⟶ f.left), (aux g).right = g ≫ f.hom
⊢ (aux φ).left = (aux ψ).left

Next tactic:
congr 1
instance mono_left [Mono sq] : Mono sq.left where
  right_cancellation {Z} φ ψ h := by
    let aux : (Z ⟶ f.left) → (Arrow.mk (𝟙 Z) ⟶ f) := fun φ =>
      { left := φ
        right := φ ≫ f.hom }
    have : ∀ g, (aux g).right = g ≫ f.hom := fun g => by dsimp
    show (aux φ).left = (aux ψ).left
    congr 1
    

Proof state:
case e_self
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : Mono sq
Z : T
φ ψ : Z ⟶ f.left
h : φ ≫ sq.left = ψ ≫ sq.left
aux : (Z ⟶ f.left) → (mk (𝟙 Z) ⟶ f) := fun φ => CommaMorphism.mk φ (φ ≫ f.hom)
this : ∀ (g : Z ⟶ f.left), (aux g).right = g ≫ f.hom
⊢ aux φ = aux ψ

Next tactic:
rw [← cancel_mono sq]
instance mono_left [Mono sq] : Mono sq.left where
  right_cancellation {Z} φ ψ h := by
    let aux : (Z ⟶ f.left) → (Arrow.mk (𝟙 Z) ⟶ f) := fun φ =>
      { left := φ
        right := φ ≫ f.hom }
    have : ∀ g, (aux g).right = g ≫ f.hom := fun g => by dsimp
    show (aux φ).left = (aux ψ).left
    congr 1
    rw [← cancel_mono sq]
    

Proof state:
case e_self
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : Mono sq
Z : T
φ ψ : Z ⟶ f.left
h : φ ≫ sq.left = ψ ≫ sq.left
aux : (Z ⟶ f.left) → (mk (𝟙 Z) ⟶ f) := fun φ => CommaMorphism.mk φ (φ ≫ f.hom)
this : ∀ (g : Z ⟶ f.left), (aux g).right = g ≫ f.hom
⊢ aux φ ≫ sq = aux ψ ≫ sq

Next tactic:
apply CommaMorphism.ext
instance mono_left [Mono sq] : Mono sq.left where
  right_cancellation {Z} φ ψ h := by
    let aux : (Z ⟶ f.left) → (Arrow.mk (𝟙 Z) ⟶ f) := fun φ =>
      { left := φ
        right := φ ≫ f.hom }
    have : ∀ g, (aux g).right = g ≫ f.hom := fun g => by dsimp
    show (aux φ).left = (aux ψ).left
    congr 1
    rw [← cancel_mono sq]
    apply CommaMorphism.ext
    · 

Proof state:
case e_self.left
T : Type u
inst✝¹ : Category.{v, u} T
f g : Arrow T
sq : f ⟶ g
inst✝ : Mono sq
Z : T
φ ψ : Z ⟶ f.left
h : φ ≫ sq.left = ψ ≫ sq.left
aux : (Z ⟶ f.left) → (mk (𝟙 Z) ⟶ f) := fun φ => CommaMorphism.mk φ (φ ≫ f.hom)
this : ∀ (g : Z ⟶ f.left), (aux g).right = g ≫ f.hom
⊢ (aux φ ≫ sq).left = (aux ψ ≫ sq).left

Next tactic:
exact h