Theorem: MvPolynomial.totalDegree_add_eq_left_of_totalDegree_lt
File: Mathlib/Data/MvPolynomial/Variables.lean

tactic: apply le_antisymm
state_before: R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
⊢ totalDegree (p + q) = totalDegree p

tactic: by_cases hp : p = 0
state_before: case a
R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
⊢ totalDegree p ≤ totalDegree (p + q)

tactic: obtain ⟨b, hb₁, hb₂⟩ :=
  p.support.exists_mem_eq_sup (Finsupp.support_nonempty_iff.mpr hp) fun m : σ →₀ ℕ =>
    Multiset.card (toMultiset m)
state_before: case neg
R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
hp : ¬p = 0
⊢ totalDegree p ≤ totalDegree (p + q)

tactic: have hb : ¬b ∈ q.support := by
  contrapose! h
  rw [totalDegree_eq p, hb₂, totalDegree_eq]
  apply Finset.le_sup h
state_before: case neg.intro.intro
R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ support p
hb₂ : (Finset.sup (support p) fun m => ↑Multiset.card (↑toMultiset m)) = ↑Multiset.card (↑toMultiset b)
⊢ totalDegree p ≤ totalDegree (p + q)

tactic: have hbb : b ∈ (p + q).support := by
  apply support_sdiff_support_subset_support_add
  rw [Finset.mem_sdiff]
  exact ⟨hb₁, hb⟩
state_before: case neg.intro.intro
R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ support p
hb₂ : (Finset.sup (support p) fun m => ↑Multiset.card (↑toMultiset m)) = ↑Multiset.card (↑toMultiset b)
hb : ¬b ∈ support q
⊢ totalDegree p ≤ totalDegree (p + q)

tactic: rw [totalDegree_eq, hb₂, totalDegree_eq]
state_before: case neg.intro.intro
R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ support p
hb₂ : (Finset.sup (support p) fun m => ↑Multiset.card (↑toMultiset m)) = ↑Multiset.card (↑toMultiset b)
hb : ¬b ∈ support q
hbb : b ∈ support (p + q)
⊢ totalDegree p ≤ totalDegree (p + q)

tactic: exact Finset.le_sup (f := fun m => Multiset.card (Finsupp.toMultiset m)) hbb
state_before: case neg.intro.intro
R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ support p
hb₂ : (Finset.sup (support p) fun m => ↑Multiset.card (↑toMultiset m)) = ↑Multiset.card (↑toMultiset b)
hb : ¬b ∈ support q
hbb : b ∈ support (p + q)
⊢ ↑Multiset.card (↑toMultiset b) ≤ Finset.sup (support (p + q)) fun m => ↑Multiset.card (↑toMultiset m)

tactic: rw [← max_eq_left_of_lt h]
state_before: case a
R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
⊢ totalDegree (p + q) ≤ totalDegree p

tactic: exact totalDegree_add p q
state_before: case a
R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
⊢ totalDegree (p + q) ≤ max (totalDegree p) (totalDegree q)

tactic: simp [hp]
state_before: case pos
R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
hp : p = 0
⊢ totalDegree p ≤ totalDegree (p + q)

tactic: contrapose! h
state_before: R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ support p
hb₂ : (Finset.sup (support p) fun m => ↑Multiset.card (↑toMultiset m)) = ↑Multiset.card (↑toMultiset b)
⊢ ¬b ∈ support q

tactic: rw [totalDegree_eq p, hb₂, totalDegree_eq]
state_before: R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ support p
hb₂ : (Finset.sup (support p) fun m => ↑Multiset.card (↑toMultiset m)) = ↑Multiset.card (↑toMultiset b)
h : b ∈ support q
⊢ totalDegree p ≤ totalDegree q

tactic: apply Finset.le_sup h
state_before: R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ support p
hb₂ : (Finset.sup (support p) fun m => ↑Multiset.card (↑toMultiset m)) = ↑Multiset.card (↑toMultiset b)
h : b ∈ support q
⊢ ↑Multiset.card (↑toMultiset b) ≤ Finset.sup (support q) fun m => ↑Multiset.card (↑toMultiset m)

tactic: apply support_sdiff_support_subset_support_add
state_before: R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ support p
hb₂ : (Finset.sup (support p) fun m => ↑Multiset.card (↑toMultiset m)) = ↑Multiset.card (↑toMultiset b)
hb : ¬b ∈ support q
⊢ b ∈ support (p + q)

tactic: rw [Finset.mem_sdiff]
state_before: case a
R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ support p
hb₂ : (Finset.sup (support p) fun m => ↑Multiset.card (↑toMultiset m)) = ↑Multiset.card (↑toMultiset b)
hb : ¬b ∈ support q
⊢ b ∈ support p \ support q

tactic: exact ⟨hb₁, hb⟩
state_before: case a
R : Type u
S : Type v
σ : Type u_1
τ : Type ?u.399378
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : totalDegree q < totalDegree p
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ support p
hb₂ : (Finset.sup (support p) fun m => ↑Multiset.card (↑toMultiset m)) = ↑Multiset.card (↑toMultiset b)
hb : ¬b ∈ support q
⊢ b ∈ support p ∧ ¬b ∈ support q