Theorem: Polynomial.degree_list_sum_le
File: Mathlib/Algebra/Polynomial/BigOperators.lean

tactic: by_cases h : l.sum = 0
state_before: R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
⊢ l.sum.degree ≤ (List.map natDegree l).maximum
state_after: case pos
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : l.sum = 0
⊢ l.sum.degree ≤ (List.map natDegree l).maximum

case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : ¬l.sum = 0
⊢ l.sum.degree ≤ (List.map natDegree l).maximum

tactic: simp [h]
state_before: case pos
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : l.sum = 0
⊢ l.sum.degree ≤ (List.map natDegree l).maximum
state_after: no goals

tactic: rw [degree_eq_natDegree h]
state_before: case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : ¬l.sum = 0
⊢ l.sum.degree ≤ (List.map natDegree l).maximum
state_after: case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : ¬l.sum = 0
⊢ ↑l.sum.natDegree ≤ (List.map natDegree l).maximum

tactic: suffices (l.map natDegree).maximum = ((l.map natDegree).foldr max 0 : ℕ) by
  rw [this]
  simpa using natDegree_list_sum_le l
state_before: case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : ¬l.sum = 0
⊢ ↑l.sum.natDegree ≤ (List.map natDegree l).maximum
state_after: case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : ¬l.sum = 0
⊢ (List.map natDegree l).maximum = ↑(List.foldr max 0 (List.map natDegree l))

tactic: rw [← List.foldr_max_of_ne_nil]
state_before: case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : ¬l.sum = 0
⊢ (List.map natDegree l).maximum = ↑(List.foldr max 0 (List.map natDegree l))
state_after: case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : ¬l.sum = 0
⊢ ↑(List.foldr max ⊥ (List.map natDegree l)) = ↑(List.foldr max 0 (List.map natDegree l))

case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : ¬l.sum = 0
⊢ List.map natDegree l ≠ []

tactic: contrapose! h
state_before: case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : ¬l.sum = 0
⊢ List.map natDegree l ≠ []
state_after: case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : List.map natDegree l = []
⊢ l.sum = 0

tactic: rw [List.map_eq_nil] at h
state_before: case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : List.map natDegree l = []
⊢ l.sum = 0
state_after: case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : l = []
⊢ l.sum = 0

tactic: simp [h]
state_before: case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : l = []
⊢ l.sum = 0
state_after: no goals

tactic: rw [this]
state_before: R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : ¬l.sum = 0
this : (List.map natDegree l).maximum = ↑(List.foldr max 0 (List.map natDegree l))
⊢ ↑l.sum.natDegree ≤ (List.map natDegree l).maximum
state_after: R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : ¬l.sum = 0
this : (List.map natDegree l).maximum = ↑(List.foldr max 0 (List.map natDegree l))
⊢ ↑l.sum.natDegree ≤ ↑(List.foldr max 0 (List.map natDegree l))

tactic: simpa using natDegree_list_sum_le l
state_before: R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : ¬l.sum = 0
this : (List.map natDegree l).maximum = ↑(List.foldr max 0 (List.map natDegree l))
⊢ ↑l.sum.natDegree ≤ ↑(List.foldr max 0 (List.map natDegree l))
state_after: no goals

tactic: congr
state_before: case neg
R : Type u
ι : Type w
s : Finset ι
S : Type u_1
inst✝ : Semiring S
l : List S[X]
h : ¬l.sum = 0
⊢ ↑(List.foldr max ⊥ (List.map natDegree l)) = ↑(List.foldr max 0 (List.map natDegree l))
state_after: no goals