Theorem: Ideal.mem_leadingCoeffNth
File: Mathlib/RingTheory/Polynomial/Basic.lean

tactic: simp only [leadingCoeffNth, degreeLE, Submodule.mem_map, lcoeff_apply, Submodule.mem_inf,
  mem_degreeLE]
state_before: R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
x : R
⊢ x ∈ I.leadingCoeffNth n ↔ ∃ p ∈ I, p.degree ≤ ↑n ∧ p.leadingCoeff = x
state_after: R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
x : R
⊢ (∃ y, (y.degree ≤ ↑n ∧ y ∈ I.ofPolynomial) ∧ y.coeff n = x) ↔ ∃ p ∈ I, p.degree ≤ ↑n ∧ p.leadingCoeff = x

tactic: constructor
state_before: R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
x : R
⊢ (∃ y, (y.degree ≤ ↑n ∧ y ∈ I.ofPolynomial) ∧ y.coeff n = x) ↔ ∃ p ∈ I, p.degree ≤ ↑n ∧ p.leadingCoeff = x
state_after: case mp
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
x : R
⊢ (∃ y, (y.degree ≤ ↑n ∧ y ∈ I.ofPolynomial) ∧ y.coeff n = x) → ∃ p ∈ I, p.degree ≤ ↑n ∧ p.leadingCoeff = x

case mpr
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
x : R
⊢ (∃ p ∈ I, p.degree ≤ ↑n ∧ p.leadingCoeff = x) → ∃ y, (y.degree ≤ ↑n ∧ y ∈ I.ofPolynomial) ∧ y.coeff n = x

tactic: rintro ⟨p, ⟨hpdeg, hpI⟩, rfl⟩
state_before: case mp
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
x : R
⊢ (∃ y, (y.degree ≤ ↑n ∧ y ∈ I.ofPolynomial) ∧ y.coeff n = x) → ∃ p ∈ I, p.degree ≤ ↑n ∧ p.leadingCoeff = x
state_after: case mp.intro.intro.intro
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpdeg : p.degree ≤ ↑n
hpI : p ∈ I.ofPolynomial
⊢ ∃ p_1 ∈ I, p_1.degree ≤ ↑n ∧ p_1.leadingCoeff = p.coeff n

tactic: rcases lt_or_eq_of_le hpdeg with hpdeg | hpdeg
state_before: case mp.intro.intro.intro
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpdeg : p.degree ≤ ↑n
hpI : p ∈ I.ofPolynomial
⊢ ∃ p_1 ∈ I, p_1.degree ≤ ↑n ∧ p_1.leadingCoeff = p.coeff n
state_after: case mp.intro.intro.intro.inl
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpdeg✝ : p.degree ≤ ↑n
hpI : p ∈ I.ofPolynomial
hpdeg : p.degree < ↑n
⊢ ∃ p_1 ∈ I, p_1.degree ≤ ↑n ∧ p_1.leadingCoeff = p.coeff n

case mp.intro.intro.intro.inr
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpdeg✝ : p.degree ≤ ↑n
hpI : p ∈ I.ofPolynomial
hpdeg : p.degree = ↑n
⊢ ∃ p_1 ∈ I, p_1.degree ≤ ↑n ∧ p_1.leadingCoeff = p.coeff n

tactic: refine ⟨0, I.zero_mem, bot_le, ?_⟩
state_before: case mp.intro.intro.intro.inl
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpdeg✝ : p.degree ≤ ↑n
hpI : p ∈ I.ofPolynomial
hpdeg : p.degree < ↑n
⊢ ∃ p_1 ∈ I, p_1.degree ≤ ↑n ∧ p_1.leadingCoeff = p.coeff n
state_after: case mp.intro.intro.intro.inl
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpdeg✝ : p.degree ≤ ↑n
hpI : p ∈ I.ofPolynomial
hpdeg : p.degree < ↑n
⊢ Polynomial.leadingCoeff 0 = p.coeff n

tactic: rw [leadingCoeff_zero, eq_comm]
state_before: case mp.intro.intro.intro.inl
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpdeg✝ : p.degree ≤ ↑n
hpI : p ∈ I.ofPolynomial
hpdeg : p.degree < ↑n
⊢ Polynomial.leadingCoeff 0 = p.coeff n
state_after: case mp.intro.intro.intro.inl
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpdeg✝ : p.degree ≤ ↑n
hpI : p ∈ I.ofPolynomial
hpdeg : p.degree < ↑n
⊢ p.coeff n = 0

tactic: exact coeff_eq_zero_of_degree_lt hpdeg
state_before: case mp.intro.intro.intro.inl
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpdeg✝ : p.degree ≤ ↑n
hpI : p ∈ I.ofPolynomial
hpdeg : p.degree < ↑n
⊢ p.coeff n = 0
state_after: no goals

tactic: refine ⟨p, hpI, le_of_eq hpdeg, ?_⟩
state_before: case mp.intro.intro.intro.inr
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpdeg✝ : p.degree ≤ ↑n
hpI : p ∈ I.ofPolynomial
hpdeg : p.degree = ↑n
⊢ ∃ p_1 ∈ I, p_1.degree ≤ ↑n ∧ p_1.leadingCoeff = p.coeff n
state_after: case mp.intro.intro.intro.inr
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpdeg✝ : p.degree ≤ ↑n
hpI : p ∈ I.ofPolynomial
hpdeg : p.degree = ↑n
⊢ p.leadingCoeff = p.coeff n

