Theorem: PowerSeries.coeff_inv_aux
File: Mathlib/RingTheory/PowerSeries/Basic.lean

tactic: rw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux]
state_before: R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
⊢ ↑(coeff R n) (inv.aux a φ) =
    if n = 0 then a
    else
      -a *
        ∑ x in Finset.Nat.antidiagonal n, if x.snd < n then ↑(coeff R x.fst) φ * ↑(coeff R x.snd) (inv.aux a φ) else 0

tactic: simp only [Finsupp.single_eq_zero]
state_before: R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
⊢ (if single () n = 0 then a
    else
      -a *
        ∑ x in Finsupp.antidiagonal (single () n),
          if x.snd < single () n then
            ↑(MvPowerSeries.coeff R x.fst) φ * ↑(MvPowerSeries.coeff R x.snd) (MvPowerSeries.inv.aux a φ)
          else 0) =
    if n = 0 then a
    else
      -a *
        ∑ x in Finset.Nat.antidiagonal n,
          if x.snd < n then ↑(coeff R x.fst) φ * ↑(coeff R x.snd) (MvPowerSeries.inv.aux a φ) else 0

tactic: split_ifs
state_before: R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
⊢ (if n = 0 then a
    else
      -a *
        ∑ x in Finsupp.antidiagonal (single () n),
          if x.snd < single () n then
            ↑(MvPowerSeries.coeff R x.fst) φ * ↑(MvPowerSeries.coeff R x.snd) (MvPowerSeries.inv.aux a φ)
          else 0) =
    if n = 0 then a
    else
      -a *
        ∑ x in Finset.Nat.antidiagonal n,
          if x.snd < n then ↑(coeff R x.fst) φ * ↑(coeff R x.snd) (MvPowerSeries.inv.aux a φ) else 0

tactic: congr 1
state_before: case inr
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
⊢ (-a *
      ∑ x in Finsupp.antidiagonal (single () n),
        if x.snd < single () n then
          ↑(MvPowerSeries.coeff R x.fst) φ * ↑(MvPowerSeries.coeff R x.snd) (MvPowerSeries.inv.aux a φ)
        else 0) =
    -a *
      ∑ x in Finset.Nat.antidiagonal n,
        if x.snd < n then ↑(coeff R x.fst) φ * ↑(coeff R x.snd) (MvPowerSeries.inv.aux a φ) else 0

tactic: symm
state_before: case inr.e_a
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
⊢ (∑ x in Finsupp.antidiagonal (single () n),
      if x.snd < single () n then
        ↑(MvPowerSeries.coeff R x.fst) φ * ↑(MvPowerSeries.coeff R x.snd) (MvPowerSeries.inv.aux a φ)
      else 0) =
    ∑ x in Finset.Nat.antidiagonal n,
      if x.snd < n then ↑(coeff R x.fst) φ * ↑(coeff R x.snd) (MvPowerSeries.inv.aux a φ) else 0

tactic: apply Finset.sum_bij fun (p : ℕ × ℕ) _h => (single () p.1, single () p.2)
state_before: case inr.e_a
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
⊢ (∑ x in Finset.Nat.antidiagonal n,
      if x.snd < n then ↑(coeff R x.fst) φ * ↑(coeff R x.snd) (MvPowerSeries.inv.aux a φ) else 0) =
    ∑ x in Finsupp.antidiagonal (single () n),
      if x.snd < single () n then
        ↑(MvPowerSeries.coeff R x.fst) φ * ↑(MvPowerSeries.coeff R x.snd) (MvPowerSeries.inv.aux a φ)
      else 0

tactic: rfl
state_before: case inl
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : n = 0
⊢ a = a

tactic: rintro ⟨i, j⟩ hij
state_before: case inr.e_a.hi
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
⊢ ∀ (a : ℕ × ℕ), a ∈ Finset.Nat.antidiagonal n → (single () a.fst, single () a.snd) ∈ Finsupp.antidiagonal (single () n)

tactic: rw [Finset.Nat.mem_antidiagonal] at hij
state_before: case inr.e_a.hi.mk
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
hij : (i, j) ∈ Finset.Nat.antidiagonal n
⊢ (single () (i, j).fst, single () (i, j).snd) ∈ Finsupp.antidiagonal (single () n)

tactic: rw [Finsupp.mem_antidiagonal, ← Finsupp.single_add, hij]
state_before: case inr.e_a.hi.mk
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
hij : (i, j).fst + (i, j).snd = n
⊢ (single () (i, j).fst, single () (i, j).snd) ∈ Finsupp.antidiagonal (single () n)

