l3lab/ntp-mathlib huggingface dataset:
theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) :
    coeff R n (inv.aux a φ) =
      if n = 0 then a
      else
        -a *
          ∑ x in antidiagonal n,
            if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux]
  simp only [Finsupp.single_eq_zero]
  split_ifs; · rfl
  congr 1
  symm
  apply Finset.sum_bij fun (p : ℕ × ℕ) _h => (single () p.1, single () p.2)
  · rintro ⟨i, j⟩ hij
    rw [mem_antidiagonal] at hij
    rw [mem_antidiagonal, ← Finsupp.single_add, hij]
  · rintro ⟨i, j⟩ _hij
    by_cases H : j < n
    · rw [if_pos H, if_pos]
      · rfl
      constructor
      · rintro ⟨⟩
        simpa [Finsupp.single_eq_same] using le_of_lt H
      · intro hh
        rw [lt_iff_not_ge] at H
        apply H
        simpa [Finsupp.single_eq_same] using hh ()
    · rw [if_neg H, if_neg]
      rintro ⟨_h₁, h₂⟩
      apply h₂
      rintro ⟨⟩
      simpa [Finsupp.single_eq_same] using not_lt.1 H
  · rintro ⟨i, j⟩ ⟨k, l⟩ _hij _hkl
    

Proof state:
case neg.e_a.i_inj.mk.mk
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j k l : ℕ
_hij : (i, j) ∈ antidiagonal n
_hkl : (k, l) ∈ antidiagonal n
⊢ (fun₀ | () => (i, j).1, fun₀ | () => (i, j).2) = (fun₀ | () => (k, l).1, fun₀ | () => (k, l).2) → (i, j) = (k, l)

Next tactic:
simpa only [Prod.mk.inj_iff, Finsupp.unique_single_eq_iff] using id
theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) :
    coeff R n (inv.aux a φ) =
      if n = 0 then a
      else
        -a *
          ∑ x in antidiagonal n,
            if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux]
  simp only [Finsupp.single_eq_zero]
  split_ifs; · rfl
  congr 1
  symm
  apply Finset.sum_bij fun (p : ℕ × ℕ) _h => (single () p.1, single () p.2)
  · rintro ⟨i, j⟩ hij
    rw [mem_antidiagonal] at hij
    rw [mem_antidiagonal, ← Finsupp.single_add, hij]
  · rintro ⟨i, j⟩ _hij
    by_cases H : j < n
    · rw [if_pos H, if_pos]
      · rfl
      constructor
      · rintro ⟨⟩
        simpa [Finsupp.single_eq_same] using le_of_lt H
      · intro hh
        rw [lt_iff_not_ge] at H
        apply H
        simpa [Finsupp.single_eq_same] using hh ()
    · rw [if_neg H, if_neg]
      rintro ⟨_h₁, h₂⟩
      apply h₂
      rintro ⟨⟩
      simpa [Finsupp.single_eq_same] using not_lt.1 H
  · rintro ⟨i, j⟩ ⟨k, l⟩ _hij _hkl
    simpa only [Prod.mk.inj_iff, Finsupp.unique_single_eq_iff] using id
  · 

Proof state:
case neg.e_a.i_surj
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ ∀ b ∈ antidiagonal fun₀ | () => n, ∃ a, ∃ (_ : a ∈ antidiagonal n), b = (fun₀ | () => a.1, fun₀ | () => a.2)

Next tactic:
rintro ⟨f, g⟩ hfg
theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) :
    coeff R n (inv.aux a φ) =
      if n = 0 then a
      else
        -a *
          ∑ x in antidiagonal n,
            if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux]
  simp only [Finsupp.single_eq_zero]
  split_ifs; · rfl
  congr 1
  symm
  apply Finset.sum_bij fun (p : ℕ × ℕ) _h => (single () p.1, single () p.2)
  · rintro ⟨i, j⟩ hij
    rw [mem_antidiagonal] at hij
    rw [mem_antidiagonal, ← Finsupp.single_add, hij]
  · rintro ⟨i, j⟩ _hij
    by_cases H : j < n
    · rw [if_pos H, if_pos]
      · rfl
      constructor
      · rintro ⟨⟩
        simpa [Finsupp.single_eq_same] using le_of_lt H
      · intro hh
        rw [lt_iff_not_ge] at H
        apply H
        simpa [Finsupp.single_eq_same] using hh ()
    · rw [if_neg H, if_neg]
      rintro ⟨_h₁, h₂⟩
      apply h₂
      rintro ⟨⟩
      simpa [Finsupp.single_eq_same] using not_lt.1 H
  · rintro ⟨i, j⟩ ⟨k, l⟩ _hij _hkl
    simpa only [Prod.mk.inj_iff, Finsupp.unique_single_eq_iff] using id
  · rintro ⟨f, g⟩ hfg
    

