l3lab/ntp-mathlib huggingface dataset:
@[simp]
theorem degree_X_pow : degree ((X : R[X]) ^ n) = n := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Semiring R
inst✝ : Nontrivial R
p q : R[X]
n : ℕ
⊢ degree (X ^ n) = ↑n

Next tactic:
rw [X_pow_eq_monomial, degree_monomial _ (one_ne_zero' R)]
@[simp] lemma natDegree_mul_X (hp : p ≠ 0) : natDegree (p * X) = natDegree p + 1 := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Semiring R
inst✝ : Nontrivial R
p q : R[X]
n : ℕ
hp : p ≠ 0
⊢ natDegree (p * X) = natDegree p + 1

Next tactic:
rw [natDegree_mul' (by simpa), natDegree_X]
@[simp] lemma natDegree_mul_X (hp : p ≠ 0) : natDegree (p * X) = natDegree p + 1 := by
  rw [natDegree_mul' (by 

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Semiring R
inst✝ : Nontrivial R
p q : R[X]
n : ℕ
hp : p ≠ 0
⊢ leadingCoeff p * leadingCoeff X ≠ 0

Next tactic:
simpa
@[simp] lemma natDegree_X_mul (hp : p ≠ 0) : natDegree (X * p) = natDegree p + 1 := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Semiring R
inst✝ : Nontrivial R
p q : R[X]
n : ℕ
hp : p ≠ 0
⊢ natDegree (X * p) = natDegree p + 1

Next tactic:
rw [commute_X p, natDegree_mul_X hp]
@[simp] lemma natDegree_mul_X_pow (hp : p ≠ 0) : natDegree (p * X ^ n) = natDegree p + n := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Semiring R
inst✝ : Nontrivial R
p q : R[X]
n : ℕ
hp : p ≠ 0
⊢ natDegree (p * X ^ n) = natDegree p + n

Next tactic:
rw [natDegree_mul' (by simpa), natDegree_X_pow]
@[simp] lemma natDegree_mul_X_pow (hp : p ≠ 0) : natDegree (p * X ^ n) = natDegree p + n := by
  rw [natDegree_mul' (by 

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Semiring R
inst✝ : Nontrivial R
p q : R[X]
n : ℕ
hp : p ≠ 0
⊢ leadingCoeff p * leadingCoeff (X ^ n) ≠ 0

Next tactic:
simpa
@[simp] lemma natDegree_X_pow_mul (hp : p ≠ 0) : natDegree (X ^ n * p) = natDegree p + n := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Semiring R
inst✝ : Nontrivial R
p q : R[X]
n : ℕ
hp : p ≠ 0
⊢ natDegree (X ^ n * p) = natDegree p + n

Next tactic:
rw [commute_X_pow, natDegree_mul_X_pow n hp]
theorem natDegree_X_pow_le {R : Type*} [Semiring R] (n : ℕ) : (X ^ n : R[X]).natDegree ≤ n := by
  

Proof state:
R✝ : Type u
S : Type v
a b c d : R✝
n✝¹ m : ℕ
inst✝² : Semiring R✝
inst✝¹ : Nontrivial R✝
p q : R✝[X]
n✝ : ℕ
R : Type u_1
inst✝ : Semiring R
n : ℕ
⊢ natDegree (X ^ n) ≤ n

Next tactic:
nontriviality R
theorem natDegree_X_pow_le {R : Type*} [Semiring R] (n : ℕ) : (X ^ n : R[X]).natDegree ≤ n := by
  nontriviality R
  

Proof state:
R✝ : Type u
S : Type v
a b c d : R✝
n✝¹ m : ℕ
inst✝² : Semiring R✝
inst✝¹ : Nontrivial R✝
p q : R✝[X]
n✝ : ℕ
R : Type u_1
inst✝ : Semiring R
n : ℕ
✝ : Nontrivial R
⊢ natDegree (X ^ n) ≤ n

Next tactic:
rw [Polynomial.natDegree_X_pow]
theorem not_isUnit_X : ¬IsUnit (X : R[X]) := fun ⟨⟨_, g, _hfg, hgf⟩, rfl⟩ =>
  zero_ne_one' R <| by
    

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Semiring R
inst✝ : Nontrivial R
p q : R[X]
n : ℕ
x✝ : IsUnit X
g : R[X]
_hfg : (monomial 1) 1 * g = 1
hgf : g * (monomial 1) 1 = 1
⊢ 0 = 1

Next tactic:
rw [← coeff_one_zero, ← hgf]
theorem not_isUnit_X : ¬IsUnit (X : R[X]) := fun ⟨⟨_, g, _hfg, hgf⟩, rfl⟩ =>
  zero_ne_one' R <| by
    rw [← coeff_one_zero, ← hgf]
    

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Semiring R
inst✝ : Nontrivial R
p q : R[X]
n : ℕ
x✝ : IsUnit X
g : R[X]
_hfg : (monomial 1) 1 * g = 1
hgf : g * (monomial 1) 1 = 1
⊢ 0 = coeff (g * (monomial 1) 1) 0

Next tactic:
simp
@[simp]
theorem degree_mul_X : degree (p * X) = degree p + 1 := by 

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Semiring R
inst✝ : Nontrivial R
p q : R[X]
n : ℕ
⊢ degree (p * X) = degree p + 1

Next tactic:
simp [monic_X.degree_mul]
@[simp]
theorem degree_mul_X_pow : degree (p * X ^ n) = degree p + n := by 

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Semiring R
inst✝ : Nontrivial R
p q : R[X]
n : ℕ
⊢ degree (p * X ^ n) = degree p + ↑n

Next tactic:
simp [(monic_X_pow n).degree_mul]
theorem degree_sub_C (hp : 0 < degree p) : degree (p - C a) = degree p := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
hp : 0 < degree p
⊢ degree (p - C a) = degree p

Next tactic:
rw [sub_eq_add_neg, ← C_neg, degree_add_C hp]
@[simp]
theorem natDegree_sub_C {a : R} : natDegree (p - C a) = natDegree p := by
  

Proof state:
R : Type u
S : Type v
a✝ b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
a : R
⊢ natDegree (p - C a) = natDegree p

Next tactic:
rw [sub_eq_add_neg, ← C_neg, natDegree_add_C]
theorem degree_sub_le (p q : R[X]) : degree (p - q) ≤ max (degree p) (degree q) := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p✝ q✝ p q : R[X]
⊢ degree (p - q) ≤ max (degree p) (degree q)

Next tactic:
simpa only [degree_neg q] using degree_add_le p (-q)
theorem leadingCoeff_sub_of_degree_lt (h : Polynomial.degree q < Polynomial.degree p) :
    (p - q).leadingCoeff = p.leadingCoeff := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
h : degree q < degree p
⊢ leadingCoeff (p - q) = leadingCoeff p

Next tactic:
rw [← q.degree_neg] at h
theorem leadingCoeff_sub_of_degree_lt (h : Polynomial.degree q < Polynomial.degree p) :
    (p - q).leadingCoeff = p.leadingCoeff := by
  rw [← q.degree_neg] at h
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
h : degree (-q) < degree p
⊢ leadingCoeff (p - q) = leadingCoeff p

Next tactic:
rw [sub_eq_add_neg, leadingCoeff_add_of_degree_lt' h]
theorem leadingCoeff_sub_of_degree_lt' (h : Polynomial.degree p < Polynomial.degree q) :
    (p - q).leadingCoeff = -q.leadingCoeff := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
h : degree p < degree q
⊢ leadingCoeff (p - q) = -leadingCoeff q

Next tactic:
rw [← q.degree_neg] at h
theorem leadingCoeff_sub_of_degree_lt' (h : Polynomial.degree p < Polynomial.degree q) :
    (p - q).leadingCoeff = -q.leadingCoeff := by
  rw [← q.degree_neg] at h
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
h : degree p < degree (-q)
⊢ leadingCoeff (p - q) = -leadingCoeff q

Next tactic:
rw [sub_eq_add_neg, leadingCoeff_add_of_degree_lt h, leadingCoeff_neg]
theorem leadingCoeff_sub_of_degree_eq (h : degree p = degree q)
    (hlc : leadingCoeff p ≠ leadingCoeff q) :
    leadingCoeff (p - q) = leadingCoeff p - leadingCoeff q := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
h : degree p = degree q
hlc : leadingCoeff p ≠ leadingCoeff q
⊢ leadingCoeff (p - q) = leadingCoeff p - leadingCoeff q

Next tactic:
replace h : degree p = degree (-q) := by rwa [q.degree_neg]
theorem leadingCoeff_sub_of_degree_eq (h : degree p = degree q)
    (hlc : leadingCoeff p ≠ leadingCoeff q) :
    leadingCoeff (p - q) = leadingCoeff p - leadingCoeff q := by
  replace h : degree p = degree (-q) := by 

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
h : degree p = degree q
hlc : leadingCoeff p ≠ leadingCoeff q
⊢ degree p = degree (-q)

Next tactic:
rwa [q.degree_neg]
theorem leadingCoeff_sub_of_degree_eq (h : degree p = degree q)
    (hlc : leadingCoeff p ≠ leadingCoeff q) :
    leadingCoeff (p - q) = leadingCoeff p - leadingCoeff q := by
  replace h : degree p = degree (-q) := by rwa [q.degree_neg]
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
hlc : leadingCoeff p ≠ leadingCoeff q
h : degree p = degree (-q)
⊢ leadingCoeff (p - q) = leadingCoeff p - leadingCoeff q

Next tactic:
replace hlc : leadingCoeff p + leadingCoeff (-q) ≠ 0 := by
    rwa [← sub_ne_zero, sub_eq_add_neg, ← q.leadingCoeff_neg] at hlc
theorem leadingCoeff_sub_of_degree_eq (h : degree p = degree q)
    (hlc : leadingCoeff p ≠ leadingCoeff q) :
    leadingCoeff (p - q) = leadingCoeff p - leadingCoeff q := by
  replace h : degree p = degree (-q) := by rwa [q.degree_neg]
  replace hlc : leadingCoeff p + leadingCoeff (-q) ≠ 0 := by
    

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
hlc : leadingCoeff p ≠ leadingCoeff q
h : degree p = degree (-q)
⊢ leadingCoeff p + leadingCoeff (-q) ≠ 0

Next tactic:
rwa [← sub_ne_zero, sub_eq_add_neg, ← q.leadingCoeff_neg] at hlc
theorem leadingCoeff_sub_of_degree_eq (h : degree p = degree q)
    (hlc : leadingCoeff p ≠ leadingCoeff q) :
    leadingCoeff (p - q) = leadingCoeff p - leadingCoeff q := by
  replace h : degree p = degree (-q) := by rwa [q.degree_neg]
  replace hlc : leadingCoeff p + leadingCoeff (-q) ≠ 0 := by
    rwa [← sub_ne_zero, sub_eq_add_neg, ← q.leadingCoeff_neg] at hlc
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
h : degree p = degree (-q)
hlc : leadingCoeff p + leadingCoeff (-q) ≠ 0
⊢ leadingCoeff (p - q) = leadingCoeff p - leadingCoeff q

Next tactic:
rw [sub_eq_add_neg, leadingCoeff_add_of_degree_eq h hlc, leadingCoeff_neg, sub_eq_add_neg]
theorem natDegree_sub_le (p q : R[X]) : natDegree (p - q) ≤ max (natDegree p) (natDegree q) := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p✝ q✝ p q : R[X]
⊢ natDegree (p - q) ≤ max (natDegree p) (natDegree q)

Next tactic:
simpa only [← natDegree_neg q] using natDegree_add_le p (-q)
theorem degree_sub_lt (hd : degree p = degree q) (hp0 : p ≠ 0)
    (hlc : leadingCoeff p = leadingCoeff q) : degree (p - q) < degree p :=
  have hp : monomial (natDegree p) (leadingCoeff p) + p.erase (natDegree p) = p :=
    monomial_add_erase _ _
  have hq : monomial (natDegree q) (leadingCoeff q) + q.erase (natDegree q) = q :=
    monomial_add_erase _ _
  have hd' : natDegree p = natDegree q := by 

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
hd : degree p = degree q
hp0 : p ≠ 0
hlc : leadingCoeff p = leadingCoeff q
hp : (monomial (natDegree p)) (leadingCoeff p) + erase (natDegree p) p = p
hq : (monomial (natDegree q)) (leadingCoeff q) + erase (natDegree q) q = q
⊢ natDegree p = natDegree q

Next tactic:
unfold natDegree
theorem degree_sub_lt (hd : degree p = degree q) (hp0 : p ≠ 0)
    (hlc : leadingCoeff p = leadingCoeff q) : degree (p - q) < degree p :=
  have hp : monomial (natDegree p) (leadingCoeff p) + p.erase (natDegree p) = p :=
    monomial_add_erase _ _
  have hq : monomial (natDegree q) (leadingCoeff q) + q.erase (natDegree q) = q :=
    monomial_add_erase _ _
  have hd' : natDegree p = natDegree q := by unfold natDegree; 

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
hd : degree p = degree q
hp0 : p ≠ 0
hlc : leadingCoeff p = leadingCoeff q
hp : (monomial (natDegree p)) (leadingCoeff p) + erase (natDegree p) p = p
hq : (monomial (natDegree q)) (leadingCoeff q) + erase (natDegree q) q = q
⊢ WithBot.unbot' 0 (degree p) = WithBot.unbot' 0 (degree q)

Next tactic:
rw [hd]
theorem degree_sub_lt (hd : degree p = degree q) (hp0 : p ≠ 0)
    (hlc : leadingCoeff p = leadingCoeff q) : degree (p - q) < degree p :=
  have hp : monomial (natDegree p) (leadingCoeff p) + p.erase (natDegree p) = p :=
    monomial_add_erase _ _
  have hq : monomial (natDegree q) (leadingCoeff q) + q.erase (natDegree q) = q :=
    monomial_add_erase _ _
  have hd' : natDegree p = natDegree q := by unfold natDegree; rw [hd]
  have hq0 : q ≠ 0 := mt degree_eq_bot.2 (hd ▸ mt degree_eq_bot.1 hp0)
  calc
    degree (p - q) = degree (erase (natDegree q) p + -erase (natDegree q) q) := by
      

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
hd : degree p = degree q
hp0 : p ≠ 0
hlc : leadingCoeff p = leadingCoeff q
hp : (monomial (natDegree p)) (leadingCoeff p) + erase (natDegree p) p = p
hq : (monomial (natDegree q)) (leadingCoeff q) + erase (natDegree q) q = q
hd' : natDegree p = natDegree q
hq0 : q ≠ 0
⊢ degree (p - q) = degree (erase (natDegree q) p + -erase (natDegree q) q)

Next tactic:
conv =>
        lhs
        rw [← hp, ← hq, hlc, hd', add_sub_add_left_eq_sub, sub_eq_add_neg]
theorem degree_sub_lt (hd : degree p = degree q) (hp0 : p ≠ 0)
    (hlc : leadingCoeff p = leadingCoeff q) : degree (p - q) < degree p :=
  have hp : monomial (natDegree p) (leadingCoeff p) + p.erase (natDegree p) = p :=
    monomial_add_erase _ _
  have hq : monomial (natDegree q) (leadingCoeff q) + q.erase (natDegree q) = q :=
    monomial_add_erase _ _
  have hd' : natDegree p = natDegree q := by unfold natDegree; rw [hd]
  have hq0 : q ≠ 0 := mt degree_eq_bot.2 (hd ▸ mt degree_eq_bot.1 hp0)
  calc
    degree (p - q) = degree (erase (natDegree q) p + -erase (natDegree q) q) := by
      conv =>
        

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
hd : degree p = degree q
hp0 : p ≠ 0
hlc : leadingCoeff p = leadingCoeff q
hp : (monomial (natDegree p)) (leadingCoeff p) + erase (natDegree p) p = p
hq : (monomial (natDegree q)) (leadingCoeff q) + erase (natDegree q) q = q
hd' : natDegree p = natDegree q
hq0 : q ≠ 0
| degree (p - q) = degree (erase (natDegree q) p + -erase (natDegree q) q)

Next tactic:
lhs
        rw [← hp, ← hq, hlc, hd', add_sub_add_left_eq_sub, sub_eq_add_neg]
theorem degree_sub_lt (hd : degree p = degree q) (hp0 : p ≠ 0)
    (hlc : leadingCoeff p = leadingCoeff q) : degree (p - q) < degree p :=
  have hp : monomial (natDegree p) (leadingCoeff p) + p.erase (natDegree p) = p :=
    monomial_add_erase _ _
  have hq : monomial (natDegree q) (leadingCoeff q) + q.erase (natDegree q) = q :=
    monomial_add_erase _ _
  have hd' : natDegree p = natDegree q := by unfold natDegree; rw [hd]
  have hq0 : q ≠ 0 := mt degree_eq_bot.2 (hd ▸ mt degree_eq_bot.1 hp0)
  calc
    degree (p - q) = degree (erase (natDegree q) p + -erase (natDegree q) q) := by
      conv =>
        

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
hd : degree p = degree q
hp0 : p ≠ 0
hlc : leadingCoeff p = leadingCoeff q
hp : (monomial (natDegree p)) (leadingCoeff p) + erase (natDegree p) p = p
hq : (monomial (natDegree q)) (leadingCoeff q) + erase (natDegree q) q = q
hd' : natDegree p = natDegree q
hq0 : q ≠ 0
| degree (p - q) = degree (erase (natDegree q) p + -erase (natDegree q) q)

Next tactic:
lhs
theorem degree_sub_lt (hd : degree p = degree q) (hp0 : p ≠ 0)
    (hlc : leadingCoeff p = leadingCoeff q) : degree (p - q) < degree p :=
  have hp : monomial (natDegree p) (leadingCoeff p) + p.erase (natDegree p) = p :=
    monomial_add_erase _ _
  have hq : monomial (natDegree q) (leadingCoeff q) + q.erase (natDegree q) = q :=
    monomial_add_erase _ _
  have hd' : natDegree p = natDegree q := by unfold natDegree; rw [hd]
  have hq0 : q ≠ 0 := mt degree_eq_bot.2 (hd ▸ mt degree_eq_bot.1 hp0)
  calc
    degree (p - q) = degree (erase (natDegree q) p + -erase (natDegree q) q) := by
      conv =>
        lhs
        

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
hd : degree p = degree q
hp0 : p ≠ 0
hlc : leadingCoeff p = leadingCoeff q
hp : (monomial (natDegree p)) (leadingCoeff p) + erase (natDegree p) p = p
hq : (monomial (natDegree q)) (leadingCoeff q) + erase (natDegree q) q = q
hd' : natDegree p = natDegree q
hq0 : q ≠ 0
| degree (p - q)

Next tactic:
rw [← hp, ← hq, hlc, hd', add_sub_add_left_eq_sub, sub_eq_add_neg]
theorem degree_sub_eq_left_of_degree_lt (h : degree q < degree p) : degree (p - q) = degree p := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
h : degree q < degree p
⊢ degree (p - q) = degree p

Next tactic:
rw [← degree_neg q] at h
theorem degree_sub_eq_left_of_degree_lt (h : degree q < degree p) : degree (p - q) = degree p := by
  rw [← degree_neg q] at h
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
h : degree (-q) < degree p
⊢ degree (p - q) = degree p

Next tactic:
rw [sub_eq_add_neg, degree_add_eq_left_of_degree_lt h]
theorem degree_sub_eq_right_of_degree_lt (h : degree p < degree q) : degree (p - q) = degree q := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
h : degree p < degree q
⊢ degree (p - q) = degree q

Next tactic:
rw [← degree_neg q] at h
theorem degree_sub_eq_right_of_degree_lt (h : degree p < degree q) : degree (p - q) = degree q := by
  rw [← degree_neg q] at h
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Ring R
p q : R[X]
h : degree p < degree (-q)
⊢ degree (p - q) = degree q

Next tactic:
rw [sub_eq_add_neg, degree_add_eq_right_of_degree_lt h, degree_neg]
@[simp]
theorem degree_X_add_C (a : R) : degree (X + C a) = 1 := by
  

Proof state:
R : Type u
S : Type v
a✝ b c d : R
n m : ℕ
inst✝¹ : Nontrivial R
inst✝ : Semiring R
a : R
⊢ degree (X + C a) = 1

Next tactic:
have : degree (C a) < degree (X : R[X]) :=
    calc
      degree (C a) ≤ 0 := degree_C_le
      _ < 1 := (WithBot.some_lt_some.mpr zero_lt_one)
      _ = degree X := degree_X.symm
@[simp]
theorem degree_X_add_C (a : R) : degree (X + C a) = 1 := by
  have : degree (C a) < degree (X : R[X]) :=
    calc
      degree (C a) ≤ 0 := degree_C_le
      _ < 1 := (WithBot.some_lt_some.mpr zero_lt_one)
      _ = degree X := degree_X.symm
  

Proof state:
R : Type u
S : Type v
a✝ b c d : R
n m : ℕ
inst✝¹ : Nontrivial R
inst✝ : Semiring R
a : R
this : degree (C a) < degree X
⊢ degree (X + C a) = 1

Next tactic:
rw [degree_add_eq_left_of_degree_lt this, degree_X]
@[simp]
theorem nextCoeff_X_add_C [Semiring S] (c : S) : nextCoeff (X + C c) = c := by
  

Proof state:
R : Type u
S : Type v
a b c✝ d : R
n m : ℕ
inst✝² : Nontrivial R
inst✝¹ : Semiring R
inst✝ : Semiring S
c : S
⊢ nextCoeff (X + C c) = c

Next tactic:
nontriviality S
@[simp]
theorem nextCoeff_X_add_C [Semiring S] (c : S) : nextCoeff (X + C c) = c := by
  nontriviality S
  

Proof state:
R : Type u
S : Type v
a b c✝ d : R
n m : ℕ
inst✝² : Nontrivial R
inst✝¹ : Semiring R
inst✝ : Semiring S
c : S
✝ : Nontrivial S
⊢ nextCoeff (X + C c) = c

Next tactic:
simp [nextCoeff_of_pos_natDegree]
theorem degree_X_pow_add_C {n : ℕ} (hn : 0 < n) (a : R) : degree ((X : R[X]) ^ n + C a) = n := by
  

Proof state:
R : Type u
S : Type v
a✝ b c d : R
n✝ m : ℕ
inst✝¹ : Nontrivial R
inst✝ : Semiring R
n : ℕ
hn : 0 < n
a : R
⊢ degree (X ^ n + C a) = ↑n

Next tactic:
have : degree (C a) < degree ((X : R[X]) ^ n) := degree_C_le.trans_lt <| by
    rwa [degree_X_pow, Nat.cast_pos]
theorem degree_X_pow_add_C {n : ℕ} (hn : 0 < n) (a : R) : degree ((X : R[X]) ^ n + C a) = n := by
  have : degree (C a) < degree ((X : R[X]) ^ n) := degree_C_le.trans_lt <| by
    

Proof state:
R : Type u
S : Type v
a✝ b c d : R
n✝ m : ℕ
inst✝¹ : Nontrivial R
inst✝ : Semiring R
n : ℕ
hn : 0 < n
a : R
⊢ 0 < degree (X ^ n)

Next tactic:
rwa [degree_X_pow, Nat.cast_pos]
theorem degree_X_pow_add_C {n : ℕ} (hn : 0 < n) (a : R) : degree ((X : R[X]) ^ n + C a) = n := by
  have : degree (C a) < degree ((X : R[X]) ^ n) := degree_C_le.trans_lt <| by
    rwa [degree_X_pow, Nat.cast_pos]
  

Proof state:
R : Type u
S : Type v
a✝ b c d : R
n✝ m : ℕ
inst✝¹ : Nontrivial R
inst✝ : Semiring R
n : ℕ
hn : 0 < n
a : R
this : degree (C a) < degree (X ^ n)
⊢ degree (X ^ n + C a) = ↑n

Next tactic:
rw [degree_add_eq_left_of_degree_lt this, degree_X_pow]
theorem X_pow_add_C_ne_zero {n : ℕ} (hn : 0 < n) (a : R) : (X : R[X]) ^ n + C a ≠ 0 :=
  mt degree_eq_bot.2
    (show degree ((X : R[X]) ^ n + C a) ≠ ⊥ by
      

Proof state:
R : Type u
S : Type v
a✝ b c d : R
n✝ m : ℕ
inst✝¹ : Nontrivial R
inst✝ : Semiring R
n : ℕ
hn : 0 < n
a : R
⊢ degree (X ^ n + C a) ≠ ⊥

Next tactic:
rw [degree_X_pow_add_C hn a]
theorem X_pow_add_C_ne_zero {n : ℕ} (hn : 0 < n) (a : R) : (X : R[X]) ^ n + C a ≠ 0 :=
  mt degree_eq_bot.2
    (show degree ((X : R[X]) ^ n + C a) ≠ ⊥ by
      rw [degree_X_pow_add_C hn a]; 

Proof state:
R : Type u
S : Type v
a✝ b c d : R
n✝ m : ℕ
inst✝¹ : Nontrivial R
inst✝ : Semiring R
n : ℕ
hn : 0 < n
a : R
⊢ ↑n ≠ ⊥

Next tactic:
exact WithBot.coe_ne_bot
theorem natDegree_X_pow_add_C {n : ℕ} {r : R} : (X ^ n + C r).natDegree = n := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Nontrivial R
inst✝ : Semiring R
n : ℕ
r : R
⊢ natDegree (X ^ n + C r) = n

Next tactic:
by_cases hn : n = 0
theorem natDegree_X_pow_add_C {n : ℕ} {r : R} : (X ^ n + C r).natDegree = n := by
  by_cases hn : n = 0
  · 

Proof state:
case pos
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Nontrivial R
inst✝ : Semiring R
n : ℕ
r : R
hn : n = 0
⊢ natDegree (X ^ n + C r) = n

Next tactic:
rw [hn, pow_zero, ← C_1, ← RingHom.map_add, natDegree_C]
theorem natDegree_X_pow_add_C {n : ℕ} {r : R} : (X ^ n + C r).natDegree = n := by
  by_cases hn : n = 0
  · rw [hn, pow_zero, ← C_1, ← RingHom.map_add, natDegree_C]
  · 

Proof state:
case neg
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝¹ : Nontrivial R
inst✝ : Semiring R
n : ℕ
r : R
hn : ¬n = 0
⊢ natDegree (X ^ n + C r) = n

Next tactic:
exact natDegree_eq_of_degree_eq_some (degree_X_pow_add_C (pos_iff_ne_zero.mpr hn) r)
theorem X_pow_add_C_ne_one {n : ℕ} (hn : 0 < n) (a : R) : (X : R[X]) ^ n + C a ≠ 1 := fun h =>
  hn.ne' <| by 

Proof state:
R : Type u
S : Type v
a✝ b c d : R
n✝ m : ℕ
inst✝¹ : Nontrivial R
inst✝ : Semiring R
n : ℕ
hn : 0 < n
a : R
h : X ^ n + C a = 1
⊢ n = 0

Next tactic:
simpa only [natDegree_X_pow_add_C, natDegree_one] using congr_arg natDegree h
@[simp]
theorem leadingCoeff_X_pow_add_C {n : ℕ} (hn : 0 < n) {r : R} :
    (X ^ n + C r).leadingCoeff = 1 := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝ : Semiring R
n : ℕ
hn : 0 < n
r : R
⊢ leadingCoeff (X ^ n + C r) = 1

Next tactic:
nontriviality R
@[simp]
theorem leadingCoeff_X_pow_add_C {n : ℕ} (hn : 0 < n) {r : R} :
    (X ^ n + C r).leadingCoeff = 1 := by
  nontriviality R
  

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝ : Semiring R
n : ℕ
hn : 0 < n
r : R
✝ : Nontrivial R
⊢ leadingCoeff (X ^ n + C r) = 1

Next tactic:
rw [leadingCoeff, natDegree_X_pow_add_C, coeff_add, coeff_X_pow_self, coeff_C,
    if_neg (pos_iff_ne_zero.mp hn), add_zero]
@[simp]
theorem leadingCoeff_X_add_C [Semiring S] (r : S) : (X + C r).leadingCoeff = 1 := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝¹ : Semiring R
inst✝ : Semiring S
r : S
⊢ leadingCoeff (X + C r) = 1

Next tactic:
rw [← pow_one (X : S[X]), leadingCoeff_X_pow_add_C zero_lt_one]
@[simp]
theorem leadingCoeff_pow_X_add_C (r : R) (i : ℕ) : leadingCoeff ((X + C r) ^ i) = 1 := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Semiring R
r : R
i : ℕ
⊢ leadingCoeff ((X + C r) ^ i) = 1

Next tactic:
nontriviality
@[simp]
theorem leadingCoeff_pow_X_add_C (r : R) (i : ℕ) : leadingCoeff ((X + C r) ^ i) = 1 := by
  nontriviality
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Semiring R
r : R
i : ℕ
✝ : Nontrivial R
⊢ leadingCoeff ((X + C r) ^ i) = 1

Next tactic:
rw [leadingCoeff_pow']
@[simp]
theorem leadingCoeff_pow_X_add_C (r : R) (i : ℕ) : leadingCoeff ((X + C r) ^ i) = 1 := by
  nontriviality
  rw [leadingCoeff_pow'] <;> 

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Semiring R
r : R
i : ℕ
✝ : Nontrivial R
⊢ leadingCoeff (X + C r) ^ i = 1

Next tactic:
simp
@[simp]
theorem leadingCoeff_pow_X_add_C (r : R) (i : ℕ) : leadingCoeff ((X + C r) ^ i) = 1 := by
  nontriviality
  rw [leadingCoeff_pow'] <;> 

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝ : Semiring R
r : R
i : ℕ
✝ : Nontrivial R
⊢ leadingCoeff (X + C r) ^ i ≠ 0

Next tactic:
simp
@[simp]
theorem leadingCoeff_X_pow_sub_C {n : ℕ} (hn : 0 < n) {r : R} :
    (X ^ n - C r).leadingCoeff = 1 := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n✝ m : ℕ
inst✝ : Ring R
n : ℕ
hn : 0 < n
r : R
⊢ leadingCoeff (X ^ n - C r) = 1

Next tactic:
rw [sub_eq_add_neg, ← map_neg C r, leadingCoeff_X_pow_add_C hn]
@[simp]
theorem degree_X_sub_C (a : R) : degree (X - C a) = 1 := by
  

Proof state:
R : Type u
S : Type v
a✝ b c d : R
n m : ℕ
inst✝¹ : Ring R
inst✝ : Nontrivial R
a : R
⊢ degree (X - C a) = 1

Next tactic:
rw [sub_eq_add_neg, ← map_neg C a, degree_X_add_C]
theorem natDegree_X_sub_C (x : R) : (X - C x).natDegree = 1 := by
  

Proof state:
R : Type u
S : Type v
a b c d : R
n m : ℕ
inst✝¹ : Ring R
inst✝ : Nontrivial R
x : R
⊢ natDegree (X - C x) = 1

Next tactic:
rw [natDegree_sub_C, natDegree_X]