Theorem: Polynomial.induction_with_natDegree_le
File: Mathlib/Data/Polynomial/EraseLead.lean

tactic: intro f df
state_before: R : Type u_1
inst✝ : Semiring R
f : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
⊢ ∀ (f : R[X]), natDegree f ≤ N → P f

tactic: generalize hd : card f.support = c
state_before: R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
⊢ P f

tactic: revert f
state_before: R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
c : ℕ
hd : card (support f) = c
⊢ P f

tactic: induction' c with c hc
state_before: R : Type u_1
inst✝ : Semiring R
f : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
c : ℕ
⊢ ∀ (f : R[X]), natDegree f ≤ N → card (support f) = c → P f

tactic: intro f _ f0
state_before: case zero
R : Type u_1
inst✝ : Semiring R
f : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
⊢ ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.zero → P f

tactic: convert P_0
state_before: case zero
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df✝ : natDegree f ≤ N
f0 : card (support f) = Nat.zero
⊢ P f

tactic: simpa [support_eq_empty, card_eq_zero] using f0
state_before: case h.e'_1
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df✝ : natDegree f ≤ N
f0 : card (support f) = Nat.zero
⊢ f = 0

tactic: intro f df f0
state_before: case succ
R : Type u_1
inst✝ : Semiring R
f : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
c : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = c → P f
⊢ ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.succ c → P f

tactic: rw [← eraseLead_add_C_mul_X_pow f]
state_before: case succ
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
c : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = c → P f
f : R[X]
df : natDegree f ≤ N
f0 : card (support f) = Nat.succ c
⊢ P f

tactic: cases c
state_before: case succ
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
c : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = c → P f
f : R[X]
df : natDegree f ≤ N
f0 : card (support f) = Nat.succ c
⊢ P (eraseLead f + ↑C (leadingCoeff f) * X ^ natDegree f)

tactic: refine' P_C_add f.eraseLead _ _ _ _ _
state_before: case succ.succ
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
n✝ : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.succ n✝ → P f
f0 : card (support f) = Nat.succ (Nat.succ n✝)
⊢ P (eraseLead f + ↑C (leadingCoeff f) * X ^ natDegree f)

tactic: convert P_C_mul_pow f.natDegree f.leadingCoeff ?_ df using 1
state_before: case succ.zero
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.zero → P f
f0 : card (support f) = Nat.succ Nat.zero
⊢ P (eraseLead f + ↑C (leadingCoeff f) * X ^ natDegree f)

tactic: convert zero_add (C (leadingCoeff f) * X ^ f.natDegree)
state_before: case h.e'_1
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.zero → P f
f0 : card (support f) = Nat.succ Nat.zero
⊢ eraseLead f + ↑C (leadingCoeff f) * X ^ natDegree f = ↑C (leadingCoeff f) * X ^ natDegree f

tactic: rw [← card_support_eq_zero, eraseLead_card_support f0]
state_before: case h.e'_2.h.e'_5
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.zero → P f
f0 : card (support f) = Nat.succ Nat.zero
⊢ eraseLead f = 0

tactic: rw [leadingCoeff_ne_zero, Ne.def, ← card_support_eq_zero, f0]
state_before: case succ.zero
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.zero → P f
f0 : card (support f) = Nat.succ Nat.zero
⊢ leadingCoeff f ≠ 0

tactic: exact zero_ne_one.symm
state_before: case succ.zero
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.zero → P f
f0 : card (support f) = Nat.succ Nat.zero
⊢ ¬Nat.succ Nat.zero = 0

tactic: refine' (eraseLead_natDegree_lt _).trans_le (le_of_eq _)
state_before: case succ.succ.refine'_1
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
n✝ : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.succ n✝ → P f
f0 : card (support f) = Nat.succ (Nat.succ n✝)
⊢ natDegree (eraseLead f) < natDegree (↑C (leadingCoeff f) * X ^ natDegree f)

tactic: exact (Nat.succ_le_succ (Nat.succ_le_succ (Nat.zero_le _))).trans f0.ge
state_before: case succ.succ.refine'_1.refine'_1
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
n✝ : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.succ n✝ → P f
f0 : card (support f) = Nat.succ (Nat.succ n✝)
⊢ 2 ≤ card (support f)

tactic: rw [natDegree_C_mul_X_pow _ _ (leadingCoeff_ne_zero.mpr _)]
state_before: case succ.succ.refine'_1.refine'_2
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
n✝ : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.succ n✝ → P f
f0 : card (support f) = Nat.succ (Nat.succ n✝)
⊢ natDegree f = natDegree (↑C (leadingCoeff f) * X ^ natDegree f)

tactic: rintro rfl
state_before: R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
n✝ : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.succ n✝ → P f
f0 : card (support f) = Nat.succ (Nat.succ n✝)
⊢ f ≠ 0

tactic: simp at f0
state_before: R : Type u_1
inst✝ : Semiring R
f : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
n✝ : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.succ n✝ → P f
df : natDegree 0 ≤ N
f0 : card (support 0) = Nat.succ (Nat.succ n✝)
⊢ False

tactic: exact (natDegree_C_mul_X_pow_le f.leadingCoeff f.natDegree).trans df
state_before: case succ.succ.refine'_2
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
n✝ : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.succ n✝ → P f
f0 : card (support f) = Nat.succ (Nat.succ n✝)
⊢ natDegree (↑C (leadingCoeff f) * X ^ natDegree f) ≤ N

tactic: exact hc _ (eraseLead_natDegree_le_aux.trans df) (eraseLead_card_support f0)
state_before: case succ.succ.refine'_3
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
n✝ : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.succ n✝ → P f
f0 : card (support f) = Nat.succ (Nat.succ n✝)
⊢ P (eraseLead f)

tactic: refine' P_C_mul_pow _ _ _ df
state_before: case succ.succ.refine'_4
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
n✝ : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.succ n✝ → P f
f0 : card (support f) = Nat.succ (Nat.succ n✝)
⊢ P (↑C (leadingCoeff f) * X ^ natDegree f)

tactic: rw [Ne.def, leadingCoeff_eq_zero, ← card_support_eq_zero, f0]
state_before: case succ.succ.refine'_4
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
n✝ : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.succ n✝ → P f
f0 : card (support f) = Nat.succ (Nat.succ n✝)
⊢ leadingCoeff f ≠ 0

tactic: exact Nat.succ_ne_zero _
state_before: case succ.succ.refine'_4
R : Type u_1
inst✝ : Semiring R
f✝ : R[X]
P : R[X] → Prop
N : ℕ
P_0 : P 0
P_C_mul_pow : ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ N → P (↑C r * X ^ n)
P_C_add : ∀ (f g : R[X]), natDegree f < natDegree g → natDegree g ≤ N → P f → P g → P (f + g)
f : R[X]
df : natDegree f ≤ N
n✝ : ℕ
hc : ∀ (f : R[X]), natDegree f ≤ N → card (support f) = Nat.succ n✝ → P f
f0 : card (support f) = Nat.succ (Nat.succ n✝)
⊢ ¬Nat.succ (Nat.succ n✝) = 0