Proof state:
case neg.e_a.i_surj.mk
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
f g : Unit →₀ ℕ
hfg : (f, g) ∈ antidiagonal fun₀ | () => n
⊢ ∃ a, ∃ (_ : a ∈ antidiagonal n), (f, g) = (fun₀ | () => a.1, fun₀ | () => a.2)

Next tactic:
refine' ⟨(f (), g ()), _, _⟩
theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) :
    coeff R n (inv.aux a φ) =
      if n = 0 then a
      else
        -a *
          ∑ x in antidiagonal n,
            if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux]
  simp only [Finsupp.single_eq_zero]
  split_ifs; · rfl
  congr 1
  symm
  apply Finset.sum_bij fun (p : ℕ × ℕ) _h => (single () p.1, single () p.2)
  · rintro ⟨i, j⟩ hij
    rw [mem_antidiagonal] at hij
    rw [mem_antidiagonal, ← Finsupp.single_add, hij]
  · rintro ⟨i, j⟩ _hij
    by_cases H : j < n
    · rw [if_pos H, if_pos]
      · rfl
      constructor
      · rintro ⟨⟩
        simpa [Finsupp.single_eq_same] using le_of_lt H
      · intro hh
        rw [lt_iff_not_ge] at H
        apply H
        simpa [Finsupp.single_eq_same] using hh ()
    · rw [if_neg H, if_neg]
      rintro ⟨_h₁, h₂⟩
      apply h₂
      rintro ⟨⟩
      simpa [Finsupp.single_eq_same] using not_lt.1 H
  · rintro ⟨i, j⟩ ⟨k, l⟩ _hij _hkl
    simpa only [Prod.mk.inj_iff, Finsupp.unique_single_eq_iff] using id
  · rintro ⟨f, g⟩ hfg
    refine' ⟨(f (), g ()), _, _⟩
    · 

Proof state:
case neg.e_a.i_surj.mk.refine'_1
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
f g : Unit →₀ ℕ
hfg : (f, g) ∈ antidiagonal fun₀ | () => n
⊢ (f (), g ()) ∈ antidiagonal n

Next tactic:
rw [mem_antidiagonal] at hfg
theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) :
    coeff R n (inv.aux a φ) =
      if n = 0 then a
      else
        -a *
          ∑ x in antidiagonal n,
            if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux]
  simp only [Finsupp.single_eq_zero]
  split_ifs; · rfl
  congr 1
  symm
  apply Finset.sum_bij fun (p : ℕ × ℕ) _h => (single () p.1, single () p.2)
  · rintro ⟨i, j⟩ hij
    rw [mem_antidiagonal] at hij
    rw [mem_antidiagonal, ← Finsupp.single_add, hij]
  · rintro ⟨i, j⟩ _hij
    by_cases H : j < n
    · rw [if_pos H, if_pos]
      · rfl
      constructor
      · rintro ⟨⟩
        simpa [Finsupp.single_eq_same] using le_of_lt H
      · intro hh
        rw [lt_iff_not_ge] at H
        apply H
        simpa [Finsupp.single_eq_same] using hh ()
    · rw [if_neg H, if_neg]
      rintro ⟨_h₁, h₂⟩
      apply h₂
      rintro ⟨⟩
      simpa [Finsupp.single_eq_same] using not_lt.1 H
  · rintro ⟨i, j⟩ ⟨k, l⟩ _hij _hkl
    simpa only [Prod.mk.inj_iff, Finsupp.unique_single_eq_iff] using id
  · rintro ⟨f, g⟩ hfg
    refine' ⟨(f (), g ()), _, _⟩
    · rw [mem_antidiagonal] at hfg
      

