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
  

Proof state:
case neg.e_a
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ (∑ x in antidiagonal n, if x.2 < n then (coeff R x.1) φ * (coeff R x.2) (MvPowerSeries.inv.aux a φ) else 0) =
    ∑ x in antidiagonal fun₀ | () => n,
      if x.2 < fun₀ | () => n then
        (MvPowerSeries.coeff R x.1) φ * (MvPowerSeries.coeff R x.2) (MvPowerSeries.inv.aux a φ)
      else 0

Next tactic:
apply Finset.sum_bij fun (p : ℕ × ℕ) _h => (single () p.1, single () p.2)
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)
  · 

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

Next tactic:
rintro ⟨i, j⟩ hij
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
    

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

Next tactic:
rw [mem_antidiagonal] at hij
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
    

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

Next tactic:
rw [mem_antidiagonal, ← Finsupp.single_add, hij]
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]
  · 

Proof state:
case neg.e_a.h
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ ∀ a_1 ∈ antidiagonal n,
    (if a_1.2 < n then (coeff R a_1.1) φ * (coeff R a_1.2) (MvPowerSeries.inv.aux a φ) else 0) =
      if (fun₀ | () => a_1.1, fun₀ | () => a_1.2).2 < fun₀ | () => n then
        (MvPowerSeries.coeff R (fun₀ | () => a_1.1, fun₀ | () => a_1.2).1) φ *
          (MvPowerSeries.coeff R (fun₀ | () => a_1.1, fun₀ | () => a_1.2).2) (MvPowerSeries.inv.aux a φ)
      else 0

Next tactic:
rintro ⟨i, j⟩ _hij
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
    

Proof state:
case neg.e_a.h.mk
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
⊢ (if (i, j).2 < n then (coeff R (i, j).1) φ * (coeff R (i, j).2) (MvPowerSeries.inv.aux a φ) else 0) =
    if (fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 < fun₀ | () => n then
      (MvPowerSeries.coeff R (fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).1) φ *
        (MvPowerSeries.coeff R (fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2) (MvPowerSeries.inv.aux a φ)
    else 0

Next tactic:
by_cases H : j < n
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
    · 

Proof state:
case pos
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : j < n
⊢ (if (i, j).2 < n then (coeff R (i, j).1) φ * (coeff R (i, j).2) (MvPowerSeries.inv.aux a φ) else 0) =
    if (fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 < fun₀ | () => n then
      (MvPowerSeries.coeff R (fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).1) φ *
        (MvPowerSeries.coeff R (fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2) (MvPowerSeries.inv.aux a φ)
    else 0

Next tactic:
rw [if_pos H, if_pos]
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]
      · 

Proof state:
case pos
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : j < n
⊢ (coeff R (i, j).1) φ * (coeff R (i, j).2) (MvPowerSeries.inv.aux a φ) =
    (MvPowerSeries.coeff R (fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).1) φ *
      (MvPowerSeries.coeff R (fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2) (MvPowerSeries.inv.aux a φ)

Next tactic:
rfl
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
      

Proof state:
case pos.hc
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : j < n
⊢ (fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 < fun₀ | () => n

Next tactic:
constructor
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
      · 

Proof state:
case pos.hc.left
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : j < n
⊢ ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 i_1) ((fun₀ | () => n) i_1)

Next tactic:
rintro ⟨⟩
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 ⟨⟩
        

Proof state:
case pos.hc.left.unit
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : j < n
⊢ PartialOrder.toPreorder.1.1 ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 PUnit.unit)
    ((fun₀ | () => n) PUnit.unit)

Next tactic:
simpa [Finsupp.single_eq_same] using le_of_lt H
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
      · 

Proof state:
case pos.hc.right
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : j < n
⊢ ¬∀ (i_1 : Unit),
      PartialOrder.toPreorder.1.1 ((fun₀ | () => n) i_1) ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 i_1)

Next tactic:
intro hh
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
        

Proof state:
case pos.hc.right
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : j < n
hh :
  ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 ((fun₀ | () => n) i_1) ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 i_1)
⊢ False

Next tactic:
rw [lt_iff_not_ge] at H
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
        

Proof state:
case pos.hc.right
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : ¬j ≥ n
hh :
  ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 ((fun₀ | () => n) i_1) ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 i_1)
⊢ False

Next tactic:
apply H
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
        

Proof state:
case pos.hc.right
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : ¬j ≥ n
hh :
  ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 ((fun₀ | () => n) i_1) ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 i_1)
⊢ j ≥ n

Next tactic:
simpa [Finsupp.single_eq_same] using hh ()
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 ()
    · 

Proof state:
case neg
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : ¬j < n
⊢ (if (i, j).2 < n then (coeff R (i, j).1) φ * (coeff R (i, j).2) (MvPowerSeries.inv.aux a φ) else 0) =
    if (fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 < fun₀ | () => n then
      (MvPowerSeries.coeff R (fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).1) φ *
        (MvPowerSeries.coeff R (fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2) (MvPowerSeries.inv.aux a φ)
    else 0

Next tactic:
rw [if_neg H, if_neg]
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]
      

Proof state:
case neg.hnc
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : ¬j < n
⊢ ¬(fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 < fun₀ | () => n

Next tactic:
rintro ⟨_h₁, h₂⟩
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₂⟩
      

Proof state:
case neg.hnc.intro
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : ¬j < n
_h₁ :
  ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 i_1) ((fun₀ | () => n) i_1)
h₂ :
  ¬∀ (i_1 : Unit),
      PartialOrder.toPreorder.1.1 ((fun₀ | () => n) i_1) ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 i_1)
⊢ False

Next tactic:
apply h₂
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₂
      

Proof state:
case neg.hnc.intro
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : ¬j < n
_h₁ :
  ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 i_1) ((fun₀ | () => n) i_1)
h₂ :
  ¬∀ (i_1 : Unit),
      PartialOrder.toPreorder.1.1 ((fun₀ | () => n) i_1) ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 i_1)
⊢ ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 ((fun₀ | () => n) i_1) ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 i_1)

Next tactic:
rintro ⟨⟩
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 ⟨⟩
      

Proof state:
case neg.hnc.intro.unit
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : ¬j < n
_h₁ :
  ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 i_1) ((fun₀ | () => n) i_1)
h₂ :
  ¬∀ (i_1 : Unit),
      PartialOrder.toPreorder.1.1 ((fun₀ | () => n) i_1) ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 i_1)
⊢ PartialOrder.toPreorder.1.1 ((fun₀ | () => n) PUnit.unit)
    ((fun₀ | () => (i, j).1, fun₀ | () => (i, j).2).2 PUnit.unit)

Next tactic:
simpa [Finsupp.single_eq_same] using not_lt.1 H
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
  · 

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

Next tactic:
rintro ⟨i, j⟩ ⟨k, l⟩ _hij _hkl