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

tactic: by_contra! h
state_before: R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
⊢ ∃ p' ∈ s, p.degree ≤ p'.degree
state_after: R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < p.degree
⊢ False

tactic: by_cases hp_zero : p = 0
state_before: R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < p.degree
⊢ False
state_after: case pos
R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < p.degree
hp_zero : p = 0
⊢ False

case neg
R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < p.degree
hp_zero : ¬p = 0
⊢ False

tactic: rw [hp_zero, degree_zero] at h
state_before: case pos
R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < p.degree
hp_zero : p = 0
⊢ False
state_after: case pos
R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < ⊥
hp_zero : p = 0
⊢ False

tactic: rcases hs with ⟨x, hx⟩
state_before: case pos
R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < ⊥
hp_zero : p = 0
⊢ False
state_after: case pos.intro
R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < ⊥
hp_zero : p = 0
x : R[X]
hx : x ∈ s
⊢ False

tactic: exact not_lt_bot (h x hx)
state_before: case pos.intro
R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < ⊥
hp_zero : p = 0
x : R[X]
hx : x ∈ s
⊢ False
state_after: no goals

tactic: have : p ∈ degreeLT R (natDegree p) := by
  refine (Submodule.span_le.mpr fun p' p'_mem => ?_) hp
  rw [SetLike.mem_coe, mem_degreeLT, Nat.cast_withBot]
  exact lt_of_lt_of_le (h p' p'_mem) degree_le_natDegree
state_before: case neg
R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < p.degree
hp_zero : ¬p = 0
⊢ False
state_after: case neg
R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < p.degree
hp_zero : ¬p = 0
this : p ∈ degreeLT R p.natDegree
⊢ False

tactic: rwa [mem_degreeLT, Nat.cast_withBot, degree_eq_natDegree hp_zero,
  Nat.cast_withBot, lt_self_iff_false] at this
state_before: case neg
R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < p.degree
hp_zero : ¬p = 0
this : p ∈ degreeLT R p.natDegree
⊢ False
state_after: no goals

tactic: refine (Submodule.span_le.mpr fun p' p'_mem => ?_) hp
state_before: R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < p.degree
hp_zero : ¬p = 0
⊢ p ∈ degreeLT R p.natDegree
state_after: R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < p.degree
hp_zero : ¬p = 0
p' : R[X]
p'_mem : p' ∈ s
⊢ p' ∈ ↑(degreeLT R p.natDegree)

tactic: rw [SetLike.mem_coe, mem_degreeLT, Nat.cast_withBot]
state_before: R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < p.degree
hp_zero : ¬p = 0
p' : R[X]
p'_mem : p' ∈ s
⊢ p' ∈ ↑(degreeLT R p.natDegree)
state_after: R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < p.degree
hp_zero : ¬p = 0
p' : R[X]
p'_mem : p' ∈ s
⊢ p'.degree < ↑p.natDegree

tactic: exact lt_of_lt_of_le (h p' p'_mem) degree_le_natDegree
state_before: R : Type u
S : Type u_1
inst✝ : Semiring R
s : Set R[X]
p : R[X]
hs : s.Nonempty
hp : p ∈ Submodule.span R s
h : ∀ p' ∈ s, p'.degree < p.degree
hp_zero : ¬p = 0
p' : R[X]
p'_mem : p' ∈ s
⊢ p'.degree < ↑p.natDegree
state_after: no goals