Proof state:
case neg.e_a.i_surj.mk.refine'_1
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
f g : Unit →₀ ℕ
hfg : (f, g).1 + (f, g).2 = fun₀ | () => n
⊢ (f (), g ()) ∈ antidiagonal n

Next tactic:
rw [mem_antidiagonal, ← Finsupp.add_apply, hfg, Finsupp.single_eq_same]
theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) :
    coeff R n (inv.aux a φ) =
      if n = 0 then a
      else
        -a *
          ∑ x in antidiagonal n,
            if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux]
  simp only [Finsupp.single_eq_zero]
  split_ifs; · rfl
  congr 1
  symm
  apply Finset.sum_bij fun (p : ℕ × ℕ) _h => (single () p.1, single () p.2)
  · rintro ⟨i, j⟩ hij
    rw [mem_antidiagonal] at hij
    rw [mem_antidiagonal, ← Finsupp.single_add, hij]
  · rintro ⟨i, j⟩ _hij
    by_cases H : j < n
    · rw [if_pos H, if_pos]
      · rfl
      constructor
      · rintro ⟨⟩
        simpa [Finsupp.single_eq_same] using le_of_lt H
      · intro hh
        rw [lt_iff_not_ge] at H
        apply H
        simpa [Finsupp.single_eq_same] using hh ()
    · rw [if_neg H, if_neg]
      rintro ⟨_h₁, h₂⟩
      apply h₂
      rintro ⟨⟩
      simpa [Finsupp.single_eq_same] using not_lt.1 H
  · rintro ⟨i, j⟩ ⟨k, l⟩ _hij _hkl
    simpa only [Prod.mk.inj_iff, Finsupp.unique_single_eq_iff] using id
  · rintro ⟨f, g⟩ hfg
    refine' ⟨(f (), g ()), _, _⟩
    · rw [mem_antidiagonal] at hfg
      rw [mem_antidiagonal, ← Finsupp.add_apply, hfg, Finsupp.single_eq_same]
    · 

Proof state:
case neg.e_a.i_surj.mk.refine'_2
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
f g : Unit →₀ ℕ
hfg : (f, g) ∈ antidiagonal fun₀ | () => n
⊢ (f, g) = (fun₀ | () => (f (), g ()).1, fun₀ | () => (f (), g ()).2)

Next tactic:
rw [Prod.mk.inj_iff]
theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) :
    coeff R n (inv.aux a φ) =
      if n = 0 then a
      else
        -a *
          ∑ x in antidiagonal n,
            if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux]
  simp only [Finsupp.single_eq_zero]
  split_ifs; · rfl
  congr 1
  symm
  apply Finset.sum_bij fun (p : ℕ × ℕ) _h => (single () p.1, single () p.2)
  · rintro ⟨i, j⟩ hij
    rw [mem_antidiagonal] at hij
    rw [mem_antidiagonal, ← Finsupp.single_add, hij]
  · rintro ⟨i, j⟩ _hij
    by_cases H : j < n
    · rw [if_pos H, if_pos]
      · rfl
      constructor
      · rintro ⟨⟩
        simpa [Finsupp.single_eq_same] using le_of_lt H
      · intro hh
        rw [lt_iff_not_ge] at H
        apply H
        simpa [Finsupp.single_eq_same] using hh ()
    · rw [if_neg H, if_neg]
      rintro ⟨_h₁, h₂⟩
      apply h₂
      rintro ⟨⟩
      simpa [Finsupp.single_eq_same] using not_lt.1 H
  · rintro ⟨i, j⟩ ⟨k, l⟩ _hij _hkl
    simpa only [Prod.mk.inj_iff, Finsupp.unique_single_eq_iff] using id
  · rintro ⟨f, g⟩ hfg
    refine' ⟨(f (), g ()), _, _⟩
    · rw [mem_antidiagonal] at hfg
      rw [mem_antidiagonal, ← Finsupp.add_apply, hfg, Finsupp.single_eq_same]
    · rw [Prod.mk.inj_iff]
      

Proof state:
case neg.e_a.i_surj.mk.refine'_2
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
f g : Unit →₀ ℕ
hfg : (f, g) ∈ antidiagonal fun₀ | () => n
⊢ (f = fun₀ | () => (f (), g ()).1) ∧ g = fun₀ | () => (f (), g ()).2

