Theorem: Polynomial.degreeLE_eq_span_X_pow
File: Mathlib/RingTheory/Polynomial/Basic.lean

tactic: apply le_antisymm
state_before: R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
⊢ degreeLE R ↑n = Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))
state_after: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
⊢ degreeLE R ↑n ≤ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))

case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
⊢ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1))) ≤ degreeLE R ↑n

tactic: rw [Submodule.span_le, Finset.coe_image, Set.image_subset_iff]
state_before: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
⊢ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1))) ≤ degreeLE R ↑n
state_after: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
⊢ ↑(range (n + 1)) ⊆ (fun n => X ^ n) ⁻¹' ↑(degreeLE R ↑n)

tactic: intro k hk
state_before: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
⊢ ↑(range (n + 1)) ⊆ (fun n => X ^ n) ⁻¹' ↑(degreeLE R ↑n)
state_after: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n k : ℕ
hk : k ∈ ↑(range (n + 1))
⊢ k ∈ (fun n => X ^ n) ⁻¹' ↑(degreeLE R ↑n)

tactic: apply mem_degreeLE.2
state_before: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n k : ℕ
hk : k ∈ ↑(range (n + 1))
⊢ k ∈ (fun n => X ^ n) ⁻¹' ↑(degreeLE R ↑n)
state_after: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n k : ℕ
hk : k ∈ ↑(range (n + 1))
⊢ ((fun n => X ^ n) k).degree ≤ ↑n

tactic: exact
  (degree_X_pow_le _).trans (WithBot.coe_le_coe.2 <| Nat.le_of_lt_succ <| Finset.mem_range.1 hk)
state_before: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n k : ℕ
hk : k ∈ ↑(range (n + 1))
⊢ ((fun n => X ^ n) k).degree ≤ ↑n
state_after: no goals

tactic: intro p hp
state_before: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
⊢ degreeLE R ↑n ≤ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))
state_after: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
p : R[X]
hp : p ∈ degreeLE R ↑n
⊢ p ∈ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))

tactic: replace hp := mem_degreeLE.1 hp
state_before: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
p : R[X]
hp : p ∈ degreeLE R ↑n
⊢ p ∈ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))
state_after: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
p : R[X]
hp : p.degree ≤ ↑n
⊢ p ∈ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))

tactic: rw [← Polynomial.sum_monomial_eq p, Polynomial.sum]
state_before: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
p : R[X]
hp : p.degree ≤ ↑n
⊢ p ∈ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))
state_after: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
p : R[X]
hp : p.degree ≤ ↑n
⊢ ∑ n ∈ p.support, (monomial n) (p.coeff n) ∈ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))

tactic: refine Submodule.sum_mem _ fun k hk => ?_
state_before: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
p : R[X]
hp : p.degree ≤ ↑n
⊢ ∑ n ∈ p.support, (monomial n) (p.coeff n) ∈ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))
state_after: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
p : R[X]
hp : p.degree ≤ ↑n
k : ℕ
hk : k ∈ p.support
⊢ (monomial k) (p.coeff k) ∈ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))

tactic: have := WithBot.coe_le_coe.1 (Finset.sup_le_iff.1 hp k hk)
state_before: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
p : R[X]
hp : p.degree ≤ ↑n
k : ℕ
hk : k ∈ p.support
⊢ (monomial k) (p.coeff k) ∈ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))
state_after: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
p : R[X]
hp : p.degree ≤ ↑n
k : ℕ
hk : k ∈ p.support
this : k ≤ ↑n
⊢ (monomial k) (p.coeff k) ∈ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))

tactic: rw [← C_mul_X_pow_eq_monomial, C_mul']
state_before: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
p : R[X]
hp : p.degree ≤ ↑n
k : ℕ
hk : k ∈ p.support
this : k ≤ ↑n
⊢ (monomial k) (p.coeff k) ∈ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))
state_after: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
p : R[X]
hp : p.degree ≤ ↑n
k : ℕ
hk : k ∈ p.support
this : k ≤ ↑n
⊢ p.coeff k • X ^ k ∈ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))

tactic: refine
  Submodule.smul_mem _ _
    (Submodule.subset_span <|
      Finset.mem_coe.2 <|
        Finset.mem_image.2 ⟨_, Finset.mem_range.2 (Nat.lt_succ_of_le this), rfl⟩)
state_before: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
p : R[X]
hp : p.degree ≤ ↑n
k : ℕ
hk : k ∈ p.support
this : k ≤ ↑n
⊢ p.coeff k • X ^ k ∈ Submodule.span R ↑(image (fun n => X ^ n) (range (n + 1)))
state_after: no goals