Theorem: MvPolynomial.totalDegree_add_eq_left_of_totalDegree_lt
File: Mathlib/Algebra/MvPolynomial/Degrees.lean

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

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

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

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

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_2
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : q.totalDegree < p.totalDegree
hp : ¬p = 0
⊢ p.totalDegree ≤ (p + q).totalDegree
state_after: case neg.intro.intro
R : Type u
S : Type v
σ : Type u_1
τ : Type u_2
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : q.totalDegree < p.totalDegree
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ p.support
hb₂ : (p.support.sup fun m => Multiset.card (toMultiset m)) = Multiset.card (toMultiset b)
⊢ p.totalDegree ≤ (p + q).totalDegree

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_2
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : q.totalDegree < p.totalDegree
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ p.support
hb₂ : (p.support.sup fun m => Multiset.card (toMultiset m)) = Multiset.card (toMultiset b)
⊢ p.totalDegree ≤ (p + q).totalDegree
state_after: case neg.intro.intro
R : Type u
S : Type v
σ : Type u_1
τ : Type u_2
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : q.totalDegree < p.totalDegree
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ p.support
hb₂ : (p.support.sup fun m => Multiset.card (toMultiset m)) = Multiset.card (toMultiset b)
hb : b ∉ q.support
⊢ p.totalDegree ≤ (p + q).totalDegree

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_2
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : q.totalDegree < p.totalDegree
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ p.support
hb₂ : (p.support.sup fun m => Multiset.card (toMultiset m)) = Multiset.card (toMultiset b)
hb : b ∉ q.support
⊢ p.totalDegree ≤ (p + q).totalDegree
state_after: case neg.intro.intro
R : Type u
S : Type v
σ : Type u_1
τ : Type u_2
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : q.totalDegree < p.totalDegree
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ p.support
hb₂ : (p.support.sup fun m => Multiset.card (toMultiset m)) = Multiset.card (toMultiset b)
hb : b ∉ q.support
hbb : b ∈ (p + q).support
⊢ p.totalDegree ≤ (p + q).totalDegree

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

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_2
r : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommSemiring R
p✝ q✝ p q : MvPolynomial σ R
h : q.totalDegree < p.totalDegree
hp : ¬p = 0
b : σ →₀ ℕ
hb₁ : b ∈ p.support
hb₂ : (p.support.sup fun m => Multiset.card (toMultiset m)) = Multiset.card (toMultiset b)
hb : b ∉ q.support
hbb : b ∈ (p + q).support
⊢ Multiset.card (toMultiset b) ≤ (p + q).support.sup fun m => Multiset.card (toMultiset m)
state_after: no goals

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

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

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

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

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

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

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

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

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