Theorem: Polynomial.natDegree_eq_one
File: Mathlib/Algebra/Polynomial/Degree/Lemmas.lean

tactic: refine ⟨fun hp ↦ ⟨p.coeff 1, fun h ↦ ?_, p.coeff 0, ?_⟩, ?_⟩
state_before: R : Type u
S : Type v
ι : Type w
a✝ b : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
⊢ p.natDegree = 1 ↔ ∃ a, a ≠ 0 ∧ ∃ b, C a * X + C b = p
state_after: case refine_1
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
h : p.coeff 1 = 0
⊢ False

case refine_2
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
⊢ C (p.coeff 1) * X + C (p.coeff 0) = p

case refine_3
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
⊢ (∃ a, a ≠ 0 ∧ ∃ b, C a * X + C b = p) → p.natDegree = 1

tactic: rw [← hp, coeff_natDegree, leadingCoeff_eq_zero] at h
state_before: case refine_1
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
h : p.coeff 1 = 0
⊢ False
state_after: case refine_1
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
h : p = 0
⊢ False

tactic: aesop
state_before: case refine_1
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
h : p = 0
⊢ False
state_after: no goals

tactic: ext n
state_before: case refine_2
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
⊢ C (p.coeff 1) * X + C (p.coeff 0) = p
state_after: case refine_2.a
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n✝ : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
n : ℕ
⊢ (C (p.coeff 1) * X + C (p.coeff 0)).coeff n = p.coeff n

tactic: obtain _ | _ | n := n
state_before: case refine_2.a
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n✝ : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
n : ℕ
⊢ (C (p.coeff 1) * X + C (p.coeff 0)).coeff n = p.coeff n
state_after: case refine_2.a.zero
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
⊢ (C (p.coeff 1) * X + C (p.coeff 0)).coeff 0 = p.coeff 0

case refine_2.a.succ.zero
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
⊢ (C (p.coeff 1) * X + C (p.coeff 0)).coeff (0 + 1) = p.coeff (0 + 1)

case refine_2.a.succ.succ
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n✝ : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
n : ℕ
⊢ (C (p.coeff 1) * X + C (p.coeff 0)).coeff (n + 1 + 1) = p.coeff (n + 1 + 1)

tactic: simp
state_before: case refine_2.a.zero
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
⊢ (C (p.coeff 1) * X + C (p.coeff 0)).coeff 0 = p.coeff 0
state_after: no goals

tactic: simp
state_before: case refine_2.a.succ.zero
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
⊢ (C (p.coeff 1) * X + C (p.coeff 0)).coeff (0 + 1) = p.coeff (0 + 1)
state_after: no goals

tactic: simp only [coeff_add, coeff_mul_X, coeff_C_succ, add_zero]
state_before: case refine_2.a.succ.succ
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n✝ : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
n : ℕ
⊢ (C (p.coeff 1) * X + C (p.coeff 0)).coeff (n + 1 + 1) = p.coeff (n + 1 + 1)
state_after: case refine_2.a.succ.succ
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n✝ : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
n : ℕ
⊢ 0 = p.coeff (n + 1 + 1)

tactic: rw [coeff_eq_zero_of_natDegree_lt]
state_before: case refine_2.a.succ.succ
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n✝ : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
n : ℕ
⊢ 0 = p.coeff (n + 1 + 1)
state_after: case refine_2.a.succ.succ
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n✝ : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
n : ℕ
⊢ p.natDegree < n + 1 + 1

tactic: simp [hp]
state_before: case refine_2.a.succ.succ
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n✝ : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
hp : p.natDegree = 1
n : ℕ
⊢ p.natDegree < n + 1 + 1
state_after: no goals

tactic: rintro ⟨a, ha, b, rfl⟩
state_before: case refine_3
R : Type u
S : Type v
ι : Type w
a✝ b : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
p q : R[X]
a : R
⊢ (∃ a, a ≠ 0 ∧ ∃ b, C a * X + C b = p) → p.natDegree = 1
state_after: case refine_3.intro.intro.intro
R : Type u
S : Type v
ι : Type w
a✝¹ b✝ : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
q : R[X]
a✝ a : R
ha : a ≠ 0
b : R
⊢ (C a * X + C b).natDegree = 1

tactic: simp [ha]
state_before: case refine_3.intro.intro.intro
R : Type u
S : Type v
ι : Type w
a✝¹ b✝ : R
m n : ℕ
inst✝¹ : Semiring R
inst✝ : NoZeroDivisors R
q : R[X]
a✝ a : R
ha : a ≠ 0
b : R
⊢ (C a * X + C b).natDegree = 1
state_after: no goals