Next tactic:
dsimp
theorem coeff_inv_aux (n : ℕ) (a : R) (φ : R⟦X⟧) :
    coeff R n (inv.aux a φ) =
      if n = 0 then a
      else
        -a *
          ∑ x in antidiagonal n,
            if x.2 < n then coeff R x.1 φ * coeff R x.2 (inv.aux a φ) else 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  erw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux]
  simp only [Finsupp.single_eq_zero]
  split_ifs; · rfl
  congr 1
  symm
  apply Finset.sum_bij fun (p : ℕ × ℕ) _h => (single () p.1, single () p.2)
  · rintro ⟨i, j⟩ hij
    rw [mem_antidiagonal] at hij
    rw [mem_antidiagonal, ← Finsupp.single_add, hij]
  · rintro ⟨i, j⟩ _hij
    by_cases H : j < n
    · rw [if_pos H, if_pos]
      · rfl
      constructor
      · rintro ⟨⟩
        simpa [Finsupp.single_eq_same] using le_of_lt H
      · intro hh
        rw [lt_iff_not_ge] at H
        apply H
        simpa [Finsupp.single_eq_same] using hh ()
    · rw [if_neg H, if_neg]
      rintro ⟨_h₁, h₂⟩
      apply h₂
      rintro ⟨⟩
      simpa [Finsupp.single_eq_same] using not_lt.1 H
  · rintro ⟨i, j⟩ ⟨k, l⟩ _hij _hkl
    simpa only [Prod.mk.inj_iff, Finsupp.unique_single_eq_iff] using id
  · rintro ⟨f, g⟩ hfg
    refine' ⟨(f (), g ()), _, _⟩
    · rw [mem_antidiagonal] at hfg
      rw [mem_antidiagonal, ← Finsupp.add_apply, hfg, Finsupp.single_eq_same]
    · rw [Prod.mk.inj_iff]
      dsimp
      

Proof state:
case neg.e_a.i_surj.mk.refine'_2
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
f g : Unit →₀ ℕ
hfg : (f, g) ∈ antidiagonal fun₀ | () => n
⊢ (f = fun₀ | () => f ()) ∧ g = fun₀ | () => g ()

Next tactic:
exact ⟨Finsupp.unique_single f, Finsupp.unique_single g⟩
@[simp]
theorem constantCoeff_invOfUnit (φ : R⟦X⟧) (u : Rˣ) :
    constantCoeff R (invOfUnit φ u) = ↑u⁻¹ := by
  

Proof state:
R : Type u_1
inst✝ : Ring R
φ : R⟦X⟧
u : Rˣ
⊢ (constantCoeff R) (invOfUnit φ u) = ↑u⁻¹

Next tactic:
rw [← coeff_zero_eq_constantCoeff_apply, coeff_invOfUnit, if_pos rfl]
@[simp]
theorem rescale_X (a : A) : rescale a X = C A a * X := by
  

Proof state:
R : Type u_1
A : Type u_2
inst✝ : CommRing A
a : A
⊢ (rescale a) X = (C A) a * X

Next tactic:
ext
@[simp]
theorem rescale_X (a : A) : rescale a X = C A a * X := by
  ext
  

Proof state:
case h
R : Type u_1
A : Type u_2
inst✝ : CommRing A
a : A
n✝ : ℕ
⊢ (coeff A n✝) ((rescale a) X) = (coeff A n✝) ((C A) a * X)

Next tactic:
simp only [coeff_rescale, coeff_C_mul, coeff_X]
@[simp]
theorem rescale_X (a : A) : rescale a X = C A a * X := by
  ext
  simp only [coeff_rescale, coeff_C_mul, coeff_X]
  

Proof state:
case h
R : Type u_1
A : Type u_2
inst✝ : CommRing A
a : A
n✝ : ℕ
⊢ (a ^ n✝ * if n✝ = 1 then 1 else 0) = a * if n✝ = 1 then 1 else 0

Next tactic:
split_ifs with h
@[simp]
theorem rescale_X (a : A) : rescale a X = C A a * X := by
  ext
  simp only [coeff_rescale, coeff_C_mul, coeff_X]
  split_ifs with h <;> 

Proof state:
case pos
R : Type u_1
A : Type u_2
inst✝ : CommRing A
a : A
n✝ : ℕ
h : n✝ = 1
⊢ a ^ n✝ * 1 = a * 1

