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

tactic: erw [coeff, inv.aux, MvPowerSeries.coeff_inv_aux]
state_before: R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
⊢ (coeff R n) (inv.aux a φ) =
    if n = 0 then a else -a * ∑ x ∈ antidiagonal n, if x.2 < n then (coeff R x.1) φ * (coeff R x.2) (inv.aux a φ) else 0
state_after: R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
⊢ (if single () n = 0 then a
    else
      -a *
        ∑ x ∈ antidiagonal (single () n),
          if x.2 < single () n then
            (MvPowerSeries.coeff R x.1) φ * (MvPowerSeries.coeff R x.2) (MvPowerSeries.inv.aux a φ)
          else 0) =
    if n = 0 then a
    else -a * ∑ x ∈ antidiagonal n, if x.2 < n then (coeff R x.1) φ * (coeff R x.2) (MvPowerSeries.inv.aux a φ) else 0

tactic: simp only [Finsupp.single_eq_zero]
state_before: R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
⊢ (if single () n = 0 then a
    else
      -a *
        ∑ x ∈ antidiagonal (single () n),
          if x.2 < single () n then
            (MvPowerSeries.coeff R x.1) φ * (MvPowerSeries.coeff R x.2) (MvPowerSeries.inv.aux a φ)
          else 0) =
    if n = 0 then a
    else -a * ∑ x ∈ antidiagonal n, if x.2 < n then (coeff R x.1) φ * (coeff R x.2) (MvPowerSeries.inv.aux a φ) else 0
state_after: R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
⊢ (if n = 0 then a
    else
      -a *
        ∑ x ∈ antidiagonal (single () n),
          if x.2 < single () n then
            (MvPowerSeries.coeff R x.1) φ * (MvPowerSeries.coeff R x.2) (MvPowerSeries.inv.aux a φ)
          else 0) =
    if n = 0 then a
    else -a * ∑ x ∈ antidiagonal n, if x.2 < n then (coeff R x.1) φ * (coeff R x.2) (MvPowerSeries.inv.aux a φ) else 0

tactic: split_ifs
state_before: R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
⊢ (if n = 0 then a
    else
      -a *
        ∑ x ∈ antidiagonal (single () n),
          if x.2 < single () n then
            (MvPowerSeries.coeff R x.1) φ * (MvPowerSeries.coeff R x.2) (MvPowerSeries.inv.aux a φ)
          else 0) =
    if n = 0 then a
    else -a * ∑ x ∈ antidiagonal n, if x.2 < n then (coeff R x.1) φ * (coeff R x.2) (MvPowerSeries.inv.aux a φ) else 0
state_after: case pos
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : n = 0
⊢ a = a

case neg
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ (-a *
      ∑ x ∈ antidiagonal (single () n),
        if x.2 < single () n then
          (MvPowerSeries.coeff R x.1) φ * (MvPowerSeries.coeff R x.2) (MvPowerSeries.inv.aux a φ)
        else 0) =
    -a * ∑ x ∈ antidiagonal n, if x.2 < n then (coeff R x.1) φ * (coeff R x.2) (MvPowerSeries.inv.aux a φ) else 0

tactic: congr 1
state_before: case neg
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ (-a *
      ∑ x ∈ antidiagonal (single () n),
        if x.2 < single () n then
          (MvPowerSeries.coeff R x.1) φ * (MvPowerSeries.coeff R x.2) (MvPowerSeries.inv.aux a φ)
        else 0) =
    -a * ∑ x ∈ antidiagonal n, if x.2 < n then (coeff R x.1) φ * (coeff R x.2) (MvPowerSeries.inv.aux a φ) else 0
state_after: case neg.e_a
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ (∑ x ∈ antidiagonal (single () n),
      if x.2 < single () n then (MvPowerSeries.coeff R x.1) φ * (MvPowerSeries.coeff R x.2) (MvPowerSeries.inv.aux a φ)
      else 0) =
    ∑ x ∈ antidiagonal n, if x.2 < n then (coeff R x.1) φ * (coeff R x.2) (MvPowerSeries.inv.aux a φ) else 0

tactic: symm
state_before: case neg.e_a
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ (∑ x ∈ antidiagonal (single () n),
      if x.2 < single () n then (MvPowerSeries.coeff R x.1) φ * (MvPowerSeries.coeff R x.2) (MvPowerSeries.inv.aux a φ)
      else 0) =
    ∑ x ∈ antidiagonal n, if x.2 < n then (coeff R x.1) φ * (coeff R x.2) (MvPowerSeries.inv.aux a φ) else 0
