l3lab/ntp-mathlib huggingface dataset:
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    split_ifs with h₁ h₂ <;> first |rfl|

Proof state:
case pos
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
m : σ →₀ ℕ
h₁ : ¬n = m
h✝ : m = n
⊢ 0 = a

Next tactic:
subst m
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    split_ifs with h₁ h₂ <;> first |rfl|subst m; 

Proof state:
case pos
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
h₁ : ¬n = n
⊢ 0 = a

Next tactic:
contradiction
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    split_ifs with h₁ h₂ <;> 

Proof state:
case neg
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
m : σ →₀ ℕ
h₁ : ¬n = m
h✝ : ¬m = n
⊢ 0 = 0

Next tactic:
first |rfl|subst m; contradiction
@[simp, norm_cast]
theorem coe_monomial (n : σ →₀ ℕ) (a : R) :
    (monomial n a : MvPowerSeries σ R) = MvPowerSeries.monomial R n a :=
  MvPowerSeries.ext fun m => by
    classical
    rw [coeff_coe, coeff_monomial, MvPowerSeries.coeff_monomial]
    split_ifs with h₁ h₂ <;> first |

Proof state:
case neg
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
a : R
m : σ →₀ ℕ
h₁ : ¬n = m
h✝ : ¬m = n
⊢ 0 = 0

Next tactic:
rfl
@[simp, norm_cast]
theorem coe_mul : ((φ * ψ : MvPolynomial σ R) : MvPowerSeries σ R) = φ * ψ :=
  MvPowerSeries.ext fun n => by
    

Proof state:
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
⊢ (MvPowerSeries.coeff R n) ↑(φ * ψ) = (MvPowerSeries.coeff R n) (↑φ * ↑ψ)

Next tactic:
classical
    simp only [coeff_coe, MvPowerSeries.coeff_mul, coeff_mul]
@[simp, norm_cast]
theorem coe_mul : ((φ * ψ : MvPolynomial σ R) : MvPowerSeries σ R) = φ * ψ :=
  MvPowerSeries.ext fun n => by
    classical
    

Proof state:
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
n : σ →₀ ℕ
⊢ (MvPowerSeries.coeff R n) ↑(φ * ψ) = (MvPowerSeries.coeff R n) (↑φ * ↑ψ)

Next tactic:
simp only [coeff_coe, MvPowerSeries.coeff_mul, coeff_mul]
set_option linter.deprecated false in
@[simp, norm_cast]
theorem coe_bit1 :
    ((bit1 φ : MvPolynomial σ R) : MvPowerSeries σ R) = bit1 (φ : MvPowerSeries σ R) := by
  

Proof state:
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
⊢ ↑(bit1 φ) = bit1 ↑φ

Next tactic:
rw [bit1, bit1, coe_add, coe_one, coe_bit0]
theorem coe_injective : Function.Injective (Coe.coe : MvPolynomial σ R → MvPowerSeries σ R) :=
    fun x y h => by
  

Proof state:
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ x y : MvPolynomial σ R
h : Coe.coe x = Coe.coe y
⊢ x = y

Next tactic:
ext
theorem coe_injective : Function.Injective (Coe.coe : MvPolynomial σ R → MvPowerSeries σ R) :=
    fun x y h => by
  ext
  

Proof state:
case a
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ x y : MvPolynomial σ R
h : Coe.coe x = Coe.coe y
m✝ : σ →₀ ℕ
⊢ coeff m✝ x = coeff m✝ y

Next tactic:
simp_rw [← coeff_coe]
theorem coe_injective : Function.Injective (Coe.coe : MvPolynomial σ R → MvPowerSeries σ R) :=
    fun x y h => by
  ext
  simp_rw [← coeff_coe]
  

Proof state:
case a
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ x y : MvPolynomial σ R
h : Coe.coe x = Coe.coe y
m✝ : σ →₀ ℕ
⊢ (MvPowerSeries.coeff R m✝) ↑x = (MvPowerSeries.coeff R m✝) ↑y

Next tactic:
congr
@[simp]
theorem coe_eq_zero_iff : (φ : MvPowerSeries σ R) = 0 ↔ φ = 0 := by 

Proof state:
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
⊢ ↑φ = 0 ↔ φ = 0

Next tactic:
rw [← coe_zero, coe_inj]
@[simp]
theorem coe_eq_one_iff : (φ : MvPowerSeries σ R) = 1 ↔ φ = 1 := by 

