Theorem: Polynomial.natDegree_eq_zero_of_derivative_eq_zero
File: Mathlib/Data/Polynomial/Derivative.lean

tactic: rcases eq_or_ne f 0 with (rfl | hf)
state_before: R : Type u
S : Type v
T : Type w
ι : Type y
A : Type z
a b : R
n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroSMulDivisors ℕ R
f : R[X]
h : ↑derivative f = 0
⊢ natDegree f = 0

tactic: rw [natDegree_eq_zero_iff_degree_le_zero]
state_before: case inr
R : Type u
S : Type v
T : Type w
ι : Type y
A : Type z
a b : R
n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroSMulDivisors ℕ R
f : R[X]
h : ↑derivative f = 0
hf : f ≠ 0
⊢ natDegree f = 0

tactic: by_contra' f_nat_degree_pos
state_before: case inr
R : Type u
S : Type v
T : Type w
ι : Type y
A : Type z
a b : R
n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroSMulDivisors ℕ R
f : R[X]
h : ↑derivative f = 0
hf : f ≠ 0
⊢ degree f ≤ 0

tactic: rw [← natDegree_pos_iff_degree_pos] at f_nat_degree_pos
state_before: case inr
R : Type u
S : Type v
T : Type w
ι : Type y
A : Type z
a b : R
n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroSMulDivisors ℕ R
f : R[X]
h : ↑derivative f = 0
hf : f ≠ 0
f_nat_degree_pos : 0 < degree f
⊢ False

tactic: let m := f.natDegree - 1
state_before: case inr
R : Type u
S : Type v
T : Type w
ι : Type y
A : Type z
a b : R
n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroSMulDivisors ℕ R
f : R[X]
h : ↑derivative f = 0
hf : f ≠ 0
f_nat_degree_pos : 0 < natDegree f
⊢ False

tactic: have hm : m + 1 = f.natDegree := tsub_add_cancel_of_le f_nat_degree_pos
state_before: case inr
R : Type u
S : Type v
T : Type w
ι : Type y
A : Type z
a b : R
n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroSMulDivisors ℕ R
f : R[X]
h : ↑derivative f = 0
hf : f ≠ 0
f_nat_degree_pos : 0 < natDegree f
m : ℕ := natDegree f - 1
⊢ False

tactic: have h2 := coeff_derivative f m
state_before: case inr
R : Type u
S : Type v
T : Type w
ι : Type y
A : Type z
a b : R
n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroSMulDivisors ℕ R
f : R[X]
h : ↑derivative f = 0
hf : f ≠ 0
f_nat_degree_pos : 0 < natDegree f
m : ℕ := natDegree f - 1
hm : m + 1 = natDegree f
⊢ False

tactic: rw [Polynomial.ext_iff] at h
state_before: case inr
R : Type u
S : Type v
T : Type w
ι : Type y
A : Type z
a b : R
n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroSMulDivisors ℕ R
f : R[X]
h : ↑derivative f = 0
hf : f ≠ 0
f_nat_degree_pos : 0 < natDegree f
m : ℕ := natDegree f - 1
hm : m + 1 = natDegree f
h2 : coeff (↑derivative f) m = coeff f (m + 1) * (↑m + 1)
⊢ False

tactic: rw [h m, coeff_zero, ← Nat.cast_add_one, ← nsmul_eq_mul', eq_comm, smul_eq_zero] at h2
state_before: case inr
R : Type u
S : Type v
T : Type w
ι : Type y
A : Type z
a b : R
n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroSMulDivisors ℕ R
f : R[X]
h : ∀ (n : ℕ), coeff (↑derivative f) n = coeff 0 n
hf : f ≠ 0
f_nat_degree_pos : 0 < natDegree f
m : ℕ := natDegree f - 1
hm : m + 1 = natDegree f
h2 : coeff (↑derivative f) m = coeff f (m + 1) * (↑m + 1)
⊢ False

tactic: replace h2 := h2.resolve_left m.succ_ne_zero
state_before: case inr
R : Type u
S : Type v
T : Type w
ι : Type y
A : Type z
a b : R
n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroSMulDivisors ℕ R
f : R[X]
h : ∀ (n : ℕ), coeff (↑derivative f) n = coeff 0 n
hf : f ≠ 0
f_nat_degree_pos : 0 < natDegree f
m : ℕ := natDegree f - 1
hm : m + 1 = natDegree f
h2 : m + 1 = 0 ∨ coeff f (m + 1) = 0
⊢ False

tactic: rw [hm, ← leadingCoeff, leadingCoeff_eq_zero] at h2
state_before: case inr
R : Type u
S : Type v
T : Type w
ι : Type y
A : Type z
a b : R
n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroSMulDivisors ℕ R
f : R[X]
h : ∀ (n : ℕ), coeff (↑derivative f) n = coeff 0 n
hf : f ≠ 0
f_nat_degree_pos : 0 < natDegree f
m : ℕ := natDegree f - 1
hm : m + 1 = natDegree f
h2 : coeff f (m + 1) = 0
⊢ False

tactic: exact hf h2
state_before: case inr
R : Type u
S : Type v
T : Type w
ι : Type y
A : Type z
a b : R
n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroSMulDivisors ℕ R
f : R[X]
h : ∀ (n : ℕ), coeff (↑derivative f) n = coeff 0 n
hf : f ≠ 0
f_nat_degree_pos : 0 < natDegree f
m : ℕ := natDegree f - 1
hm : m + 1 = natDegree f
h2 : f = 0
⊢ False

tactic: exact natDegree_zero
state_before: case inl
R : Type u
S : Type v
T : Type w
ι : Type y
A : Type z
a b : R
n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroSMulDivisors ℕ R
h : ↑derivative 0 = 0
⊢ natDegree 0 = 0