Theorem: Polynomial.degreeLT_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 : ℕ
⊢ degreeLT R n = Submodule.span R ↑(image (fun n => X ^ n) (range n))
state_after: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
⊢ degreeLT R n ≤ Submodule.span R ↑(image (fun n => X ^ n) (range n))

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)) ≤ degreeLT 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)) ≤ degreeLT R n
state_after: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
⊢ ↑(range n) ⊆ (fun n => X ^ n) ⁻¹' ↑(degreeLT 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) ⊆ (fun n => X ^ n) ⁻¹' ↑(degreeLT 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)
⊢ k ∈ (fun n => X ^ n) ⁻¹' ↑(degreeLT R n)

tactic: apply mem_degreeLT.2
state_before: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n k : ℕ
hk : k ∈ ↑(range n)
⊢ k ∈ (fun n => X ^ n) ⁻¹' ↑(degreeLT 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)
⊢ ((fun n => X ^ n) k).degree < ↑n

tactic: exact lt_of_le_of_lt (degree_X_pow_le _) (WithBot.coe_lt_coe.2 <| 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)
⊢ ((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 : ℕ
⊢ degreeLT R n ≤ Submodule.span R ↑(image (fun n => X ^ n) (range n))
state_after: case a
R : Type u
S : Type u_1
inst✝¹ : Semiring R
inst✝ : DecidableEq R
n : ℕ
p : R[X]
hp : p ∈ degreeLT R n
⊢ p ∈ Submodule.span R ↑(image (fun n => X ^ n) (range n))

tactic: replace hp := mem_degreeLT.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 ∈ degreeLT R n
⊢ p ∈ Submodule.span R ↑(image (fun n => X ^ n) (range n))
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))

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))
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))

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))
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))

tactic: have := WithBot.coe_lt_coe.1 ((Finset.sup_lt_iff <| WithBot.bot_lt_coe n).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))
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))

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))
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))

tactic: refine
  Submodule.smul_mem _ _
    (Submodule.subset_span <|
      Finset.mem_coe.2 <| Finset.mem_image.2 ⟨_, Finset.mem_range.2 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))
state_after: no goals