tactic: rintro ⟨i, j⟩ _hij
state_before: case inr.e_a.h
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
⊢ ∀ (a_1 : ℕ × ℕ),
    a_1 ∈ Finset.Nat.antidiagonal n →
      (if a_1.snd < n then ↑(coeff R a_1.fst) φ * ↑(coeff R a_1.snd) (MvPowerSeries.inv.aux a φ) else 0) =
        if (single () a_1.fst, single () a_1.snd).snd < single () n then
          ↑(MvPowerSeries.coeff R (single () a_1.fst, single () a_1.snd).fst) φ *
            ↑(MvPowerSeries.coeff R (single () a_1.fst, single () a_1.snd).snd) (MvPowerSeries.inv.aux a φ)
        else 0

tactic: by_cases H : j < n
state_before: case inr.e_a.h.mk
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
⊢ (if (i, j).snd < n then ↑(coeff R (i, j).fst) φ * ↑(coeff R (i, j).snd) (MvPowerSeries.inv.aux a φ) else 0) =
    if (single () (i, j).fst, single () (i, j).snd).snd < single () n then
      ↑(MvPowerSeries.coeff R (single () (i, j).fst, single () (i, j).snd).fst) φ *
        ↑(MvPowerSeries.coeff R (single () (i, j).fst, single () (i, j).snd).snd) (MvPowerSeries.inv.aux a φ)
    else 0

tactic: rw [if_pos H, if_pos]
state_before: case pos
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : j < n
⊢ (if (i, j).snd < n then ↑(coeff R (i, j).fst) φ * ↑(coeff R (i, j).snd) (MvPowerSeries.inv.aux a φ) else 0) =
    if (single () (i, j).fst, single () (i, j).snd).snd < single () n then
      ↑(MvPowerSeries.coeff R (single () (i, j).fst, single () (i, j).snd).fst) φ *
        ↑(MvPowerSeries.coeff R (single () (i, j).fst, single () (i, j).snd).snd) (MvPowerSeries.inv.aux a φ)
    else 0

tactic: constructor
state_before: case pos.hc
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : j < n
⊢ (single () (i, j).fst, single () (i, j).snd).snd < single () n

tactic: rfl
state_before: case pos
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : j < n
⊢ ↑(coeff R (i, j).fst) φ * ↑(coeff R (i, j).snd) (MvPowerSeries.inv.aux a φ) =
    ↑(MvPowerSeries.coeff R (single () (i, j).fst, single () (i, j).snd).fst) φ *
      ↑(MvPowerSeries.coeff R (single () (i, j).fst, single () (i, j).snd).snd) (MvPowerSeries.inv.aux a φ)

tactic: rintro ⟨⟩
state_before: case pos.hc.left
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : j < n
⊢ ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 (↑(single () (i, j).fst, single () (i, j).snd).snd i_1) (↑(single () n) i_1)

tactic: simpa [Finsupp.single_eq_same] using le_of_lt H
state_before: case pos.hc.left.unit
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : j < n
⊢ PartialOrder.toPreorder.1.1 (↑(single () (i, j).fst, single () (i, j).snd).snd PUnit.unit) (↑(single () n) PUnit.unit)

tactic: intro hh
state_before: case pos.hc.right
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : j < n
⊢ ¬∀ (i_1 : Unit),
      PartialOrder.toPreorder.1.1 (↑(single () n) i_1) (↑(single () (i, j).fst, single () (i, j).snd).snd i_1)

tactic: rw [lt_iff_not_ge] at H
state_before: case pos.hc.right
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : j < n
hh :
  ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 (↑(single () n) i_1) (↑(single () (i, j).fst, single () (i, j).snd).snd i_1)
⊢ False

tactic: apply H
state_before: case pos.hc.right
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : ¬j ≥ n
hh :
  ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 (↑(single () n) i_1) (↑(single () (i, j).fst, single () (i, j).snd).snd i_1)
⊢ False

tactic: simpa [Finsupp.single_eq_same] using hh ()
state_before: case pos.hc.right
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : ¬j ≥ n
hh :
  ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 (↑(single () n) i_1) (↑(single () (i, j).fst, single () (i, j).snd).snd i_1)
⊢ j ≥ n

tactic: rw [if_neg H, if_neg]
state_before: case neg
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : ¬j < n
⊢ (if (i, j).snd < n then ↑(coeff R (i, j).fst) φ * ↑(coeff R (i, j).snd) (MvPowerSeries.inv.aux a φ) else 0) =
    if (single () (i, j).fst, single () (i, j).snd).snd < single () n then
      ↑(MvPowerSeries.coeff R (single () (i, j).fst, single () (i, j).snd).fst) φ *
        ↑(MvPowerSeries.coeff R (single () (i, j).fst, single () (i, j).snd).snd) (MvPowerSeries.inv.aux a φ)
    else 0

tactic: rintro ⟨_h₁, h₂⟩
state_before: case neg.hnc
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : ¬j < n
⊢ ¬(single () (i, j).fst, single () (i, j).snd).snd < single () n

tactic: apply h₂
state_before: case neg.hnc.intro
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : ¬j < n
_h₁ :
  ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 (↑(single () (i, j).fst, single () (i, j).snd).snd i_1) (↑(single () n) i_1)