tactic: rw [Polynomial.leadingCoeff, natDegree, hpdeg, Nat.cast_withBot, WithBot.unbot'_coe]
state_before: case mp.intro.intro.intro.inr
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpdeg✝ : p.degree ≤ ↑n
hpI : p ∈ I.ofPolynomial
hpdeg : p.degree = ↑n
⊢ p.leadingCoeff = p.coeff n
state_after: no goals

tactic: rintro ⟨p, hpI, hpdeg, rfl⟩
state_before: case mpr
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
x : R
⊢ (∃ p ∈ I, p.degree ≤ ↑n ∧ p.leadingCoeff = x) → ∃ y, (y.degree ≤ ↑n ∧ y ∈ I.ofPolynomial) ∧ y.coeff n = x
state_after: case mpr.intro.intro.intro
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpI : p ∈ I
hpdeg : p.degree ≤ ↑n
⊢ ∃ y, (y.degree ≤ ↑n ∧ y ∈ I.ofPolynomial) ∧ y.coeff n = p.leadingCoeff

tactic: have : natDegree p + (n - natDegree p) = n :=
  add_tsub_cancel_of_le (natDegree_le_of_degree_le hpdeg)
state_before: case mpr.intro.intro.intro
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpI : p ∈ I
hpdeg : p.degree ≤ ↑n
⊢ ∃ y, (y.degree ≤ ↑n ∧ y ∈ I.ofPolynomial) ∧ y.coeff n = p.leadingCoeff
state_after: case mpr.intro.intro.intro
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpI : p ∈ I
hpdeg : p.degree ≤ ↑n
this : p.natDegree + (n - p.natDegree) = n
⊢ ∃ y, (y.degree ≤ ↑n ∧ y ∈ I.ofPolynomial) ∧ y.coeff n = p.leadingCoeff

tactic: refine ⟨p * X ^ (n - natDegree p), ⟨?_, I.mul_mem_right _ hpI⟩, ?_⟩
state_before: case mpr.intro.intro.intro
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpI : p ∈ I
hpdeg : p.degree ≤ ↑n
this : p.natDegree + (n - p.natDegree) = n
⊢ ∃ y, (y.degree ≤ ↑n ∧ y ∈ I.ofPolynomial) ∧ y.coeff n = p.leadingCoeff
state_after: case mpr.intro.intro.intro.refine_1
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpI : p ∈ I
hpdeg : p.degree ≤ ↑n
this : p.natDegree + (n - p.natDegree) = n
⊢ (p * X ^ (n - p.natDegree)).degree ≤ ↑n

case mpr.intro.intro.intro.refine_2
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpI : p ∈ I
hpdeg : p.degree ≤ ↑n
this : p.natDegree + (n - p.natDegree) = n
⊢ (p * X ^ (n - p.natDegree)).coeff n = p.leadingCoeff

tactic: apply le_trans (degree_mul_le _ _) _
state_before: case mpr.intro.intro.intro.refine_1
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpI : p ∈ I
hpdeg : p.degree ≤ ↑n
this : p.natDegree + (n - p.natDegree) = n
⊢ (p * X ^ (n - p.natDegree)).degree ≤ ↑n
state_after: R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpI : p ∈ I
hpdeg : p.degree ≤ ↑n
this : p.natDegree + (n - p.natDegree) = n
⊢ p.degree + (X ^ (n - p.natDegree)).degree ≤ ↑n

tactic: apply le_trans (add_le_add degree_le_natDegree (degree_X_pow_le _)) _
state_before: R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpI : p ∈ I
hpdeg : p.degree ≤ ↑n
this : p.natDegree + (n - p.natDegree) = n
⊢ p.degree + (X ^ (n - p.natDegree)).degree ≤ ↑n
state_after: R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpI : p ∈ I
hpdeg : p.degree ≤ ↑n
this : p.natDegree + (n - p.natDegree) = n
⊢ ↑p.natDegree + ↑(n - p.natDegree) ≤ ↑n

tactic: rw [← Nat.cast_add, this]
state_before: R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpI : p ∈ I
hpdeg : p.degree ≤ ↑n
this : p.natDegree + (n - p.natDegree) = n
⊢ ↑p.natDegree + ↑(n - p.natDegree) ≤ ↑n
state_after: no goals

tactic: rw [Polynomial.leadingCoeff, ← coeff_mul_X_pow p (n - natDegree p), this]
state_before: case mpr.intro.intro.intro.refine_2
R : Type u
S : Type u_1
inst✝¹ : CommSemiring R
inst✝ : Semiring S
I : Ideal R[X]
n : ℕ
p : R[X]
hpI : p ∈ I
hpdeg : p.degree ≤ ↑n
this : p.natDegree + (n - p.natDegree) = n
⊢ (p * X ^ (n - p.natDegree)).coeff n = p.leadingCoeff
state_after: no goals