l3lab/ntp-mathlib huggingface dataset:
/-- The order of the sum of two formal power series
 is the minimum of their orders if their orders differ.-/
theorem order_add_of_order_eq (φ ψ : R⟦X⟧) (h : order φ ≠ order ψ) :
    order (φ + ψ) = order φ ⊓ order ψ := by
  refine' le_antisymm _ (le_order_add _ _)
  by_cases H₁ : order φ < order ψ
  · apply order_add_of_order_eq.aux _ _ h H₁
  by_cases H₂ : order ψ < order φ
  · 

Proof state:
case pos
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
h : order φ ≠ order ψ
H₁ : ¬order φ < order ψ
H₂ : order ψ < order φ
⊢ order (φ + ψ) ≤ order φ ⊓ order ψ

Next tactic:
simpa only [add_comm, inf_comm] using order_add_of_order_eq.aux _ _ h.symm H₂
/-- The order of the sum of two formal power series
 is the minimum of their orders if their orders differ.-/
theorem order_add_of_order_eq (φ ψ : R⟦X⟧) (h : order φ ≠ order ψ) :
    order (φ + ψ) = order φ ⊓ order ψ := by
  refine' le_antisymm _ (le_order_add _ _)
  by_cases H₁ : order φ < order ψ
  · apply order_add_of_order_eq.aux _ _ h H₁
  by_cases H₂ : order ψ < order φ
  · simpa only [add_comm, inf_comm] using order_add_of_order_eq.aux _ _ h.symm H₂
  

Proof state:
case neg
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
h : order φ ≠ order ψ
H₁ : ¬order φ < order ψ
H₂ : ¬order ψ < order φ
⊢ order (φ + ψ) ≤ order φ ⊓ order ψ

Next tactic:
exfalso
/-- The order of the sum of two formal power series
 is the minimum of their orders if their orders differ.-/
theorem order_add_of_order_eq (φ ψ : R⟦X⟧) (h : order φ ≠ order ψ) :
    order (φ + ψ) = order φ ⊓ order ψ := by
  refine' le_antisymm _ (le_order_add _ _)
  by_cases H₁ : order φ < order ψ
  · apply order_add_of_order_eq.aux _ _ h H₁
  by_cases H₂ : order ψ < order φ
  · simpa only [add_comm, inf_comm] using order_add_of_order_eq.aux _ _ h.symm H₂
  exfalso; 

Proof state:
case neg.h
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
h : order φ ≠ order ψ
H₁ : ¬order φ < order ψ
H₂ : ¬order ψ < order φ
⊢ False

Next tactic:
exact h (le_antisymm (not_lt.1 H₂) (not_lt.1 H₁))
/-- The order of the product of two formal power series
 is at least the sum of their orders.-/