Next tactic:
simp [h]
@[simp]
theorem rescale_X (a : A) : rescale a X = C A a * X := by
  ext
  simp only [coeff_rescale, coeff_C_mul, coeff_X]
  split_ifs with h <;> 

Proof state:
case neg
R : Type u_1
A : Type u_2
inst✝ : CommRing A
a : A
n✝ : ℕ
h : ¬n✝ = 1
⊢ a ^ n✝ * 0 = a * 0

Next tactic:
simp [h]
theorem rescale_neg_one_X : rescale (-1 : A) X = -X := by
  

Proof state:
R : Type u_1
A : Type u_2
inst✝ : CommRing A
⊢ (rescale (-1)) X = -X

Next tactic:
rw [rescale_X, map_neg, map_one, neg_one_mul]
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  

Proof state:
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
h : φ * ψ = 0
⊢ φ = 0 ∨ ψ = 0

Next tactic:
classical
  rw [or_iff_not_imp_left]
  intro H
  have ex : ∃ m, coeff R m φ ≠ 0 := by
    contrapose! H
    exact ext H
  let m := Nat.find ex
  have hm₁ : coeff R m φ ≠ 0 := Nat.find_spec ex
  have hm₂ : ∀ k < m, ¬coeff R k φ ≠ 0 := fun k => Nat.find_min ex
  ext n
  rw [(coeff R n).map_zero]
  induction' n using Nat.strong_induction_on with n ih
  replace h := congr_arg (coeff R (m + n)) h
  rw [LinearMap.map_zero, coeff_mul, Finset.sum_eq_single (m, n)] at h
  · replace h := NoZeroDivisors.eq_zero_or_eq_zero_of_mul_eq_zero h
    rw [or_iff_not_imp_left] at h
    exact h hm₁
  · rintro ⟨i, j⟩ hij hne
    by_cases hj : j < n
    · rw [ih j hj, mul_zero]
    by_cases hi : i < m
    · specialize hm₂ _ hi
      push_neg at hm₂
      rw [hm₂, zero_mul]
    rw [mem_antidiagonal] at hij
    push_neg at hi hj
    suffices m < i by
      have : m + n < i + j := add_lt_add_of_lt_of_le this hj
      exfalso
      exact ne_of_lt this hij.symm
    contrapose! hne
    obtain rfl := le_antisymm hi hne
    simpa [Ne.def, Prod.mk.inj_iff] using (add_right_inj m).mp hij
  · contrapose!
    intro
    rw [mem_antidiagonal]
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  

Proof state:
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
h : φ * ψ = 0
⊢ φ = 0 ∨ ψ = 0

Next tactic:
rw [or_iff_not_imp_left]
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  

Proof state:
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
h : φ * ψ = 0
⊢ ¬φ = 0 → ψ = 0

Next tactic:
intro H
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  intro H
  

Proof state:
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
h : φ * ψ = 0
H : ¬φ = 0
⊢ ψ = 0

Next tactic:
have ex : ∃ m, coeff R m φ ≠ 0 := by
    contrapose! H
    exact ext H
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  intro H
  have ex : ∃ m, coeff R m φ ≠ 0 := by
    

Proof state:
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
h : φ * ψ = 0
H : ¬φ = 0
⊢ ∃ m, (coeff R m) φ ≠ 0

Next tactic:
contrapose! H
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  intro H
  have ex : ∃ m, coeff R m φ ≠ 0 := by
    contrapose! H
    

Proof state:
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
h : φ * ψ = 0
H : ∀ (m : ℕ), (coeff R m) φ = 0
⊢ φ = 0

Next tactic:
exact ext H
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  intro H
  have ex : ∃ m, coeff R m φ ≠ 0 := by
    contrapose! H
    exact ext H
  

Proof state:
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
h : φ * ψ = 0
H : ¬φ = 0
ex : ∃ m, (coeff R m) φ ≠ 0
⊢ ψ = 0

Next tactic:
let m := Nat.find ex
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  intro H
  have ex : ∃ m, coeff R m φ ≠ 0 := by
    contrapose! H
    exact ext H
  let m := Nat.find ex
  