h₂ :
  ¬∀ (i_1 : Unit),
      PartialOrder.toPreorder.1.1 (↑(single () n) i_1) (↑(single () (i, j).fst, single () (i, j).snd).snd i_1)
⊢ False

tactic: rintro ⟨⟩
state_before: case neg.hnc.intro
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : ¬j < n
_h₁ :
  ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 (↑(single () (i, j).fst, single () (i, j).snd).snd i_1) (↑(single () n) i_1)
h₂ :
  ¬∀ (i_1 : Unit),
      PartialOrder.toPreorder.1.1 (↑(single () n) i_1) (↑(single () (i, j).fst, single () (i, j).snd).snd i_1)
⊢ ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 (↑(single () n) i_1) (↑(single () (i, j).fst, single () (i, j).snd).snd i_1)

tactic: simpa [Finsupp.single_eq_same] using not_lt.1 H
state_before: case neg.hnc.intro.unit
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
H : ¬j < n
_h₁ :
  ∀ (i_1 : Unit),
    PartialOrder.toPreorder.1.1 (↑(single () (i, j).fst, single () (i, j).snd).snd i_1) (↑(single () n) i_1)
h₂ :
  ¬∀ (i_1 : Unit),
      PartialOrder.toPreorder.1.1 (↑(single () n) i_1) (↑(single () (i, j).fst, single () (i, j).snd).snd i_1)
⊢ PartialOrder.toPreorder.1.1 (↑(single () n) PUnit.unit) (↑(single () (i, j).fst, single () (i, j).snd).snd PUnit.unit)

tactic: rintro ⟨i, j⟩ ⟨k, l⟩ _hij _hkl
state_before: case inr.e_a.i_inj
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
⊢ ∀ (a₁ a₂ : ℕ × ℕ),
    a₁ ∈ Finset.Nat.antidiagonal n →
      a₂ ∈ Finset.Nat.antidiagonal n →
        (single () a₁.fst, single () a₁.snd) = (single () a₂.fst, single () a₂.snd) → a₁ = a₂

tactic: simpa only [Prod.mk.inj_iff, Finsupp.unique_single_eq_iff] using id
state_before: case inr.e_a.i_inj.mk.mk
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
i j k l : ℕ
_hij : (i, j) ∈ Finset.Nat.antidiagonal n
_hkl : (k, l) ∈ Finset.Nat.antidiagonal n
⊢ (single () (i, j).fst, single () (i, j).snd) = (single () (k, l).fst, single () (k, l).snd) → (i, j) = (k, l)

tactic: rintro ⟨f, g⟩ hfg
state_before: case inr.e_a.i_surj
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
⊢ ∀ (b : (Unit →₀ ℕ) × (Unit →₀ ℕ)),
    b ∈ Finsupp.antidiagonal (single () n) → ∃ a ha, b = (single () a.fst, single () a.snd)

tactic: refine' ⟨(f (), g ()), _, _⟩
state_before: case inr.e_a.i_surj.mk
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
f g : Unit →₀ ℕ
hfg : (f, g) ∈ Finsupp.antidiagonal (single () n)
⊢ ∃ a ha, (f, g) = (single () a.fst, single () a.snd)

tactic: rw [Finsupp.mem_antidiagonal] at hfg
state_before: case inr.e_a.i_surj.mk.refine'_1
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
f g : Unit →₀ ℕ
hfg : (f, g) ∈ Finsupp.antidiagonal (single () n)
⊢ (↑f (), ↑g ()) ∈ Finset.Nat.antidiagonal n

tactic: rw [Finset.Nat.mem_antidiagonal, ← Finsupp.add_apply, hfg, Finsupp.single_eq_same]
state_before: case inr.e_a.i_surj.mk.refine'_1
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
f g : Unit →₀ ℕ
hfg : (f, g).fst + (f, g).snd = single () n
⊢ (↑f (), ↑g ()) ∈ Finset.Nat.antidiagonal n

tactic: rw [Prod.mk.inj_iff]
state_before: case inr.e_a.i_surj.mk.refine'_2
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
f g : Unit →₀ ℕ
hfg : (f, g) ∈ Finsupp.antidiagonal (single () n)
⊢ (f, g) = (single () (↑f (), ↑g ()).fst, single () (↑f (), ↑g ()).snd)

tactic: dsimp
state_before: case inr.e_a.i_surj.mk.refine'_2
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
f g : Unit →₀ ℕ
hfg : (f, g) ∈ Finsupp.antidiagonal (single () n)
⊢ f = single () (↑f (), ↑g ()).fst ∧ g = single () (↑f (), ↑g ()).snd

tactic: exact ⟨Finsupp.unique_single f, Finsupp.unique_single g⟩
state_before: case inr.e_a.i_surj.mk.refine'_2
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : PowerSeries R
h✝ : ¬n = 0
f g : Unit →₀ ℕ
hfg : (f, g) ∈ Finsupp.antidiagonal (single () n)
⊢ f = single () (↑f ()) ∧ g = single () (↑g ())