Theorem: Polynomial.degree_divX_lt
File: Mathlib/Data/Polynomial/Inductions.lean

tactic: haveI := Nontrivial.of_polynomial_ne hp0
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
⊢ degree (divX p) < degree p

tactic: calc
  degree (divX p) < (divX p * X + C (p.coeff 0)).degree :=
    if h : degree p ≤ 0 then by
      have h' : C (p.coeff 0) ≠ 0 := by rwa [← eq_C_of_degree_le_zero h]
      rw [eq_C_of_degree_le_zero h, divX_C, degree_zero, zero_mul, zero_add]
      exact lt_of_le_of_ne bot_le (Ne.symm (mt degree_eq_bot.1 <| by simpa using h'))
    else by
      have hXp0 : divX p ≠ 0 := by
        simpa [divX_eq_zero_iff, -not_le, degree_le_zero_iff] using h
      have : leadingCoeff (divX p) * leadingCoeff X ≠ 0 := by simpa
      have : degree (C (p.coeff 0)) < degree (divX p * X) :=
        calc
          degree (C (p.coeff 0)) ≤ 0 := degree_C_le
          _ < 1 := by decide
          _ = degree (X : R[X]) := degree_X.symm
          _ ≤ degree (divX p * X) := by
            rw [← zero_add (degree X), degree_mul' this]
            exact add_le_add
              (by rw [zero_le_degree_iff, Ne.def, divX_eq_zero_iff]
                  exact fun h0 => h (h0.symm ▸ degree_C_le))
                  le_rfl
      rw [degree_add_eq_left_of_degree_lt this]; exact degree_lt_degree_mul_X hXp0
  _ = degree p := congr_arg _ (divX_mul_X_add _)
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this : Nontrivial R
⊢ degree (divX p) < degree p

tactic: have h' : C (p.coeff 0) ≠ 0 := by rwa [← eq_C_of_degree_le_zero h]
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this : Nontrivial R
h : degree p ≤ 0
⊢ degree (divX p) < degree (divX p * X + ↑C (coeff p 0))

tactic: rw [eq_C_of_degree_le_zero h, divX_C, degree_zero, zero_mul, zero_add]
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this : Nontrivial R
h : degree p ≤ 0
h' : ↑C (coeff p 0) ≠ 0
⊢ degree (divX p) < degree (divX p * X + ↑C (coeff p 0))

tactic: exact lt_of_le_of_ne bot_le (Ne.symm (mt degree_eq_bot.1 <| by simpa using h'))
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this : Nontrivial R
h : degree p ≤ 0
h' : ↑C (coeff p 0) ≠ 0
⊢ ⊥ < degree (↑C (coeff (↑C (coeff p 0)) 0))

tactic: rwa [← eq_C_of_degree_le_zero h]
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this : Nontrivial R
h : degree p ≤ 0
⊢ ↑C (coeff p 0) ≠ 0

tactic: simpa using h'
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this : Nontrivial R
h : degree p ≤ 0
h' : ↑C (coeff p 0) ≠ 0
⊢ ¬↑C (coeff (↑C (coeff p 0)) 0) = 0

tactic: have hXp0 : divX p ≠ 0 := by
  simpa [divX_eq_zero_iff, -not_le, degree_le_zero_iff] using h
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this : Nontrivial R
h : ¬degree p ≤ 0
⊢ degree (divX p) < degree (divX p * X + ↑C (coeff p 0))

tactic: have : leadingCoeff (divX p) * leadingCoeff X ≠ 0 := by simpa
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this : Nontrivial R
h : ¬degree p ≤ 0
hXp0 : divX p ≠ 0
⊢ degree (divX p) < degree (divX p * X + ↑C (coeff p 0))

tactic: have : degree (C (p.coeff 0)) < degree (divX p * X) :=
  calc
    degree (C (p.coeff 0)) ≤ 0 := degree_C_le
    _ < 1 := by decide
    _ = degree (X : R[X]) := degree_X.symm
    _ ≤ degree (divX p * X) := by
      rw [← zero_add (degree X), degree_mul' this]
      exact add_le_add
        (by rw [zero_le_degree_iff, Ne.def, divX_eq_zero_iff]
            exact fun h0 => h (h0.symm ▸ degree_C_le))
            le_rfl
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this✝ : Nontrivial R
h : ¬degree p ≤ 0
hXp0 : divX p ≠ 0
this : leadingCoeff (divX p) * leadingCoeff X ≠ 0
⊢ degree (divX p) < degree (divX p * X + ↑C (coeff p 0))

tactic: rw [degree_add_eq_left_of_degree_lt this]
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this✝¹ : Nontrivial R
h : ¬degree p ≤ 0
hXp0 : divX p ≠ 0
this✝ : leadingCoeff (divX p) * leadingCoeff X ≠ 0
this : degree (↑C (coeff p 0)) < degree (divX p * X)
⊢ degree (divX p) < degree (divX p * X + ↑C (coeff p 0))

tactic: exact degree_lt_degree_mul_X hXp0
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this✝¹ : Nontrivial R
h : ¬degree p ≤ 0
hXp0 : divX p ≠ 0
this✝ : leadingCoeff (divX p) * leadingCoeff X ≠ 0
this : degree (↑C (coeff p 0)) < degree (divX p * X)
⊢ degree (divX p) < degree (divX p * X)

tactic: simpa [divX_eq_zero_iff, -not_le, degree_le_zero_iff] using h
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this : Nontrivial R
h : ¬degree p ≤ 0
⊢ divX p ≠ 0

tactic: simpa
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this : Nontrivial R
h : ¬degree p ≤ 0
hXp0 : divX p ≠ 0
⊢ leadingCoeff (divX p) * leadingCoeff X ≠ 0

tactic: decide
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this✝ : Nontrivial R
h : ¬degree p ≤ 0
hXp0 : divX p ≠ 0
this : leadingCoeff (divX p) * leadingCoeff X ≠ 0
⊢ 0 < 1

tactic: rw [← zero_add (degree X), degree_mul' this]
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this✝ : Nontrivial R
h : ¬degree p ≤ 0
hXp0 : divX p ≠ 0
this : leadingCoeff (divX p) * leadingCoeff X ≠ 0
⊢ degree X ≤ degree (divX p * X)

tactic: exact add_le_add
  (by rw [zero_le_degree_iff, Ne.def, divX_eq_zero_iff]
      exact fun h0 => h (h0.symm ▸ degree_C_le))
      le_rfl
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this✝ : Nontrivial R
h : ¬degree p ≤ 0
hXp0 : divX p ≠ 0
this : leadingCoeff (divX p) * leadingCoeff X ≠ 0
⊢ 0 + degree X ≤ degree (divX p) + degree X

tactic: rw [zero_le_degree_iff, Ne.def, divX_eq_zero_iff]
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this✝ : Nontrivial R
h : ¬degree p ≤ 0
hXp0 : divX p ≠ 0
this : leadingCoeff (divX p) * leadingCoeff X ≠ 0
⊢ 0 ≤ degree (divX p)

tactic: exact fun h0 => h (h0.symm ▸ degree_C_le)
state_before: R : Type u
S : Type v
T : Type w
A : Type z
a b : R
n : ℕ
inst✝ : Semiring R
p q : R[X]
hp0 : p ≠ 0
this✝ : Nontrivial R
h : ¬degree p ≤ 0
hXp0 : divX p ≠ 0
this : leadingCoeff (divX p) * leadingCoeff X ≠ 0
⊢ ¬p = ↑C (coeff p 0)