Proof state:
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
h : φ * ψ = 0
H : ¬φ = 0
ex : ∃ m, (coeff R m) φ ≠ 0
m : ℕ := Nat.find ex
⊢ ψ = 0

Next tactic:
have hm₁ : coeff R m φ ≠ 0 := Nat.find_spec ex
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  intro H
  have ex : ∃ m, coeff R m φ ≠ 0 := by
    contrapose! H
    exact ext H
  let m := Nat.find ex
  have hm₁ : coeff R m φ ≠ 0 := Nat.find_spec ex
  

Proof state:
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
h : φ * ψ = 0
H : ¬φ = 0
ex : ∃ m, (coeff R m) φ ≠ 0
m : ℕ := Nat.find ex
hm₁ : (coeff R m) φ ≠ 0
⊢ ψ = 0

Next tactic:
have hm₂ : ∀ k < m, ¬coeff R k φ ≠ 0 := fun k => Nat.find_min ex
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  intro H
  have ex : ∃ m, coeff R m φ ≠ 0 := by
    contrapose! H
    exact ext H
  let m := Nat.find ex
  have hm₁ : coeff R m φ ≠ 0 := Nat.find_spec ex
  have hm₂ : ∀ k < m, ¬coeff R k φ ≠ 0 := fun k => Nat.find_min ex
  

Proof state:
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
h : φ * ψ = 0
H : ¬φ = 0
ex : ∃ m, (coeff R m) φ ≠ 0
m : ℕ := Nat.find ex
hm₁ : (coeff R m) φ ≠ 0
hm₂ : ∀ k < m, ¬(coeff R k) φ ≠ 0
⊢ ψ = 0

Next tactic:
ext n
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  intro H
  have ex : ∃ m, coeff R m φ ≠ 0 := by
    contrapose! H
    exact ext H
  let m := Nat.find ex
  have hm₁ : coeff R m φ ≠ 0 := Nat.find_spec ex
  have hm₂ : ∀ k < m, ¬coeff R k φ ≠ 0 := fun k => Nat.find_min ex
  ext n
  

Proof state:
case h
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
h : φ * ψ = 0
H : ¬φ = 0
ex : ∃ m, (coeff R m) φ ≠ 0
m : ℕ := Nat.find ex
hm₁ : (coeff R m) φ ≠ 0
hm₂ : ∀ k < m, ¬(coeff R k) φ ≠ 0
n : ℕ
⊢ (coeff R n) ψ = (coeff R n) 0

Next tactic:
rw [(coeff R n).map_zero]
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  intro H
  have ex : ∃ m, coeff R m φ ≠ 0 := by
    contrapose! H
    exact ext H
  let m := Nat.find ex
  have hm₁ : coeff R m φ ≠ 0 := Nat.find_spec ex
  have hm₂ : ∀ k < m, ¬coeff R k φ ≠ 0 := fun k => Nat.find_min ex
  ext n
  rw [(coeff R n).map_zero]
  

Proof state:
case h
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
h : φ * ψ = 0
H : ¬φ = 0
ex : ∃ m, (coeff R m) φ ≠ 0
m : ℕ := Nat.find ex
hm₁ : (coeff R m) φ ≠ 0
hm₂ : ∀ k < m, ¬(coeff R k) φ ≠ 0
n : ℕ
⊢ (coeff R n) ψ = 0

Next tactic:
induction' n using Nat.strong_induction_on with n ih
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  intro H
  have ex : ∃ m, coeff R m φ ≠ 0 := by
    contrapose! H
    exact ext H
  let m := Nat.find ex
  have hm₁ : coeff R m φ ≠ 0 := Nat.find_spec ex
  have hm₂ : ∀ k < m, ¬coeff R k φ ≠ 0 := fun k => Nat.find_min ex
  ext n
  rw [(coeff R n).map_zero]
  induction' n using Nat.strong_induction_on with n ih
  

Proof state:
case h.h
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
h : φ * ψ = 0
H : ¬φ = 0
ex : ∃ m, (coeff R m) φ ≠ 0
m : ℕ := Nat.find ex
hm₁ : (coeff R m) φ ≠ 0
hm₂ : ∀ k < m, ¬(coeff R k) φ ≠ 0
n : ℕ
ih : ∀ m < n, (coeff R m) ψ = 0
⊢ (coeff R n) ψ = 0