theorem order_mul_ge (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
⊢ order φ + order ψ ≤ order (φ * ψ)

Next tactic:
apply le_order
/-- The order of the product of two formal power series
 is at least the sum of their orders.-/
theorem order_mul_ge (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  apply le_order
  

Proof state:
case h
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
⊢ ∀ (i : ℕ), ↑i < order φ + order ψ → (coeff R i) (φ * ψ) = 0

Next tactic:
intro n hn
/-- The order of the product of two formal power series
 is at least the sum of their orders.-/
theorem order_mul_ge (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  apply le_order
  intro n hn; 

Proof state:
case h
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
hn : ↑n < order φ + order ψ
⊢ (coeff R n) (φ * ψ) = 0

Next tactic:
rw [coeff_mul, Finset.sum_eq_zero]
/-- The order of the product of two formal power series
 is at least the sum of their orders.-/
theorem order_mul_ge (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  apply le_order
  intro n hn; rw [coeff_mul, Finset.sum_eq_zero]
  

Proof state:
case h
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
hn : ↑n < order φ + order ψ
⊢ ∀ x ∈ antidiagonal n, (coeff R x.1) φ * (coeff R x.2) ψ = 0

Next tactic:
rintro ⟨i, j⟩ hij
/-- The order of the product of two formal power series
 is at least the sum of their orders.-/
theorem order_mul_ge (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  apply le_order
  intro n hn; rw [coeff_mul, Finset.sum_eq_zero]
  rintro ⟨i, j⟩ hij
  

Proof state:
case h.mk
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
hn : ↑n < order φ + order ψ
i j : ℕ
hij : (i, j) ∈ antidiagonal n
⊢ (coeff R (i, j).1) φ * (coeff R (i, j).2) ψ = 0

Next tactic:
by_cases hi : ↑i < order φ
/-- The order of the product of two formal power series
 is at least the sum of their orders.-/
theorem order_mul_ge (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  apply le_order
  intro n hn; rw [coeff_mul, Finset.sum_eq_zero]
  rintro ⟨i, j⟩ hij
  by_cases hi : ↑i < order φ
  · 

Proof state:
case pos
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
hn : ↑n < order φ + order ψ
i j : ℕ
hij : (i, j) ∈ antidiagonal n
hi : ↑i < order φ
⊢ (coeff R (i, j).1) φ * (coeff R (i, j).2) ψ = 0

Next tactic:
rw [coeff_of_lt_order i hi, zero_mul]
/-- The order of the product of two formal power series
 is at least the sum of their orders.-/
theorem order_mul_ge (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  apply le_order
  intro n hn; rw [coeff_mul, Finset.sum_eq_zero]
  rintro ⟨i, j⟩ hij
  by_cases hi : ↑i < order φ
  · rw [coeff_of_lt_order i hi, zero_mul]
  

Proof state:
case neg
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
hn : ↑n < order φ + order ψ
i j : ℕ
hij : (i, j) ∈ antidiagonal n
hi : ¬↑i < order φ
⊢ (coeff R (i, j).1) φ * (coeff R (i, j).2) ψ = 0

Next tactic:
by_cases hj : ↑j < order ψ
/-- The order of the product of two formal power series
 is at least the sum of their orders.-/
theorem order_mul_ge (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  apply le_order
  intro n hn; rw [coeff_mul, Finset.sum_eq_zero]
  rintro ⟨i, j⟩ hij
  by_cases hi : ↑i < order φ
  · rw [coeff_of_lt_order i hi, zero_mul]
  by_cases hj : ↑j < order ψ
  · 

Proof state:
case pos
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
hn : ↑n < order φ + order ψ
i j : ℕ
hij : (i, j) ∈ antidiagonal n
hi : ¬↑i < order φ
hj : ↑j < order ψ
⊢ (coeff R (i, j).1) φ * (coeff R (i, j).2) ψ = 0

Next tactic:
rw [coeff_of_lt_order j hj, mul_zero]
/-- The order of the product of two formal power series
 is at least the sum of their orders.-/
theorem order_mul_ge (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  apply le_order
  intro n hn; rw [coeff_mul, Finset.sum_eq_zero]
  rintro ⟨i, j⟩ hij
  by_cases hi : ↑i < order φ
  · rw [coeff_of_lt_order i hi, zero_mul]
  by_cases hj : ↑j < order ψ
  · rw [coeff_of_lt_order j hj, mul_zero]
  

Proof state:
case neg
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
hn : ↑n < order φ + order ψ
i j : ℕ
hij : (i, j) ∈ antidiagonal n
hi : ¬↑i < order φ
hj : ¬↑j < order ψ
⊢ (coeff R (i, j).1) φ * (coeff R (i, j).2) ψ = 0

Next tactic:
rw [not_lt] at hi hj
/-- The order of the product of two formal power series
 is at least the sum of their orders.-/
theorem order_mul_ge (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  apply le_order
  intro n hn; rw [coeff_mul, Finset.sum_eq_zero]
  rintro ⟨i, j⟩ hij
  by_cases hi : ↑i < order φ
  · rw [coeff_of_lt_order i hi, zero_mul]
  by_cases hj : ↑j < order ψ
  · rw [coeff_of_lt_order j hj, mul_zero]
  rw [not_lt] at hi hj; 

Proof state:
case neg
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
hn : ↑n < order φ + order ψ
i j : ℕ
hij : (i, j) ∈ antidiagonal n
hi : order φ ≤ ↑i
hj : order ψ ≤ ↑j
⊢ (coeff R (i, j).1) φ * (coeff R (i, j).2) ψ = 0

Next tactic:
rw [mem_antidiagonal] at hij
/-- The order of the product of two formal power series
 is at least the sum of their orders.-/
theorem order_mul_ge (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  apply le_order
  intro n hn; rw [coeff_mul, Finset.sum_eq_zero]
  rintro ⟨i, j⟩ hij
  by_cases hi : ↑i < order φ
  · rw [coeff_of_lt_order i hi, zero_mul]
  by_cases hj : ↑j < order ψ
  · rw [coeff_of_lt_order j hj, mul_zero]
  rw [not_lt] at hi hj; rw [mem_antidiagonal] at hij
  

Proof state:
case neg
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
hn : ↑n < order φ + order ψ
i j : ℕ
hij : (i, j).1 + (i, j).2 = n
hi : order φ ≤ ↑i
hj : order ψ ≤ ↑j
⊢ (coeff R (i, j).1) φ * (coeff R (i, j).2) ψ = 0

Next tactic:
exfalso
/-- The order of the product of two formal power series
 is at least the sum of their orders.-/
theorem order_mul_ge (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  apply le_order
  intro n hn; rw [coeff_mul, Finset.sum_eq_zero]
  rintro ⟨i, j⟩ hij
  by_cases hi : ↑i < order φ
  · rw [coeff_of_lt_order i hi, zero_mul]
  by_cases hj : ↑j < order ψ
  · rw [coeff_of_lt_order j hj, mul_zero]
  rw [not_lt] at hi hj; rw [mem_antidiagonal] at hij
  exfalso
  

Proof state:
case neg.h
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
hn : ↑n < order φ + order ψ
i j : ℕ
hij : (i, j).1 + (i, j).2 = n
hi : order φ ≤ ↑i
hj : order ψ ≤ ↑j
⊢ False

Next tactic:
apply ne_of_lt (lt_of_lt_of_le hn <| add_le_add hi hj)
/-- The order of the product of two formal power series
 is at least the sum of their orders.-/
theorem order_mul_ge (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  apply le_order
  intro n hn; rw [coeff_mul, Finset.sum_eq_zero]
  rintro ⟨i, j⟩ hij
  by_cases hi : ↑i < order φ
  · rw [coeff_of_lt_order i hi, zero_mul]
  by_cases hj : ↑j < order ψ
  · rw [coeff_of_lt_order j hj, mul_zero]
  rw [not_lt] at hi hj; rw [mem_antidiagonal] at hij
  exfalso
  apply ne_of_lt (lt_of_lt_of_le hn <| add_le_add hi hj)
  

Proof state:
case neg.h
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
hn : ↑n < order φ + order ψ
i j : ℕ
hij : (i, j).1 + (i, j).2 = n
hi : order φ ≤ ↑i
hj : order ψ ≤ ↑j
⊢ ↑n = ↑i + ↑j

Next tactic:
rw [← Nat.cast_add, hij]
/-- The order of the monomial `a*X^n` is infinite if `a = 0` and `n` otherwise.-/
theorem order_monomial (n : ℕ) (a : R) [Decidable (a = 0)] :
    order (monomial R n a) = if a = 0 then (⊤ : PartENat) else n := by
  

Proof state:
R : Type u_1
inst✝¹ : Semiring R
φ : R⟦X⟧
n : ℕ
a : R
inst✝ : Decidable (a = 0)
⊢ order ((monomial R n) a) = if a = 0 then ⊤ else ↑n

Next tactic:
split_ifs with h
/-- The order of the monomial `a*X^n` is infinite if `a = 0` and `n` otherwise.-/
theorem order_monomial (n : ℕ) (a : R) [Decidable (a = 0)] :
    order (monomial R n a) = if a = 0 then (⊤ : PartENat) else n := by
  split_ifs with h
  · 

Proof state:
case pos
R : Type u_1
inst✝¹ : Semiring R
φ : R⟦X⟧
n : ℕ
a : R
inst✝ : Decidable (a = 0)
h : a = 0
⊢ order ((monomial R n) a) = ⊤

Next tactic:
rw [h, order_eq_top, LinearMap.map_zero]
/-- The order of the monomial `a*X^n` is infinite if `a = 0` and `n` otherwise.-/
theorem order_monomial (n : ℕ) (a : R) [Decidable (a = 0)] :
    order (monomial R n a) = if a = 0 then (⊤ : PartENat) else n := by
  split_ifs with h
  · rw [h, order_eq_top, LinearMap.map_zero]
  · 

Proof state:
case neg
R : Type u_1
inst✝¹ : Semiring R
φ : R⟦X⟧
n : ℕ
a : R
inst✝ : Decidable (a = 0)
h : ¬a = 0
⊢ order ((monomial R n) a) = ↑n

Next tactic:
rw [order_eq]
/-- The order of the monomial `a*X^n` is infinite if `a = 0` and `n` otherwise.-/
theorem order_monomial (n : ℕ) (a : R) [Decidable (a = 0)] :
    order (monomial R n a) = if a = 0 then (⊤ : PartENat) else n := by
  split_ifs with h
  · rw [h, order_eq_top, LinearMap.map_zero]
  · rw [order_eq]
    

Proof state:
case neg
R : Type u_1
inst✝¹ : Semiring R
φ : R⟦X⟧
n : ℕ
a : R
inst✝ : Decidable (a = 0)
h : ¬a = 0
⊢ (∀ (i : ℕ), ↑i = ↑n → (coeff R i) ((monomial R n) a) ≠ 0) ∧ ∀ (i : ℕ), ↑i < ↑n → (coeff R i) ((monomial R n) a) = 0

Next tactic:
constructor
/-- The order of the monomial `a*X^n` is infinite if `a = 0` and `n` otherwise.-/
theorem order_monomial (n : ℕ) (a : R) [Decidable (a = 0)] :
    order (monomial R n a) = if a = 0 then (⊤ : PartENat) else n := by
  split_ifs with h
  · rw [h, order_eq_top, LinearMap.map_zero]
  · rw [order_eq]
    constructor <;> 

Proof state:
case neg.left
R : Type u_1
inst✝¹ : Semiring R
φ : R⟦X⟧
n : ℕ
a : R
inst✝ : Decidable (a = 0)
h : ¬a = 0
⊢ ∀ (i : ℕ), ↑i = ↑n → (coeff R i) ((monomial R n) a) ≠ 0

Next tactic:
intro i hi
/-- The order of the monomial `a*X^n` is infinite if `a = 0` and `n` otherwise.-/
theorem order_monomial (n : ℕ) (a : R) [Decidable (a = 0)] :
    order (monomial R n a) = if a = 0 then (⊤ : PartENat) else n := by
  split_ifs with h
  · rw [h, order_eq_top, LinearMap.map_zero]
  · rw [order_eq]
    constructor <;> 

Proof state:
case neg.right
R : Type u_1
inst✝¹ : Semiring R
φ : R⟦X⟧
n : ℕ
a : R
inst✝ : Decidable (a = 0)
h : ¬a = 0
⊢ ∀ (i : ℕ), ↑i < ↑n → (coeff R i) ((monomial R n) a) = 0

Next tactic:
intro i hi
/-- The order of the monomial `a*X^n` is infinite if `a = 0` and `n` otherwise.-/
theorem order_monomial (n : ℕ) (a : R) [Decidable (a = 0)] :
    order (monomial R n a) = if a = 0 then (⊤ : PartENat) else n := by
  split_ifs with h
  · rw [h, order_eq_top, LinearMap.map_zero]
  · rw [order_eq]
    constructor <;> intro i hi
    · 

Proof state:
case neg.left
R : Type u_1
inst✝¹ : Semiring R
φ : R⟦X⟧
n : ℕ
a : R
inst✝ : Decidable (a = 0)
h : ¬a = 0
i : ℕ
hi : ↑i = ↑n
⊢ (coeff R i) ((monomial R n) a) ≠ 0

Next tactic:
rw [PartENat.natCast_inj] at hi
/-- The order of the monomial `a*X^n` is infinite if `a = 0` and `n` otherwise.-/
theorem order_monomial (n : ℕ) (a : R) [Decidable (a = 0)] :
    order (monomial R n a) = if a = 0 then (⊤ : PartENat) else n := by
  split_ifs with h
  · rw [h, order_eq_top, LinearMap.map_zero]
  · rw [order_eq]
    constructor <;> intro i hi
    · rw [PartENat.natCast_inj] at hi
      

Proof state:
case neg.left
R : Type u_1
inst✝¹ : Semiring R
φ : R⟦X⟧
n : ℕ
a : R
inst✝ : Decidable (a = 0)
h : ¬a = 0
i : ℕ
hi : i = n
⊢ (coeff R i) ((monomial R n) a) ≠ 0

Next tactic:
rwa [hi, coeff_monomial_same]
/-- The order of the monomial `a*X^n` is infinite if `a = 0` and `n` otherwise.-/
theorem order_monomial (n : ℕ) (a : R) [Decidable (a = 0)] :
    order (monomial R n a) = if a = 0 then (⊤ : PartENat) else n := by
  split_ifs with h
  · rw [h, order_eq_top, LinearMap.map_zero]
  · rw [order_eq]
    constructor <;> intro i hi
    · rw [PartENat.natCast_inj] at hi
      rwa [hi, coeff_monomial_same]
    · 

Proof state:
case neg.right
R : Type u_1
inst✝¹ : Semiring R
φ : R⟦X⟧
n : ℕ
a : R
inst✝ : Decidable (a = 0)
h : ¬a = 0
i : ℕ
hi : ↑i < ↑n
⊢ (coeff R i) ((monomial R n) a) = 0

Next tactic:
rw [PartENat.coe_lt_coe] at hi
/-- The order of the monomial `a*X^n` is infinite if `a = 0` and `n` otherwise.-/
theorem order_monomial (n : ℕ) (a : R) [Decidable (a = 0)] :
    order (monomial R n a) = if a = 0 then (⊤ : PartENat) else n := by
  split_ifs with h
  · rw [h, order_eq_top, LinearMap.map_zero]
  · rw [order_eq]
    constructor <;> intro i hi
    · rw [PartENat.natCast_inj] at hi
      rwa [hi, coeff_monomial_same]
    · rw [PartENat.coe_lt_coe] at hi
      

Proof state:
case neg.right
R : Type u_1
inst✝¹ : Semiring R
φ : R⟦X⟧
n : ℕ
a : R
inst✝ : Decidable (a = 0)
h : ¬a = 0
i : ℕ
hi : i < n
⊢ (coeff R i) ((monomial R n) a) = 0

Next tactic:
rw [coeff_monomial, if_neg]
/-- The order of the monomial `a*X^n` is infinite if `a = 0` and `n` otherwise.-/
theorem order_monomial (n : ℕ) (a : R) [Decidable (a = 0)] :
    order (monomial R n a) = if a = 0 then (⊤ : PartENat) else n := by
  split_ifs with h
  · rw [h, order_eq_top, LinearMap.map_zero]
  · rw [order_eq]
    constructor <;> intro i hi
    · rw [PartENat.natCast_inj] at hi
      rwa [hi, coeff_monomial_same]
    · rw [PartENat.coe_lt_coe] at hi
      rw [coeff_monomial, if_neg]
      

Proof state:
case neg.right.hnc
R : Type u_1
inst✝¹ : Semiring R
φ : R⟦X⟧
n : ℕ
a : R
inst✝ : Decidable (a = 0)
h : ¬a = 0
i : ℕ
hi : i < n
⊢ ¬i = n

Next tactic:
exact ne_of_lt hi
/-- The order of the monomial `a*X^n` is `n` if `a ≠ 0`.-/
theorem order_monomial_of_ne_zero (n : ℕ) (a : R) (h : a ≠ 0) : order (monomial R n a) = n := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
φ : R⟦X⟧
n : ℕ
a : R
h : a ≠ 0
⊢ order ((monomial R n) a) = ↑n

Next tactic:
classical
  rw [order_monomial, if_neg h]
/-- The order of the monomial `a*X^n` is `n` if `a ≠ 0`.-/
theorem order_monomial_of_ne_zero (n : ℕ) (a : R) (h : a ≠ 0) : order (monomial R n a) = n := by
  classical
  

Proof state:
R : Type u_1
inst✝ : Semiring R
φ : R⟦X⟧
n : ℕ
a : R
h : a ≠ 0
⊢ order ((monomial R n) a) = ↑n

Next tactic:
rw [order_monomial, if_neg h]
/-- If `n` is strictly smaller than the order of `ψ`, then the `n`th coefficient of its product
with any other power series is `0`. -/
theorem coeff_mul_of_lt_order {φ ψ : R⟦X⟧} {n : ℕ} (h : ↑n < ψ.order) :
    coeff R n (φ * ψ) = 0 := by
  

Proof state:
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
h : ↑n < order ψ
⊢ (coeff R n) (φ * ψ) = 0

Next tactic:
suffices : coeff R n (φ * ψ) = ∑ p in antidiagonal n, 0
/-- If `n` is strictly smaller than the order of `ψ`, then the `n`th coefficient of its product
with any other power series is `0`. -/
theorem coeff_mul_of_lt_order {φ ψ : R⟦X⟧} {n : ℕ} (h : ↑n < ψ.order) :
    coeff R n (φ * ψ) = 0 := by
  suffices : coeff R n (φ * ψ) = ∑ p in antidiagonal n, 0
  

Proof state:
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
h : ↑n < order ψ
this : (coeff R n) (φ * ψ) = ∑ p in antidiagonal n, 0
⊢ (coeff R n) (φ * ψ) = 0
case this
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
h : ↑n < order ψ
⊢ (coeff R n) (φ * ψ) = ∑ p in antidiagonal n, 0

Next tactic:
rw [this, Finset.sum_const_zero]
/-- If `n` is strictly smaller than the order of `ψ`, then the `n`th coefficient of its product
with any other power series is `0`. -/
theorem coeff_mul_of_lt_order {φ ψ : R⟦X⟧} {n : ℕ} (h : ↑n < ψ.order) :
    coeff R n (φ * ψ) = 0 := by
  suffices : coeff R n (φ * ψ) = ∑ p in antidiagonal n, 0
  rw [this, Finset.sum_const_zero]
  

Proof state:
case this
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
h : ↑n < order ψ
⊢ (coeff R n) (φ * ψ) = ∑ p in antidiagonal n, 0

Next tactic:
rw [coeff_mul]
/-- If `n` is strictly smaller than the order of `ψ`, then the `n`th coefficient of its product
with any other power series is `0`. -/
theorem coeff_mul_of_lt_order {φ ψ : R⟦X⟧} {n : ℕ} (h : ↑n < ψ.order) :
    coeff R n (φ * ψ) = 0 := by
  suffices : coeff R n (φ * ψ) = ∑ p in antidiagonal n, 0
  rw [this, Finset.sum_const_zero]
  rw [coeff_mul]
  

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

Next tactic:
apply Finset.sum_congr rfl
/-- If `n` is strictly smaller than the order of `ψ`, then the `n`th coefficient of its product
with any other power series is `0`. -/
theorem coeff_mul_of_lt_order {φ ψ : R⟦X⟧} {n : ℕ} (h : ↑n < ψ.order) :
    coeff R n (φ * ψ) = 0 := by
  suffices : coeff R n (φ * ψ) = ∑ p in antidiagonal n, 0
  rw [this, Finset.sum_const_zero]
  rw [coeff_mul]
  apply Finset.sum_congr rfl
  

Proof state:
case this
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
h : ↑n < order ψ
⊢ ∀ x ∈ antidiagonal n, (coeff R x.1) φ * (coeff R x.2) ψ = 0

Next tactic:
intro x hx
/-- If `n` is strictly smaller than the order of `ψ`, then the `n`th coefficient of its product
with any other power series is `0`. -/
theorem coeff_mul_of_lt_order {φ ψ : R⟦X⟧} {n : ℕ} (h : ↑n < ψ.order) :
    coeff R n (φ * ψ) = 0 := by
  suffices : coeff R n (φ * ψ) = ∑ p in antidiagonal n, 0
  rw [this, Finset.sum_const_zero]
  rw [coeff_mul]
  apply Finset.sum_congr rfl
  intro x hx
  

Proof state:
case this
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
h : ↑n < order ψ
x : ℕ × ℕ
hx : x ∈ antidiagonal n
⊢ (coeff R x.1) φ * (coeff R x.2) ψ = 0

Next tactic:
refine' mul_eq_zero_of_right (coeff R x.fst φ) (coeff_of_lt_order x.snd (lt_of_le_of_lt _ h))
/-- If `n` is strictly smaller than the order of `ψ`, then the `n`th coefficient of its product
with any other power series is `0`. -/
theorem coeff_mul_of_lt_order {φ ψ : R⟦X⟧} {n : ℕ} (h : ↑n < ψ.order) :
    coeff R n (φ * ψ) = 0 := by
  suffices : coeff R n (φ * ψ) = ∑ p in antidiagonal n, 0
  rw [this, Finset.sum_const_zero]
  rw [coeff_mul]
  apply Finset.sum_congr rfl
  intro x hx
  refine' mul_eq_zero_of_right (coeff R x.fst φ) (coeff_of_lt_order x.snd (lt_of_le_of_lt _ h))
  

Proof state:
case this
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
h : ↑n < order ψ
x : ℕ × ℕ
hx : x ∈ antidiagonal n
⊢ ↑x.2 ≤ ↑n

Next tactic:
rw [mem_antidiagonal] at hx
/-- If `n` is strictly smaller than the order of `ψ`, then the `n`th coefficient of its product
with any other power series is `0`. -/
theorem coeff_mul_of_lt_order {φ ψ : R⟦X⟧} {n : ℕ} (h : ↑n < ψ.order) :
    coeff R n (φ * ψ) = 0 := by
  suffices : coeff R n (φ * ψ) = ∑ p in antidiagonal n, 0
  rw [this, Finset.sum_const_zero]
  rw [coeff_mul]
  apply Finset.sum_congr rfl
  intro x hx
  refine' mul_eq_zero_of_right (coeff R x.fst φ) (coeff_of_lt_order x.snd (lt_of_le_of_lt _ h))
  rw [mem_antidiagonal] at hx
  

Proof state:
case this
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
h : ↑n < order ψ
x : ℕ × ℕ
hx : x.1 + x.2 = n
⊢ ↑x.2 ≤ ↑n

Next tactic:
norm_cast
/-- If `n` is strictly smaller than the order of `ψ`, then the `n`th coefficient of its product
with any other power series is `0`. -/
theorem coeff_mul_of_lt_order {φ ψ : R⟦X⟧} {n : ℕ} (h : ↑n < ψ.order) :
    coeff R n (φ * ψ) = 0 := by
  suffices : coeff R n (φ * ψ) = ∑ p in antidiagonal n, 0
  rw [this, Finset.sum_const_zero]
  rw [coeff_mul]
  apply Finset.sum_congr rfl
  intro x hx
  refine' mul_eq_zero_of_right (coeff R x.fst φ) (coeff_of_lt_order x.snd (lt_of_le_of_lt _ h))
  rw [mem_antidiagonal] at hx
  norm_cast
  

Proof state:
case this
R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : R⟦X⟧
n : ℕ
h : ↑n < order ψ
x : ℕ × ℕ
hx : x.1 + x.2 = n
⊢ x.2 ≤ n

Next tactic:
linarith
theorem coeff_mul_one_sub_of_lt_order {R : Type*} [CommRing R] {φ ψ : R⟦X⟧} (n : ℕ)
    (h : ↑n < ψ.order) : coeff R n (φ * (1 - ψ)) = coeff R n φ := by
  

Proof state:
R✝ : Type u_1
inst✝¹ : Semiring R✝
φ✝ : R✝⟦X⟧
R : Type u_2
inst✝ : CommRing R
φ ψ : R⟦X⟧
n : ℕ
h : ↑n < order ψ
⊢ (coeff R n) (φ * (1 - ψ)) = (coeff R n) φ

Next tactic:
simp [coeff_mul_of_lt_order h, mul_sub]
theorem coeff_mul_prod_one_sub_of_lt_order {R ι : Type*} [CommRing R] (k : ℕ) (s : Finset ι)
    (φ : R⟦X⟧) (f : ι → R⟦X⟧) :
    (∀ i ∈ s, ↑k < (f i).order) → coeff R k (φ * ∏ i in s, (1 - f i)) = coeff R k φ := by
  

Proof state:
R✝ : Type u_1
inst✝¹ : Semiring R✝
φ✝ : R✝⟦X⟧
R : Type u_2
ι : Type u_3
inst✝ : CommRing R
k : ℕ
s : Finset ι
φ : R⟦X⟧
f : ι → R⟦X⟧
⊢ (∀ i ∈ s, ↑k < order (f i)) → (coeff R k) (φ * ∏ i in s, (1 - f i)) = (coeff R k) φ

Next tactic:
classical
  induction' s using Finset.induction_on with a s ha ih t
  · simp
  · intro t
    simp only [Finset.mem_insert, forall_eq_or_imp] at t
    rw [Finset.prod_insert ha, ← mul_assoc, mul_right_comm, coeff_mul_one_sub_of_lt_order _ t.1]
    exact ih t.2
theorem coeff_mul_prod_one_sub_of_lt_order {R ι : Type*} [CommRing R] (k : ℕ) (s : Finset ι)
    (φ : R⟦X⟧) (f : ι → R⟦X⟧) :
    (∀ i ∈ s, ↑k < (f i).order) → coeff R k (φ * ∏ i in s, (1 - f i)) = coeff R k φ := by
  classical
  

Proof state:
R✝ : Type u_1
inst✝¹ : Semiring R✝
φ✝ : R✝⟦X⟧
R : Type u_2
ι : Type u_3
inst✝ : CommRing R
k : ℕ
s : Finset ι
φ : R⟦X⟧
f : ι → R⟦X⟧
⊢ (∀ i ∈ s, ↑k < order (f i)) → (coeff R k) (φ * ∏ i in s, (1 - f i)) = (coeff R k) φ

Next tactic:
induction' s using Finset.induction_on with a s ha ih t
theorem coeff_mul_prod_one_sub_of_lt_order {R ι : Type*} [CommRing R] (k : ℕ) (s : Finset ι)
    (φ : R⟦X⟧) (f : ι → R⟦X⟧) :
    (∀ i ∈ s, ↑k < (f i).order) → coeff R k (φ * ∏ i in s, (1 - f i)) = coeff R k φ := by
  classical
  induction' s using Finset.induction_on with a s ha ih t
  · 

Proof state:
case empty
R✝ : Type u_1
inst✝¹ : Semiring R✝
φ✝ : R✝⟦X⟧
R : Type u_2
ι : Type u_3
inst✝ : CommRing R
k : ℕ
φ : R⟦X⟧
f : ι → R⟦X⟧
⊢ (∀ i ∈ ∅, ↑k < order (f i)) → (coeff R k) (φ * ∏ i in ∅, (1 - f i)) = (coeff R k) φ

Next tactic:
simp
theorem coeff_mul_prod_one_sub_of_lt_order {R ι : Type*} [CommRing R] (k : ℕ) (s : Finset ι)
    (φ : R⟦X⟧) (f : ι → R⟦X⟧) :
    (∀ i ∈ s, ↑k < (f i).order) → coeff R k (φ * ∏ i in s, (1 - f i)) = coeff R k φ := by
  classical
  induction' s using Finset.induction_on with a s ha ih t
  · simp
  · 

Proof state:
case insert
R✝ : Type u_1
inst✝¹ : Semiring R✝
φ✝ : R✝⟦X⟧
R : Type u_2
ι : Type u_3
inst✝ : CommRing R
k : ℕ
φ : R⟦X⟧
f : ι → R⟦X⟧
a : ι
s : Finset ι
ha : a ∉ s
ih : (∀ i ∈ s, ↑k < order (f i)) → (coeff R k) (φ * ∏ i in s, (1 - f i)) = (coeff R k) φ
⊢ (∀ i ∈ insert a s, ↑k < order (f i)) → (coeff R k) (φ * ∏ i in insert a s, (1 - f i)) = (coeff R k) φ

Next tactic:
intro t