state_after: case neg.e_a
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ (∑ x ∈ antidiagonal n, if x.2 < n then (coeff R x.1) φ * (coeff R x.2) (MvPowerSeries.inv.aux a φ) else 0) =
    ∑ x ∈ antidiagonal (single () n),
      if x.2 < single () n then (MvPowerSeries.coeff R x.1) φ * (MvPowerSeries.coeff R x.2) (MvPowerSeries.inv.aux a φ)
      else 0

tactic: apply Finset.sum_nbij' (fun (a, b) ↦ (single () a, single () b))
  fun (f, g) ↦ (f (), g ())
state_before: case neg.e_a
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ (∑ x ∈ antidiagonal n, if x.2 < n then (coeff R x.1) φ * (coeff R x.2) (MvPowerSeries.inv.aux a φ) else 0) =
    ∑ x ∈ antidiagonal (single () n),
      if x.2 < single () n then (MvPowerSeries.coeff R x.1) φ * (MvPowerSeries.coeff R x.2) (MvPowerSeries.inv.aux a φ)
      else 0
state_after: case neg.e_a.hi
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ ∀ a ∈ antidiagonal n,
    (match a with
      | (a, b) => (single () a, single () b)) ∈
      antidiagonal (single () n)

case neg.e_a.hj
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ ∀ a ∈ antidiagonal (single () n),
    (match a with
      | (f, g) => (f (), g ())) ∈
      antidiagonal n

case neg.e_a.left_inv
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ ∀ a ∈ antidiagonal n,
    (match
        match a with
        | (a, b) => (single () a, single () b) with
      | (f, g) => (f (), g ())) =
      a

case neg.e_a.right_inv
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ ∀ a ∈ antidiagonal (single () n),
    (match
        match a with
        | (f, g) => (f (), g ()) with
      | (a, b) => (single () a, single () b)) =
      a

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
          (match a_1 with
              | (a, b) => (single () a, single () b)).2 <
            single () n then
        (MvPowerSeries.coeff R
              (match a_1 with
                | (a, b) => (single () a, single () b)).1)
            φ *
          (MvPowerSeries.coeff R
              (match a_1 with
                | (a, b) => (single () a, single () b)).2)
            (MvPowerSeries.inv.aux a φ)
      else 0

tactic: rfl
state_before: case pos
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : n = 0
⊢ a = a
state_after: no goals

tactic: aesop
state_before: case neg.e_a.hi
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ ∀ a ∈ antidiagonal n,
    (match a with
      | (a, b) => (single () a, single () b)) ∈
      antidiagonal (single () n)
state_after: no goals

tactic: aesop
state_before: case neg.e_a.hj
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ ∀ a ∈ antidiagonal (single () n),
    (match a with
      | (f, g) => (f (), g ())) ∈
      antidiagonal n
state_after: no goals

tactic: aesop
state_before: case neg.e_a.left_inv
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ ∀ a ∈ antidiagonal n,
    (match
        match a with
        | (a, b) => (single () a, single () b) with
      | (f, g) => (f (), g ())) =
      a
state_after: no goals

tactic: aesop
state_before: case neg.e_a.right_inv
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
⊢ ∀ a ∈ antidiagonal (single () n),
    (match
        match a with
        | (f, g) => (f (), g ()) with
      | (a, b) => (single () a, single () b)) =
      a
state_after: no goals

tactic: rintro ⟨i, j⟩ _hij
state_before: 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
          (match a_1 with
              | (a, b) => (single () a, single () b)).2 <
            single () n then
        (MvPowerSeries.coeff R
              (match a_1 with
                | (a, b) => (single () a, single () b)).1)
            φ *
          (MvPowerSeries.coeff R
              (match a_1 with
                | (a, b) => (single () a, single () b)).2)
            (MvPowerSeries.inv.aux a φ)
      else 0
state_after: 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
        (match (i, j) with
            | (a, b) => (single () a, single () b)).2 <
          single () n then
      (MvPowerSeries.coeff R
            (match (i, j) with
              | (a, b) => (single () a, single () b)).1)
          φ *
        (MvPowerSeries.coeff R
            (match (i, j) with
              | (a, b) => (single () a, single () b)).2)
          (MvPowerSeries.inv.aux a φ)
    else 0

tactic: obtain H | H := le_or_lt n j
state_before: 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
        (match (i, j) with
            | (a, b) => (single () a, single () b)).2 <
          single () n then
      (MvPowerSeries.coeff R
            (match (i, j) with
              | (a, b) => (single () a, single () b)).1)
          φ *
        (MvPowerSeries.coeff R
            (match (i, j) with
              | (a, b) => (single () a, single () b)).2)
          (MvPowerSeries.inv.aux a φ)
    else 0
