Theorem: Polynomial.exists_multiset_roots
File: Mathlib/Data/Polynomial/RingDivision.lean

tactic: rw [← mul_divByMonic_eq_iff_isRoot.2 hx, h, MulZeroClass.mul_zero] at hp
state_before: R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h✝ : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
h : p /ₘ (X - ↑C x) = 0
⊢ False

tactic: exact hp rfl
state_before: R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
this : Decidable (∃ x, IsRoot p x)
h✝ : ∃ x, IsRoot p x
x : R
hp : 0 ≠ 0
hx : IsRoot p x
hpd : 0 < degree p
h : p /ₘ (X - ↑C x) = 0
⊢ False

tactic: decide
state_before: R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
⊢ 0 < 1

tactic: rw [degree_X_sub_C, degree_eq_natDegree hp]
state_before: R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
⊢ degree (X - ↑C x) ≤ degree p

tactic: rw [degree_eq_natDegree hp] at hpd
state_before: R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
⊢ 1 ≤ ↑(natDegree p)

tactic: exact WithBot.coe_le_coe.2 (WithBot.coe_lt_coe.1 hpd)
state_before: R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < ↑(natDegree p)
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
⊢ 1 ≤ ↑(natDegree p)

tactic: congr
state_before: R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
hdeg : degree (X - ↑C x) ≤ degree p
hdiv0 : p /ₘ (X - ↑C x) ≠ 0
⊢ ↑(↑Multiset.card (x ::ₘ t)) = ↑(↑Multiset.card t) + 1

tactic: exact_mod_cast Multiset.card_cons _ _
state_before: case e_a
R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
hdeg : degree (X - ↑C x) ≤ degree p
hdiv0 : p /ₘ (X - ↑C x) ≠ 0
⊢ ↑Multiset.card (x ::ₘ t) = Add.add (↑(↑Multiset.card t)) 1

tactic: rw [← degree_add_divByMonic (monic_X_sub_C x) hdeg, degree_X_sub_C, add_comm]
state_before: R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
hdeg : degree (X - ↑C x) ≤ degree p
hdiv0 : p /ₘ (X - ↑C x) ≠ 0
⊢ ↑(↑Multiset.card t) + 1 ≤ degree p

tactic: exact add_le_add (le_refl (1 : WithBot ℕ)) htd
state_before: R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
hdeg : degree (X - ↑C x) ≤ degree p
hdiv0 : p /ₘ (X - ↑C x) ≠ 0
⊢ 1 + ↑(↑Multiset.card t) ≤ 1 + degree (p /ₘ (X - ↑C x))

tactic: change ∀ (a : R), count a (x ::ₘ t) = rootMultiplicity a p
state_before: R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
hdeg : degree (X - ↑C x) ≤ degree p
hdiv0 : p /ₘ (X - ↑C x) ≠ 0
⊢ ∀ (a : R), count a (x ::ₘ t) = rootMultiplicity a p

tactic: intro a
state_before: R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
hdeg : degree (X - ↑C x) ≤ degree p
hdiv0 : p /ₘ (X - ↑C x) ≠ 0
⊢ ∀ (a : R), count a (x ::ₘ t) = rootMultiplicity a p

tactic: conv_rhs => rw [← mul_divByMonic_eq_iff_isRoot.mpr hx]
state_before: R : Type u
S : Type v
T : Type w
a✝ b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
hdeg : degree (X - ↑C x) ≤ degree p
hdiv0 : p /ₘ (X - ↑C x) ≠ 0
a : R
⊢ count a (x ::ₘ t) = rootMultiplicity a p

tactic: rw [rootMultiplicity_mul (mul_ne_zero (X_sub_C_ne_zero x) hdiv0),
  rootMultiplicity_X_sub_C, ← htr a]
state_before: R : Type u
S : Type v
T : Type w
a✝ b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
hdeg : degree (X - ↑C x) ≤ degree p
hdiv0 : p /ₘ (X - ↑C x) ≠ 0
a : R
⊢ count a (x ::ₘ t) = rootMultiplicity a ((X - ↑C x) * (p /ₘ (X - ↑C x)))

tactic: split_ifs with ha
state_before: R : Type u
S : Type v
T : Type w
a✝ b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
hdeg : degree (X - ↑C x) ≤ degree p
hdiv0 : p /ₘ (X - ↑C x) ≠ 0
a : R
⊢ count a (x ::ₘ t) = (if a = x then 1 else 0) + count a t

tactic: rw [ha, count_cons_self, add_comm]
state_before: case inl
R : Type u
S : Type v
T : Type w
a✝ b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
hdeg : degree (X - ↑C x) ≤ degree p
hdiv0 : p /ₘ (X - ↑C x) ≠ 0
a : R
ha : a = x
⊢ count a (x ::ₘ t) = 1 + count a t

tactic: rw [count_cons_of_ne ha, zero_add]
state_before: case inr
R : Type u
S : Type v
T : Type w
a✝ b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ∃ x, IsRoot p x
x : R
hx : IsRoot p x
hpd : 0 < degree p
hd0 : p /ₘ (X - ↑C x) ≠ 0
wf : degree (p /ₘ (X - ↑C x)) < degree p
t : Multiset R
htd : ↑(↑Multiset.card t) ≤ degree (p /ₘ (X - ↑C x))
htr : ∀ (a : R), count a t = rootMultiplicity a (p /ₘ (X - ↑C x))
hdeg : degree (X - ↑C x) ≤ degree p
hdiv0 : p /ₘ (X - ↑C x) ≠ 0
a : R
ha : ¬a = x
⊢ count a (x ::ₘ t) = 0 + count a t

tactic: intro a
state_before: R : Type u
S : Type v
T : Type w
a b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ¬∃ x, IsRoot p x
⊢ ∀ (a : R), count a 0 = rootMultiplicity a p

tactic: rw [count_zero, rootMultiplicity_eq_zero (not_exists.mp h a)]
state_before: R : Type u
S : Type v
T : Type w
a✝ b : R
n : ℕ
inst✝¹ : CommRing R
inst✝ : IsDomain R
p✝ q p : R[X]
hp : p ≠ 0
this : Decidable (∃ x, IsRoot p x)
h : ¬∃ x, IsRoot p x
a : R
⊢ count a 0 = rootMultiplicity a p