Next tactic:
replace h := congr_arg (coeff R (m + n)) h
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  intro H
  have ex : ∃ m, coeff R m φ ≠ 0 := by
    contrapose! H
    exact ext H
  let m := Nat.find ex
  have hm₁ : coeff R m φ ≠ 0 := Nat.find_spec ex
  have hm₂ : ∀ k < m, ¬coeff R k φ ≠ 0 := fun k => Nat.find_min ex
  ext n
  rw [(coeff R n).map_zero]
  induction' n using Nat.strong_induction_on with n ih
  replace h := congr_arg (coeff R (m + n)) h
  

Proof state:
case h.h
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
H : ¬φ = 0
ex : ∃ m, (coeff R m) φ ≠ 0
m : ℕ := Nat.find ex
hm₁ : (coeff R m) φ ≠ 0
hm₂ : ∀ k < m, ¬(coeff R k) φ ≠ 0
n : ℕ
ih : ∀ m < n, (coeff R m) ψ = 0
h : (coeff R (m + n)) (φ * ψ) = (coeff R (m + n)) 0
⊢ (coeff R n) ψ = 0

Next tactic:
rw [LinearMap.map_zero, coeff_mul, Finset.sum_eq_single (m, n)] at h
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  intro H
  have ex : ∃ m, coeff R m φ ≠ 0 := by
    contrapose! H
    exact ext H
  let m := Nat.find ex
  have hm₁ : coeff R m φ ≠ 0 := Nat.find_spec ex
  have hm₂ : ∀ k < m, ¬coeff R k φ ≠ 0 := fun k => Nat.find_min ex
  ext n
  rw [(coeff R n).map_zero]
  induction' n using Nat.strong_induction_on with n ih
  replace h := congr_arg (coeff R (m + n)) h
  rw [LinearMap.map_zero, coeff_mul, Finset.sum_eq_single (m, n)] at h
  · 

Proof state:
case h.h
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
H : ¬φ = 0
ex : ∃ m, (coeff R m) φ ≠ 0
m : ℕ := Nat.find ex
hm₁ : (coeff R m) φ ≠ 0
hm₂ : ∀ k < m, ¬(coeff R k) φ ≠ 0
n : ℕ
ih : ∀ m < n, (coeff R m) ψ = 0
h : (coeff R (m, n).1) φ * (coeff R (m, n).2) ψ = 0
⊢ (coeff R n) ψ = 0

Next tactic:
replace h := NoZeroDivisors.eq_zero_or_eq_zero_of_mul_eq_zero h
theorem eq_zero_or_eq_zero_of_mul_eq_zero [NoZeroDivisors R] (φ ψ : R⟦X⟧) (h : φ * ψ = 0) :
    φ = 0 ∨ ψ = 0 := by
  classical
  rw [or_iff_not_imp_left]
  intro H
  have ex : ∃ m, coeff R m φ ≠ 0 := by
    contrapose! H
    exact ext H
  let m := Nat.find ex
  have hm₁ : coeff R m φ ≠ 0 := Nat.find_spec ex
  have hm₂ : ∀ k < m, ¬coeff R k φ ≠ 0 := fun k => Nat.find_min ex
  ext n
  rw [(coeff R n).map_zero]
  induction' n using Nat.strong_induction_on with n ih
  replace h := congr_arg (coeff R (m + n)) h
  rw [LinearMap.map_zero, coeff_mul, Finset.sum_eq_single (m, n)] at h
  · replace h := NoZeroDivisors.eq_zero_or_eq_zero_of_mul_eq_zero h
    

Proof state:
case h.h
R : Type u_1
inst✝¹ : Ring R
inst✝ : NoZeroDivisors R
φ ψ : R⟦X⟧
H : ¬φ = 0
ex : ∃ m, (coeff R m) φ ≠ 0
m : ℕ := Nat.find ex
hm₁ : (coeff R m) φ ≠ 0
hm₂ : ∀ k < m, ¬(coeff R k) φ ≠ 0
n : ℕ
ih : ∀ m < n, (coeff R m) ψ = 0
h : (coeff R (m, n).1) φ = 0 ∨ (coeff R (m, n).2) ψ = 0
⊢ (coeff R n) ψ = 0

Next tactic:
rw [or_iff_not_imp_left] at h