state_after: case neg.e_a.h.mk.inl
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : n ≤ j
⊢ (if (i, j).2 < n then (coeff R (i, j).1) φ * (coeff R (i, j).2) (MvPowerSeries.inv.aux a φ) else 0) =
    if
        (match (i, j) with
            | (a, b) => (single () a, single () b)).2 <
          single () n then
      (MvPowerSeries.coeff R
            (match (i, j) with
              | (a, b) => (single () a, single () b)).1)
          φ *
        (MvPowerSeries.coeff R
            (match (i, j) with
              | (a, b) => (single () a, single () b)).2)
          (MvPowerSeries.inv.aux a φ)
    else 0

case neg.e_a.h.mk.inr
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
        (match (i, j) with
            | (a, b) => (single () a, single () b)).2 <
          single () n then
      (MvPowerSeries.coeff R
            (match (i, j) with
              | (a, b) => (single () a, single () b)).1)
          φ *
        (MvPowerSeries.coeff R
            (match (i, j) with
              | (a, b) => (single () a, single () b)).2)
          (MvPowerSeries.inv.aux a φ)
    else 0

tactic: rw [if_pos H, if_pos]
state_before: case neg.e_a.h.mk.inr
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
        (match (i, j) with
            | (a, b) => (single () a, single () b)).2 <
          single () n then
      (MvPowerSeries.coeff R
            (match (i, j) with
              | (a, b) => (single () a, single () b)).1)
          φ *
        (MvPowerSeries.coeff R
            (match (i, j) with
              | (a, b) => (single () a, single () b)).2)
          (MvPowerSeries.inv.aux a φ)
    else 0
state_after: case neg.e_a.h.mk.inr
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
          (match (i, j) with
            | (a, b) => (single () a, single () b)).1)
        φ *
      (MvPowerSeries.coeff R
          (match (i, j) with
            | (a, b) => (single () a, single () b)).2)
        (MvPowerSeries.inv.aux a φ)

case neg.e_a.h.mk.inr.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
⊢ (match (i, j) with
      | (a, b) => (single () a, single () b)).2 <
    single () n

tactic: refine ⟨?_, fun hh ↦ H.not_le ?_⟩
state_before: case neg.e_a.h.mk.inr.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
⊢ (match (i, j) with
      | (a, b) => (single () a, single () b)).2 <
    single () n
state_after: case neg.e_a.h.mk.inr.hc.refine_1
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
⊢ (match (i, j) with
      | (a, b) => (single () a, single () b)).2 ≤
    single () n

case neg.e_a.h.mk.inr.hc.refine_2
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 :
  single () n ≤
    (match (i, j) with
      | (a, b) => (single () a, single () b)).2
⊢ n ≤ j

tactic: aesop
state_before: case neg.e_a.h.mk.inl
R : Type u_1
inst✝ : Ring R
n : ℕ
a : R
φ : R⟦X⟧
h✝ : ¬n = 0
i j : ℕ
_hij : (i, j) ∈ antidiagonal n
H : n ≤ j
⊢ (if (i, j).2 < n then (coeff R (i, j).1) φ * (coeff R (i, j).2) (MvPowerSeries.inv.aux a φ) else 0) =
    if
        (match (i, j) with
            | (a, b) => (single () a, single () b)).2 <
          single () n then
      (MvPowerSeries.coeff R
            (match (i, j) with
              | (a, b) => (single () a, single () b)).1)
          φ *
        (MvPowerSeries.coeff R
            (match (i, j) with
              | (a, b) => (single () a, single () b)).2)
          (MvPowerSeries.inv.aux a φ)
    else 0
state_after: no goals

tactic: rfl
state_before: case neg.e_a.h.mk.inr
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
          (match (i, j) with
            | (a, b) => (single () a, single () b)).1)
        φ *
      (MvPowerSeries.coeff R
          (match (i, j) with
            | (a, b) => (single () a, single () b)).2)
        (MvPowerSeries.inv.aux a φ)
state_after: no goals

tactic: rintro ⟨⟩
state_before: case neg.e_a.h.mk.inr.hc.refine_1
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
⊢ (match (i, j) with
      | (a, b) => (single () a, single () b)).2 ≤
    single () n
state_after: case neg.e_a.h.mk.inr.hc.refine_1.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
⊢ (match (i, j) with
        | (a, b) => (single () a, single () b)).2
      PUnit.unit ≤
    (single () n) PUnit.unit

tactic: simpa [Finsupp.single_eq_same] using le_of_lt H
state_before: case neg.e_a.h.mk.inr.hc.refine_1.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
⊢ (match (i, j) with
        | (a, b) => (single () a, single () b)).2
      PUnit.unit ≤
    (single () n) PUnit.unit
state_after: no goals

tactic: simpa [Finsupp.single_eq_same] using hh ()
state_before: case neg.e_a.h.mk.inr.hc.refine_2
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 :
  single () n ≤
    (match (i, j) with
      | (a, b) => (single () a, single () b)).2
⊢ n ≤ j
state_after: no goals