Theorem: Polynomial.natDegree_eq_zero_of_derivative_eq_zero
File: Mathlib/Algebra/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
⊢ f.natDegree = 0
state_after: 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

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.natDegree = 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
⊢ f.natDegree = 0
state_after: 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.degree ≤ 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
⊢ f.degree ≤ 0
state_after: 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 < f.degree
⊢ False

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 < f.degree
⊢ False
state_after: 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 < f.natDegree
⊢ 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 < f.natDegree
⊢ False
state_after: 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 < f.natDegree
m : ℕ := f.natDegree - 1
⊢ 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 < f.natDegree
m : ℕ := f.natDegree - 1
⊢ False
state_after: 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 < f.natDegree
m : ℕ := f.natDegree - 1
hm : m + 1 = f.natDegree
⊢ 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 < f.natDegree
m : ℕ := f.natDegree - 1
hm : m + 1 = f.natDegree
⊢ False
state_after: 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 < f.natDegree
m : ℕ := f.natDegree - 1
hm : m + 1 = f.natDegree
h2 : (derivative f).coeff m = f.coeff (m + 1) * (↑m + 1)
⊢ 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 < f.natDegree
m : ℕ := f.natDegree - 1
hm : m + 1 = f.natDegree
h2 : (derivative f).coeff m = f.coeff (m + 1) * (↑m + 1)
⊢ False
state_after: 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 : ℕ), (derivative f).coeff n = coeff 0 n
hf : f ≠ 0
f_nat_degree_pos : 0 < f.natDegree
m : ℕ := f.natDegree - 1
hm : m + 1 = f.natDegree
h2 : (derivative f).coeff m = f.coeff (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 : ℕ), (derivative f).coeff n = coeff 0 n
hf : f ≠ 0
f_nat_degree_pos : 0 < f.natDegree
m : ℕ := f.natDegree - 1
hm : m + 1 = f.natDegree
h2 : (derivative f).coeff m = f.coeff (m + 1) * (↑m + 1)
⊢ False
state_after: 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 : ℕ), (derivative f).coeff n = coeff 0 n
hf : f ≠ 0
f_nat_degree_pos : 0 < f.natDegree
m : ℕ := f.natDegree - 1
hm : m + 1 = f.natDegree
h2 : m + 1 = 0 ∨ f.coeff (m + 1) = 0
⊢ 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 : ℕ), (derivative f).coeff n = coeff 0 n
hf : f ≠ 0
f_nat_degree_pos : 0 < f.natDegree
m : ℕ := f.natDegree - 1
hm : m + 1 = f.natDegree
h2 : m + 1 = 0 ∨ f.coeff (m + 1) = 0
⊢ False
state_after: 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 : ℕ), (derivative f).coeff n = coeff 0 n
hf : f ≠ 0
f_nat_degree_pos : 0 < f.natDegree
m : ℕ := f.natDegree - 1
hm : m + 1 = f.natDegree
h2 : f.coeff (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 : ℕ), (derivative f).coeff n = coeff 0 n
hf : f ≠ 0
f_nat_degree_pos : 0 < f.natDegree
m : ℕ := f.natDegree - 1
hm : m + 1 = f.natDegree
h2 : f.coeff (m + 1) = 0
⊢ False
state_after: 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 : ℕ), (derivative f).coeff n = coeff 0 n
hf : f ≠ 0
f_nat_degree_pos : 0 < f.natDegree
m : ℕ := f.natDegree - 1
hm : m + 1 = f.natDegree
h2 : f = 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 : ℕ), (derivative f).coeff n = coeff 0 n
hf : f ≠ 0
f_nat_degree_pos : 0 < f.natDegree
m : ℕ := f.natDegree - 1
hm : m + 1 = f.natDegree
h2 : f = 0
⊢ False
state_after: no goals

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
state_after: no goals