Proof state:
σ : Type u_1
R : Type u_2
inst✝ : CommSemiring R
φ ψ : MvPolynomial σ R
⊢ ↑φ = 1 ↔ φ = 1

Next tactic:
rw [← coe_one, coe_inj]
/-- The coercion from multivariable polynomials to multivariable power series
as an algebra homomorphism.
-/
def coeToMvPowerSeries.algHom : MvPolynomial σ R →ₐ[R] MvPowerSeries σ A :=
  { (MvPowerSeries.map σ (algebraMap R A)).comp coeToMvPowerSeries.ringHom with
    commutes' := fun r => by 

Proof state:
σ : Type u_1
R : Type u_2
inst✝² : CommSemiring R
φ ψ : MvPolynomial σ R
A : Type u_3
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
src✝ : MvPolynomial σ R →+* MvPowerSeries σ A := RingHom.comp (MvPowerSeries.map σ (algebraMap R A)) ringHom
r : R
⊢ OneHom.toFun
      (↑↑{ toMonoidHom := ↑src✝, map_zero' := (_ : OneHom.toFun (↑↑src✝) 0 = 0),
            map_add' :=
              (_ :
                ∀ (x y : MvPolynomial σ R),
                  OneHom.toFun (↑↑src✝) (x + y) = OneHom.toFun (↑↑src✝) x + OneHom.toFun (↑↑src✝) y) })
      ((algebraMap R (MvPolynomial σ R)) r) =
    (algebraMap R (MvPowerSeries σ A)) r

Next tactic:
simp [algebraMap_apply, MvPowerSeries.algebraMap_apply]
instance [Inhabited R] : Inhabited R⟦X⟧ := by
  

Proof state:
R : Type u_1
inst✝ : Inhabited R
⊢ Inhabited R⟦X⟧

Next tactic:
dsimp only [PowerSeries]
instance [Inhabited R] : Inhabited R⟦X⟧ := by
  dsimp only [PowerSeries]
  

Proof state:
R : Type u_1
inst✝ : Inhabited R
⊢ Inhabited (MvPowerSeries Unit R)

Next tactic:
infer_instance
instance [Zero R] : Zero R⟦X⟧ := by
  

Proof state:
R : Type u_1
inst✝ : Zero R
⊢ Zero R⟦X⟧

Next tactic:
dsimp only [PowerSeries]
instance [Zero R] : Zero R⟦X⟧ := by
  dsimp only [PowerSeries]
  

Proof state:
R : Type u_1
inst✝ : Zero R
⊢ Zero (MvPowerSeries Unit R)

Next tactic:
infer_instance
instance [AddMonoid R] : AddMonoid R⟦X⟧ := by
  

Proof state:
R : Type u_1
inst✝ : AddMonoid R
⊢ AddMonoid R⟦X⟧

Next tactic:
dsimp only [PowerSeries]
instance [AddMonoid R] : AddMonoid R⟦X⟧ := by
  dsimp only [PowerSeries]
  

Proof state:
R : Type u_1
inst✝ : AddMonoid R
⊢ AddMonoid (MvPowerSeries Unit R)

Next tactic:
infer_instance
instance [AddGroup R] : AddGroup R⟦X⟧ := by
  

Proof state:
R : Type u_1
inst✝ : AddGroup R
⊢ AddGroup R⟦X⟧

Next tactic:
dsimp only [PowerSeries]
instance [AddGroup R] : AddGroup R⟦X⟧ := by
  dsimp only [PowerSeries]
  

Proof state:
R : Type u_1
inst✝ : AddGroup R
⊢ AddGroup (MvPowerSeries Unit R)

Next tactic:
infer_instance
instance [AddCommMonoid R] : AddCommMonoid R⟦X⟧ := by
  

Proof state:
R : Type u_1
inst✝ : AddCommMonoid R
⊢ AddCommMonoid R⟦X⟧

Next tactic:
dsimp only [PowerSeries]
instance [AddCommMonoid R] : AddCommMonoid R⟦X⟧ := by
  dsimp only [PowerSeries]
  

Proof state:
R : Type u_1
inst✝ : AddCommMonoid R
⊢ AddCommMonoid (MvPowerSeries Unit R)

Next tactic:
infer_instance
instance [AddCommGroup R] : AddCommGroup R⟦X⟧ := by
  

Proof state:
R : Type u_1
inst✝ : AddCommGroup R
⊢ AddCommGroup R⟦X⟧

Next tactic:
dsimp only [PowerSeries]
instance [AddCommGroup R] : AddCommGroup R⟦X⟧ := by
  dsimp only [PowerSeries]
  

Proof state:
R : Type u_1
inst✝ : AddCommGroup R
⊢ AddCommGroup (MvPowerSeries Unit R)

Next tactic:
infer_instance
instance [Semiring R] : Semiring R⟦X⟧ := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
⊢ Semiring R⟦X⟧

Next tactic:
dsimp only [PowerSeries]
instance [Semiring R] : Semiring R⟦X⟧ := by
  dsimp only [PowerSeries]
  

Proof state:
R : Type u_1
inst✝ : Semiring R
⊢ Semiring (MvPowerSeries Unit R)

Next tactic:
infer_instance
instance [CommSemiring R] : CommSemiring R⟦X⟧ := by
  

Proof state:
R : Type u_1
inst✝ : CommSemiring R
⊢ CommSemiring R⟦X⟧

Next tactic:
dsimp only [PowerSeries]
instance [CommSemiring R] : CommSemiring R⟦X⟧ := by
  dsimp only [PowerSeries]
  

Proof state:
R : Type u_1
inst✝ : CommSemiring R
⊢ CommSemiring (MvPowerSeries Unit R)

Next tactic:
infer_instance
instance [Ring R] : Ring R⟦X⟧ := by
  

Proof state:
R : Type u_1
inst✝ : Ring R
⊢ Ring R⟦X⟧

Next tactic:
dsimp only [PowerSeries]
instance [Ring R] : Ring R⟦X⟧ := by
  dsimp only [PowerSeries]
  

Proof state:
R : Type u_1
inst✝ : Ring R
⊢ Ring (MvPowerSeries Unit R)

Next tactic:
infer_instance
instance [CommRing R] : CommRing R⟦X⟧ := by
  

Proof state:
R : Type u_1
inst✝ : CommRing R
⊢ CommRing R⟦X⟧

Next tactic:
dsimp only [PowerSeries]
instance [CommRing R] : CommRing R⟦X⟧ := by
  dsimp only [PowerSeries]
  

Proof state:
R : Type u_1
inst✝ : CommRing R
⊢ CommRing (MvPowerSeries Unit R)

Next tactic:
infer_instance
instance [Nontrivial R] : Nontrivial R⟦X⟧ := by
  

Proof state:
R : Type u_1
inst✝ : Nontrivial R
⊢ Nontrivial R⟦X⟧

Next tactic:
dsimp only [PowerSeries]
instance [Nontrivial R] : Nontrivial R⟦X⟧ := by
  dsimp only [PowerSeries]
  

Proof state:
R : Type u_1
inst✝ : Nontrivial R
⊢ Nontrivial (MvPowerSeries Unit R)

Next tactic:
infer_instance
instance {A} [Semiring R] [AddCommMonoid A] [Module R A] : Module R A⟦X⟧ := by
  

Proof state:
R : Type u_1
A : Type ?u.2647433
inst✝² : Semiring R
inst✝¹ : AddCommMonoid A
inst✝ : Module R A
⊢ Module R A⟦X⟧

Next tactic:
dsimp only [PowerSeries]
instance {A} [Semiring R] [AddCommMonoid A] [Module R A] : Module R A⟦X⟧ := by
  dsimp only [PowerSeries]
  

Proof state:
R : Type u_1
A : Type ?u.2647433
inst✝² : Semiring R
inst✝¹ : AddCommMonoid A
inst✝ : Module R A
⊢ Module R (MvPowerSeries Unit A)

Next tactic:
infer_instance
instance {A} [Semiring A] [CommSemiring R] [Algebra R A] : Algebra R A⟦X⟧ := by
  

Proof state:
R : Type u_1
A : Type ?u.2653235
inst✝² : Semiring A
inst✝¹ : CommSemiring R
inst✝ : Algebra R A
⊢ Algebra R A⟦X⟧

Next tactic:
dsimp only [PowerSeries]
instance {A} [Semiring A] [CommSemiring R] [Algebra R A] : Algebra R A⟦X⟧ := by
  dsimp only [PowerSeries]
  

Proof state:
R : Type u_1
A : Type ?u.2653235
inst✝² : Semiring A
inst✝¹ : CommSemiring R
inst✝ : Algebra R A
⊢ Algebra R (MvPowerSeries Unit A)

Next tactic:
infer_instance
theorem coeff_def {s : Unit →₀ ℕ} {n : ℕ} (h : s () = n) : coeff R n = MvPowerSeries.coeff R s := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
s : Unit →₀ ℕ
n : ℕ
h : s () = n
⊢ coeff R n = MvPowerSeries.coeff R s

Next tactic:
erw [coeff, ← h, ← Finsupp.unique_single s]
/-- Two formal power series are equal if all their coefficients are equal.-/
@[ext]
theorem ext {φ ψ : R⟦X⟧} (h : ∀ n, coeff R n φ = coeff R n ψ) : φ = ψ :=
  MvPowerSeries.ext fun n => by
    

Proof state:
R : Type u_1
inst✝ : Semiring R
φ ψ : R⟦X⟧
h : ∀ (n : ℕ), (coeff R n) φ = (coeff R n) ψ
n : Unit →₀ ℕ
⊢ (MvPowerSeries.coeff R n) φ = (MvPowerSeries.coeff R n) ψ

Next tactic:
rw [← coeff_def]
/-- Two formal power series are equal if all their coefficients are equal.-/
@[ext]
theorem ext {φ ψ : R⟦X⟧} (h : ∀ n, coeff R n φ = coeff R n ψ) : φ = ψ :=
  MvPowerSeries.ext fun n => by
    rw [← coeff_def]
    · 

Proof state:
R : Type u_1
inst✝ : Semiring R
φ ψ : R⟦X⟧
h : ∀ (n : ℕ), (coeff R n) φ = (coeff R n) ψ
n : Unit →₀ ℕ
⊢ (coeff R ?m.2655889) φ = (coeff R ?m.2655889) ψ

Next tactic:
apply h
/-- Two formal power series are equal if all their coefficients are equal.-/
@[ext]
theorem ext {φ ψ : R⟦X⟧} (h : ∀ n, coeff R n φ = coeff R n ψ) : φ = ψ :=
  MvPowerSeries.ext fun n => by
    rw [← coeff_def]
    · apply h
    

Proof state:
R : Type u_1
inst✝ : Semiring R
φ ψ : R⟦X⟧
h : ∀ (n : ℕ), (coeff R n) φ = (coeff R n) ψ
n : Unit →₀ ℕ
⊢ n () = ?m.2655889
R : Type u_1 inst✝ : Semiring R φ ψ : R⟦X⟧ h : ∀ (n : ℕ), (coeff R n) φ = (coeff R n) ψ n : Unit →₀ ℕ ⊢ ℕ

Next tactic:
rfl
theorem coeff_monomial (m n : ℕ) (a : R) : coeff R m (monomial R n a) = if m = n then a else 0 :=
  calc
    coeff R m (monomial R n a) = _ := MvPowerSeries.coeff_monomial _ _ _
    _ = if m = n then a else 0 := by 

Proof state:
R : Type u_1
inst✝ : Semiring R
m n : ℕ
a : R
⊢ (if (fun₀ | () => m) = fun₀ | () => n then a else 0) = if m = n then a else 0

Next tactic:
simp only [Finsupp.unique_single_eq_iff]
theorem monomial_eq_mk (n : ℕ) (a : R) : monomial R n a = mk fun m => if m = n then a else 0 :=
  ext fun m => by 

Proof state:
R : Type u_1
inst✝ : Semiring R
n : ℕ
a : R
m : ℕ
⊢ (coeff R m) ((monomial R n) a) = (coeff R m) (mk fun m => if m = n then a else 0)

Next tactic:
rw [coeff_monomial, coeff_mk]
@[simp]
theorem coeff_zero_eq_constantCoeff : ⇑(coeff R 0) = constantCoeff R := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
⊢ ⇑(coeff R 0) = ⇑(constantCoeff R)

Next tactic:
rw [coeff, Finsupp.single_zero]
@[simp]
theorem coeff_zero_eq_constantCoeff : ⇑(coeff R 0) = constantCoeff R := by
  rw [coeff, Finsupp.single_zero]
  

Proof state:
R : Type u_1
inst✝ : Semiring R
⊢ ⇑(MvPowerSeries.coeff R 0) = ⇑(constantCoeff R)

Next tactic:
rfl
theorem coeff_zero_eq_constantCoeff_apply (φ : R⟦X⟧) : coeff R 0 φ = constantCoeff R φ :=
  by 

Proof state:
R : Type u_1
inst✝ : Semiring R
φ : R⟦X⟧
⊢ (coeff R 0) φ = (constantCoeff R) φ

Next tactic:
rw [coeff_zero_eq_constantCoeff]
@[simp]
theorem monomial_zero_eq_C : ⇑(monomial R 0) = C R := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  

Proof state:
R : Type u_1
inst✝ : Semiring R
⊢ ⇑(monomial R 0) = ⇑(C R)

Next tactic:
erw [monomial, Finsupp.single_zero, MvPowerSeries.monomial_zero_eq_C]
theorem monomial_zero_eq_C_apply (a : R) : monomial R 0 a = C R a := by 

Proof state:
R : Type u_1
inst✝ : Semiring R
a : R
⊢ (monomial R 0) a = (C R) a

Next tactic:
simp
theorem coeff_C (n : ℕ) (a : R) : coeff R n (C R a : R⟦X⟧) = if n = 0 then a else 0 := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
n : ℕ
a : R
⊢ (coeff R n) ((C R) a) = if n = 0 then a else 0

Next tactic:
rw [← monomial_zero_eq_C_apply, coeff_monomial]
@[simp]
theorem coeff_zero_C (a : R) : coeff R 0 (C R a) = a := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
a : R
⊢ (coeff R 0) ((C R) a) = a

Next tactic:
rw [coeff_C, if_pos rfl]
theorem coeff_ne_zero_C {a : R} {n : ℕ} (h : n ≠ 0) : coeff R n (C R a) = 0 := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
a : R
n : ℕ
h : n ≠ 0
⊢ (coeff R n) ((C R) a) = 0

Next tactic:
rw [coeff_C, if_neg h]
theorem coeff_X (n : ℕ) : coeff R n (X : R⟦X⟧) = if n = 1 then 1 else 0 := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
n : ℕ
⊢ (coeff R n) X = if n = 1 then 1 else 0

Next tactic:
rw [X_eq, coeff_monomial]
@[simp]
theorem coeff_zero_X : coeff R 0 (X : R⟦X⟧) = 0 := by
  -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  

Proof state:
R : Type u_1
inst✝ : Semiring R
⊢ (coeff R 0) X = 0

Next tactic:
erw [coeff, Finsupp.single_zero, X, MvPowerSeries.coeff_zero_X]
@[simp]
theorem coeff_one_X : coeff R 1 (X : R⟦X⟧) = 1 := by 

Proof state:
R : Type u_1
inst✝ : Semiring R
⊢ (coeff R 1) X = 1

Next tactic:
rw [coeff_X, if_pos rfl]
@[simp]
theorem X_ne_zero [Nontrivial R] : (X : R⟦X⟧) ≠ 0 := fun H => by
  

Proof state:
R : Type u_1
inst✝¹ : Semiring R
inst✝ : Nontrivial R
H : X = 0
⊢ False

Next tactic:
simpa only [coeff_one_X, one_ne_zero, map_zero] using congr_arg (coeff R 1) H
theorem coeff_X_pow (m n : ℕ) : coeff R m ((X : R⟦X⟧) ^ n) = if m = n then 1 else 0 := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
m n : ℕ
⊢ (coeff R m) (X ^ n) = if m = n then 1 else 0

Next tactic:
rw [X_pow_eq, coeff_monomial]
@[simp]
theorem coeff_X_pow_self (n : ℕ) : coeff R n ((X : R⟦X⟧) ^ n) = 1 := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
n : ℕ
⊢ (coeff R n) (X ^ n) = 1

Next tactic:
rw [coeff_X_pow, if_pos rfl]
theorem coeff_mul (n : ℕ) (φ ψ : R⟦X⟧) :
    coeff R n (φ * ψ) = ∑ p in antidiagonal n, coeff R p.1 φ * coeff R p.2 ψ := by
  -- `rw` can't see that `PowerSeries = MvPowerSeries Unit`, so use `.trans`
  

Proof state:
R : Type u_1
inst✝ : Semiring R
n : ℕ
φ ψ : R⟦X⟧
⊢ (coeff R n) (φ * ψ) = ∑ p in antidiagonal n, (coeff R p.1) φ * (coeff R p.2) ψ

Next tactic:
refine (MvPowerSeries.coeff_mul _ φ ψ).trans ?_
theorem coeff_mul (n : ℕ) (φ ψ : R⟦X⟧) :
    coeff R n (φ * ψ) = ∑ p in antidiagonal n, coeff R p.1 φ * coeff R p.2 ψ := by
  -- `rw` can't see that `PowerSeries = MvPowerSeries Unit`, so use `.trans`
  refine (MvPowerSeries.coeff_mul _ φ ψ).trans ?_
  

Proof state:
R : Type u_1
inst✝ : Semiring R
n : ℕ
φ ψ : R⟦X⟧
⊢ ∑ p in antidiagonal fun₀ | () => n, (MvPowerSeries.coeff R p.1) φ * (MvPowerSeries.coeff R p.2) ψ =
    ∑ p in antidiagonal n, (coeff R p.1) φ * (coeff R p.2) ψ

Next tactic:
rw [Finsupp.antidiagonal_single, Finset.sum_map]
theorem coeff_mul (n : ℕ) (φ ψ : R⟦X⟧) :
    coeff R n (φ * ψ) = ∑ p in antidiagonal n, coeff R p.1 φ * coeff R p.2 ψ := by
  -- `rw` can't see that `PowerSeries = MvPowerSeries Unit`, so use `.trans`
  refine (MvPowerSeries.coeff_mul _ φ ψ).trans ?_
  rw [Finsupp.antidiagonal_single, Finset.sum_map]
  

Proof state:
R : Type u_1
inst✝ : Semiring R
n : ℕ
φ ψ : R⟦X⟧
⊢ ∑ x in antidiagonal n,
      (MvPowerSeries.coeff R
            ((Function.Embedding.prodMap { toFun := single (), inj' := (_ : Function.Injective (single ())) }
                  { toFun := single (), inj' := (_ : Function.Injective (single ())) })
                x).1)
          φ *
        (MvPowerSeries.coeff R
            ((Function.Embedding.prodMap { toFun := single (), inj' := (_ : Function.Injective (single ())) }
                  { toFun := single (), inj' := (_ : Function.Injective (single ())) })
                x).2)
          ψ =
    ∑ p in antidiagonal n, (coeff R p.1) φ * (coeff R p.2) ψ

Next tactic:
rfl
theorem smul_eq_C_mul (f : R⟦X⟧) (a : R) : a • f = C R a * f := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
f : R⟦X⟧
a : R
⊢ a • f = (C R) a * f

Next tactic:
ext
theorem smul_eq_C_mul (f : R⟦X⟧) (a : R) : a • f = C R a * f := by
  ext
  

Proof state:
case h
R : Type u_1
inst✝ : Semiring R
f : R⟦X⟧
a : R
n✝ : ℕ
⊢ (coeff R n✝) (a • f) = (coeff R n✝) ((C R) a * f)

Next tactic:
simp
@[simp]
theorem coeff_succ_mul_X (n : ℕ) (φ : R⟦X⟧) : coeff R (n + 1) (φ * X) = coeff R n φ := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
n : ℕ
φ : R⟦X⟧
⊢ (coeff R (n + 1)) (φ * X) = (coeff R n) φ

Next tactic:
simp only [coeff, Finsupp.single_add]
@[simp]
theorem coeff_succ_mul_X (n : ℕ) (φ : R⟦X⟧) : coeff R (n + 1) (φ * X) = coeff R n φ := by
  simp only [coeff, Finsupp.single_add]
  

Proof state:
R : Type u_1
inst✝ : Semiring R
n : ℕ
φ : R⟦X⟧
⊢ (MvPowerSeries.coeff R ((fun₀ | () => n) + fun₀ | () => 1)) (φ * X) = (MvPowerSeries.coeff R fun₀ | () => n) φ

Next tactic:
convert φ.coeff_add_mul_monomial (single () n) (single () 1) _
@[simp]
theorem coeff_succ_mul_X (n : ℕ) (φ : R⟦X⟧) : coeff R (n + 1) (φ * X) = coeff R n φ := by
  simp only [coeff, Finsupp.single_add]
  convert φ.coeff_add_mul_monomial (single () n) (single () 1) _
  

Proof state:
case h.e'_3
R : Type u_1
inst✝ : Semiring R
n : ℕ
φ : R⟦X⟧
⊢ (MvPowerSeries.coeff R fun₀ | () => n) φ = (MvPowerSeries.coeff R fun₀ | () => n) φ * 1

Next tactic:
rw [mul_one]
@[simp]
theorem coeff_succ_mul_X (n : ℕ) (φ : R⟦X⟧) : coeff R (n + 1) (φ * X) = coeff R n φ := by
  simp only [coeff, Finsupp.single_add]
  convert φ.coeff_add_mul_monomial (single () n) (single () 1) _
  rw [mul_one]; 

Proof state:
case h.e'_3
R : Type u_1
inst✝ : Semiring R
n : ℕ
φ : R⟦X⟧
⊢ (MvPowerSeries.coeff R fun₀ | () => n) φ = (MvPowerSeries.coeff R fun₀ | () => n) φ

Next tactic:
rfl
@[simp]
theorem coeff_succ_X_mul (n : ℕ) (φ : R⟦X⟧) : coeff R (n + 1) (X * φ) = coeff R n φ := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
n : ℕ
φ : R⟦X⟧
⊢ (coeff R (n + 1)) (X * φ) = (coeff R n) φ

Next tactic:
simp only [coeff, Finsupp.single_add, add_comm n 1]
@[simp]
theorem coeff_succ_X_mul (n : ℕ) (φ : R⟦X⟧) : coeff R (n + 1) (X * φ) = coeff R n φ := by
  simp only [coeff, Finsupp.single_add, add_comm n 1]
  

Proof state:
R : Type u_1
inst✝ : Semiring R
n : ℕ
φ : R⟦X⟧
⊢ (MvPowerSeries.coeff R ((fun₀ | () => 1) + fun₀ | () => n)) (X * φ) = (MvPowerSeries.coeff R fun₀ | () => n) φ

Next tactic:
convert φ.coeff_add_monomial_mul (single () 1) (single () n) _
@[simp]
theorem coeff_succ_X_mul (n : ℕ) (φ : R⟦X⟧) : coeff R (n + 1) (X * φ) = coeff R n φ := by
  simp only [coeff, Finsupp.single_add, add_comm n 1]
  convert φ.coeff_add_monomial_mul (single () 1) (single () n) _
  

Proof state:
case h.e'_3
R : Type u_1
inst✝ : Semiring R
n : ℕ
φ : R⟦X⟧
⊢ (MvPowerSeries.coeff R fun₀ | () => n) φ = 1 * (MvPowerSeries.coeff R fun₀ | () => n) φ

Next tactic:
rw [one_mul]
@[simp]
theorem coeff_succ_X_mul (n : ℕ) (φ : R⟦X⟧) : coeff R (n + 1) (X * φ) = coeff R n φ := by
  simp only [coeff, Finsupp.single_add, add_comm n 1]
  convert φ.coeff_add_monomial_mul (single () 1) (single () n) _
  rw [one_mul]; 

Proof state:
case h.e'_3
R : Type u_1
inst✝ : Semiring R
n : ℕ
φ : R⟦X⟧
⊢ (MvPowerSeries.coeff R fun₀ | () => n) φ = (MvPowerSeries.coeff R fun₀ | () => n) φ

Next tactic:
rfl
theorem coeff_zero_mul_X (φ : R⟦X⟧) : coeff R 0 (φ * X) = 0 := by 

Proof state:
R : Type u_1
inst✝ : Semiring R
φ : R⟦X⟧
⊢ (coeff R 0) (φ * X) = 0

Next tactic:
simp
theorem coeff_zero_X_mul (φ : R⟦X⟧) : coeff R 0 (X * φ) = 0 := by 

Proof state:
R : Type u_1
inst✝ : Semiring R
φ : R⟦X⟧
⊢ (coeff R 0) (X * φ) = 0

Next tactic:
simp
theorem coeff_C_mul_X_pow (x : R) (k n : ℕ) :
    coeff R n (C R x * X ^ k : R⟦X⟧) = if n = k then x else 0 := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
x : R
k n : ℕ
⊢ (coeff R n) ((C R) x * X ^ k) = if n = k then x else 0

Next tactic:
simp [X_pow_eq, coeff_monomial]
@[simp]
theorem coeff_mul_X_pow (p : R⟦X⟧) (n d : ℕ) :
    coeff R (d + n) (p * X ^ n) = coeff R d p := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
p : R⟦X⟧
n d : ℕ
⊢ (coeff R (d + n)) (p * X ^ n) = (coeff R d) p

Next tactic:
rw [coeff_mul, Finset.sum_eq_single (d, n), coeff_X_pow, if_pos rfl, mul_one]
@[simp]
theorem coeff_mul_X_pow (p : R⟦X⟧) (n d : ℕ) :
    coeff R (d + n) (p * X ^ n) = coeff R d p := by
  rw [coeff_mul, Finset.sum_eq_single (d, n), coeff_X_pow, if_pos rfl, mul_one]
  · 

Proof state:
case h₀
R : Type u_1
inst✝ : Semiring R
p : R⟦X⟧
n d : ℕ
⊢ ∀ b ∈ antidiagonal (d + n), b ≠ (d, n) → (coeff R b.1) p * (coeff R b.2) (X ^ n) = 0

Next tactic:
rintro ⟨i, j⟩ h1 h2
@[simp]
theorem coeff_mul_X_pow (p : R⟦X⟧) (n d : ℕ) :
    coeff R (d + n) (p * X ^ n) = coeff R d p := by
  rw [coeff_mul, Finset.sum_eq_single (d, n), coeff_X_pow, if_pos rfl, mul_one]
  · rintro ⟨i, j⟩ h1 h2
    

Proof state:
case h₀.mk
R : Type u_1
inst✝ : Semiring R
p : R⟦X⟧
n d i j : ℕ
h1 : (i, j) ∈ antidiagonal (d + n)
h2 : (i, j) ≠ (d, n)
⊢ (coeff R (i, j).1) p * (coeff R (i, j).2) (X ^ n) = 0

Next tactic:
rw [coeff_X_pow, if_neg, mul_zero]
@[simp]
theorem coeff_mul_X_pow (p : R⟦X⟧) (n d : ℕ) :
    coeff R (d + n) (p * X ^ n) = coeff R d p := by
  rw [coeff_mul, Finset.sum_eq_single (d, n), coeff_X_pow, if_pos rfl, mul_one]
  · rintro ⟨i, j⟩ h1 h2
    rw [coeff_X_pow, if_neg, mul_zero]
    

Proof state:
case h₀.mk.hnc
R : Type u_1
inst✝ : Semiring R
p : R⟦X⟧
n d i j : ℕ
h1 : (i, j) ∈ antidiagonal (d + n)
h2 : (i, j) ≠ (d, n)
⊢ ¬(i, j).2 = n

Next tactic:
rintro rfl
@[simp]
theorem coeff_mul_X_pow (p : R⟦X⟧) (n d : ℕ) :
    coeff R (d + n) (p * X ^ n) = coeff R d p := by
  rw [coeff_mul, Finset.sum_eq_single (d, n), coeff_X_pow, if_pos rfl, mul_one]
  · rintro ⟨i, j⟩ h1 h2
    rw [coeff_X_pow, if_neg, mul_zero]
    rintro rfl
    

Proof state:
case h₀.mk.hnc
R : Type u_1
inst✝ : Semiring R
p : R⟦X⟧
d i j : ℕ
h1 : (i, j) ∈ antidiagonal (d + (i, j).2)
h2 : (i, j) ≠ (d, (i, j).2)
⊢ False

Next tactic:
apply h2
@[simp]
theorem coeff_mul_X_pow (p : R⟦X⟧) (n d : ℕ) :
    coeff R (d + n) (p * X ^ n) = coeff R d p := by
  rw [coeff_mul, Finset.sum_eq_single (d, n), coeff_X_pow, if_pos rfl, mul_one]
  · rintro ⟨i, j⟩ h1 h2
    rw [coeff_X_pow, if_neg, mul_zero]
    rintro rfl
    apply h2
    

Proof state:
case h₀.mk.hnc
R : Type u_1
inst✝ : Semiring R
p : R⟦X⟧
d i j : ℕ
h1 : (i, j) ∈ antidiagonal (d + (i, j).2)
h2 : (i, j) ≠ (d, (i, j).2)
⊢ (i, j) = (d, (i, j).2)

Next tactic:
rw [mem_antidiagonal, add_right_cancel_iff] at h1