Theorem: Polynomial.natDegree_sum_eq_of_disjoint
File: Mathlib/Data/Polynomial/Degree/Lemmas.lean

tactic: by_cases H : ∃ x ∈ s, f x ≠ 0
state_before: R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
⊢ natDegree (Finset.sum s f) = sup s fun i => natDegree (f i)

tactic: obtain ⟨x, hx, hx'⟩ := H
state_before: case pos
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
H : ∃ x, x ∈ s ∧ f x ≠ 0
⊢ natDegree (Finset.sum s f) = sup s fun i => natDegree (f i)

tactic: have hs : s.Nonempty := ⟨x, hx⟩
state_before: case pos.intro.intro
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
⊢ natDegree (Finset.sum s f) = sup s fun i => natDegree (f i)

tactic: refine' natDegree_eq_of_degree_eq_some _
state_before: case pos.intro.intro
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
⊢ natDegree (Finset.sum s f) = sup s fun i => natDegree (f i)

tactic: rw [degree_sum_eq_of_disjoint]
state_before: case pos.intro.intro
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
⊢ degree (Finset.sum s f) = ↑(sup s fun i => natDegree (f i))

tactic: dsimp
state_before: case pos.intro.intro
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
⊢ (sup s fun i => degree (f i)) = ↑(sup s fun i => natDegree (f i))

tactic: rw [← Finset.sup'_eq_sup hs, ← Finset.sup'_eq_sup hs,
  Nat.cast_withBot, Finset.coe_sup' hs, ←
  Finset.sup'_eq_sup hs]
state_before: case pos.intro.intro
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
⊢ (sup s fun i => degree (f i)) = ↑(sup s fun i => natDegree (f i))

tactic: refine' le_antisymm _ _
state_before: case pos.intro.intro
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
⊢ (sup' s hs fun i => degree (f i)) = sup' s hs (WithBot.some ∘ fun i => natDegree (f i))

tactic: rw [Finset.sup'_le_iff]
state_before: case pos.intro.intro.refine'_1
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
⊢ (sup' s hs fun i => degree (f i)) ≤ sup' s hs (WithBot.some ∘ fun i => natDegree (f i))

tactic: intro b hb
state_before: case pos.intro.intro.refine'_1
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
⊢ ∀ (b : S), b ∈ s → degree (f b) ≤ sup' s hs (WithBot.some ∘ fun i => natDegree (f i))

tactic: by_cases hb' : f b = 0
state_before: case pos.intro.intro.refine'_1
R : Type u
S : Type v
ι : Type w
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
b : S
hb : b ∈ s
⊢ degree (f b) ≤ sup' s hs (WithBot.some ∘ fun i => natDegree (f i))

tactic: rw [degree_eq_natDegree hb', Nat.cast_withBot]
state_before: case neg
R : Type u
S : Type v
ι : Type w
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
b : S
hb : b ∈ s
hb' : ¬f b = 0
⊢ degree (f b) ≤ sup' s hs (WithBot.some ∘ fun i => natDegree (f i))

tactic: exact Finset.le_sup' (fun i : S => (natDegree (f i) : WithBot ℕ)) hb
state_before: case neg
R : Type u
S : Type v
ι : Type w
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
b : S
hb : b ∈ s
hb' : ¬f b = 0
⊢ ↑(natDegree (f b)) ≤ sup' s hs (WithBot.some ∘ fun i => natDegree (f i))

tactic: simpa [hb'] using hs
state_before: case pos
R : Type u
S : Type v
ι : Type w
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
b : S
hb : b ∈ s
hb' : f b = 0
⊢ degree (f b) ≤ sup' s hs (WithBot.some ∘ fun i => natDegree (f i))

tactic: rw [Finset.sup'_le_iff]
state_before: case pos.intro.intro.refine'_2
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
⊢ sup' s hs (WithBot.some ∘ fun i => natDegree (f i)) ≤ sup' s hs fun i => degree (f i)

tactic: intro b hb
state_before: case pos.intro.intro.refine'_2
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
⊢ ∀ (b : S), b ∈ s → (WithBot.some ∘ fun i => natDegree (f i)) b ≤ sup' s hs fun i => degree (f i)

tactic: simp only [Finset.le_sup'_iff, exists_prop, Function.comp_apply]
state_before: case pos.intro.intro.refine'_2
R : Type u
S : Type v
ι : Type w
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
b : S
hb : b ∈ s
⊢ (WithBot.some ∘ fun i => natDegree (f i)) b ≤ sup' s hs fun i => degree (f i)

tactic: by_cases hb' : f b = 0
state_before: case pos.intro.intro.refine'_2
R : Type u
S : Type v
ι : Type w
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
b : S
hb : b ∈ s
⊢ ∃ b_1, b_1 ∈ s ∧ ↑(natDegree (f b)) ≤ degree (f b_1)

tactic: exact ⟨b, hb, (degree_eq_natDegree hb').ge⟩
state_before: case neg
R : Type u
S : Type v
ι : Type w
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
b : S
hb : b ∈ s
hb' : ¬f b = 0
⊢ ∃ b_1, b_1 ∈ s ∧ ↑(natDegree (f b)) ≤ degree (f b_1)

tactic: refine' ⟨x, hx, _⟩
state_before: case pos
R : Type u
S : Type v
ι : Type w
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
b : S
hb : b ∈ s
hb' : f b = 0
⊢ ∃ b_1, b_1 ∈ s ∧ ↑(natDegree (f b)) ≤ degree (f b_1)

tactic: contrapose! hx'
state_before: case pos
R : Type u
S : Type v
ι : Type w
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
b : S
hb : b ∈ s
hb' : f b = 0
⊢ ↑(natDegree (f b)) ≤ degree (f x)

tactic: simpa [← Nat.cast_withBot, hb', degree_eq_bot] using hx'
state_before: case pos
R : Type u
S : Type v
ι : Type w
a b✝ : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hs : Finset.Nonempty s
b : S
hb : b ∈ s
hb' : f b = 0
hx' : degree (f x) < ↑(natDegree (f b))
⊢ f x = 0

tactic: exact h.imp fun x y hxy hxy' => hxy (natDegree_eq_of_degree_eq hxy')
state_before: case pos.intro.intro.h
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
x : S
hx : x ∈ s
hx' : f x ≠ 0
hs : Finset.Nonempty s
⊢ Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on degree ∘ f)

tactic: push_neg  at H
state_before: case neg
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
H : ¬∃ x, x ∈ s ∧ f x ≠ 0
⊢ natDegree (Finset.sum s f) = sup s fun i => natDegree (f i)

tactic: rw [Finset.sum_eq_zero H, natDegree_zero, eq_comm, show 0 = ⊥ from rfl, Finset.sup_eq_bot_iff]
state_before: case neg
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
H : ∀ (x : S), x ∈ s → f x = 0
⊢ natDegree (Finset.sum s f) = sup s fun i => natDegree (f i)

tactic: intro x hx
state_before: case neg
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
H : ∀ (x : S), x ∈ s → f x = 0
⊢ ∀ (s_1 : S), s_1 ∈ s → natDegree (f s_1) = ⊥

tactic: simp [H x hx]
state_before: case neg
R : Type u
S : Type v
ι : Type w
a b : R
m n : ℕ
inst✝ : Semiring R
p q r : R[X]
f : S → R[X]
s : Finset S
h : Set.Pairwise {i | i ∈ s ∧ f i ≠ 0} (Ne on natDegree ∘ f)
H : ∀ (x : S), x ∈ s → f x = 0
x : S
hx : x ∈ s
⊢ natDegree (f x) = ⊥