Theorem: Polynomial.natDegree_eq_card_roots'
File: Mathlib/Data/Polynomial/Splits.lean

tactic: by_cases hp : p.map i = 0
state_before: F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
hsplit : Splits i p
⊢ natDegree (map i p) = ↑Multiset.card (roots (map i p))

tactic: obtain ⟨q, he, hd, hr⟩ := exists_prod_multiset_X_sub_C_mul (p.map i)
state_before: case neg
F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
hsplit : Splits i p
hp : ¬map i p = 0
⊢ natDegree (map i p) = ↑Multiset.card (roots (map i p))

tactic: rw [← splits_id_iff_splits, ← he] at hsplit
state_before: case neg.intro.intro.intro
F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
hsplit : Splits i p
hp : ¬map i p = 0
q : L[X]
he : Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = map i p
hd : ↑Multiset.card (roots (map i p)) + natDegree q = natDegree (map i p)
hr : roots q = 0
⊢ natDegree (map i p) = ↑Multiset.card (roots (map i p))

tactic: rw [← he] at hp
state_before: case neg.intro.intro.intro
F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
hp : ¬map i p = 0
q : L[X]
hsplit : Splits (RingHom.id L) (Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q)
he : Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = map i p
hd : ↑Multiset.card (roots (map i p)) + natDegree q = natDegree (map i p)
hr : roots q = 0
⊢ natDegree (map i p) = ↑Multiset.card (roots (map i p))

tactic: have hq : q ≠ 0 := fun h => hp (by rw [h, MulZeroClass.mul_zero])
state_before: case neg.intro.intro.intro
F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
q : L[X]
hp : ¬Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = 0
hsplit : Splits (RingHom.id L) (Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q)
he : Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = map i p
hd : ↑Multiset.card (roots (map i p)) + natDegree q = natDegree (map i p)
hr : roots q = 0
⊢ natDegree (map i p) = ↑Multiset.card (roots (map i p))

tactic: rw [← hd, add_right_eq_self]
state_before: case neg.intro.intro.intro
F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
q : L[X]
hp : ¬Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = 0
hsplit : Splits (RingHom.id L) (Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q)
he : Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = map i p
hd : ↑Multiset.card (roots (map i p)) + natDegree q = natDegree (map i p)
hr : roots q = 0
hq : q ≠ 0
⊢ natDegree (map i p) = ↑Multiset.card (roots (map i p))

tactic: by_contra h
state_before: case neg.intro.intro.intro
F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
q : L[X]
hp : ¬Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = 0
hsplit : Splits (RingHom.id L) (Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q)
he : Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = map i p
hd : ↑Multiset.card (roots (map i p)) + natDegree q = natDegree (map i p)
hr : roots q = 0
hq : q ≠ 0
⊢ natDegree q = 0

tactic: have h' : (map (RingHom.id L) q).natDegree ≠ 0 := by simp [h]
state_before: case neg.intro.intro.intro
F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
q : L[X]
hp : ¬Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = 0
hsplit : Splits (RingHom.id L) (Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q)
he : Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = map i p
hd : ↑Multiset.card (roots (map i p)) + natDegree q = natDegree (map i p)
hr : roots q = 0
hq : q ≠ 0
h : ¬natDegree q = 0
⊢ False

tactic: have := roots_ne_zero_of_splits' (RingHom.id L) (splits_of_splits_mul' _ ?_ hsplit).2 h'
state_before: case neg.intro.intro.intro
F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
q : L[X]
hp : ¬Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = 0
hsplit : Splits (RingHom.id L) (Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q)
he : Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = map i p
hd : ↑Multiset.card (roots (map i p)) + natDegree q = natDegree (map i p)
hr : roots q = 0
hq : q ≠ 0
h : ¬natDegree q = 0
h' : natDegree (map (RingHom.id L) q) ≠ 0
⊢ False

tactic: rw [hp, natDegree_zero, roots_zero, Multiset.card_zero]
state_before: case pos
F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
hsplit : Splits i p
hp : map i p = 0
⊢ natDegree (map i p) = ↑Multiset.card (roots (map i p))

tactic: rw [h, MulZeroClass.mul_zero]
state_before: F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
q : L[X]
hp : ¬Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = 0
hsplit : Splits (RingHom.id L) (Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q)
he : Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = map i p
hd : ↑Multiset.card (roots (map i p)) + natDegree q = natDegree (map i p)
hr : roots q = 0
h : q = 0
⊢ Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = 0

tactic: simp [h]
state_before: F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
q : L[X]
hp : ¬Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = 0
hsplit : Splits (RingHom.id L) (Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q)
he : Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = map i p
hd : ↑Multiset.card (roots (map i p)) + natDegree q = natDegree (map i p)
hr : roots q = 0
hq : q ≠ 0
h : ¬natDegree q = 0
⊢ natDegree (map (RingHom.id L) q) ≠ 0

tactic: rw [map_id] at this
state_before: case neg.intro.intro.intro.refine_2
F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
q : L[X]
hp : ¬Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = 0
hsplit : Splits (RingHom.id L) (Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q)
he : Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = map i p
hd : ↑Multiset.card (roots (map i p)) + natDegree q = natDegree (map i p)
hr : roots q = 0
hq : q ≠ 0
h : ¬natDegree q = 0
h' : natDegree (map (RingHom.id L) q) ≠ 0
this : roots (map (RingHom.id L) q) ≠ 0
⊢ False

tactic: exact this hr
state_before: case neg.intro.intro.intro.refine_2
F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
q : L[X]
hp : ¬Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = 0
hsplit : Splits (RingHom.id L) (Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q)
he : Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = map i p
hd : ↑Multiset.card (roots (map i p)) + natDegree q = natDegree (map i p)
hr : roots q = 0
hq : q ≠ 0
h : ¬natDegree q = 0
h' : natDegree (map (RingHom.id L) q) ≠ 0
this : roots q ≠ 0
⊢ False

tactic: rw [map_id]
state_before: case neg.intro.intro.intro.refine_1
F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
q : L[X]
hp : ¬Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = 0
hsplit : Splits (RingHom.id L) (Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q)
he : Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = map i p
hd : ↑Multiset.card (roots (map i p)) + natDegree q = natDegree (map i p)
hr : roots q = 0
hq : q ≠ 0
h : ¬natDegree q = 0
h' : natDegree (map (RingHom.id L) q) ≠ 0
⊢ map (RingHom.id L) (Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q) ≠ 0

tactic: exact mul_ne_zero monic_prod_multiset_X_sub_C.ne_zero hq
state_before: case neg.intro.intro.intro.refine_1
F : Type u
K : Type v
L : Type w
inst✝² : CommRing K
inst✝¹ : Field L
inst✝ : Field F
i✝ : K →+* L
p : K[X]
i : K →+* L
q : L[X]
hp : ¬Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = 0
hsplit : Splits (RingHom.id L) (Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q)
he : Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q = map i p
hd : ↑Multiset.card (roots (map i p)) + natDegree q = natDegree (map i p)
hr : roots q = 0
hq : q ≠ 0
h : ¬natDegree q = 0
h' : natDegree (map (RingHom.id L) q) ≠ 0
⊢ Multiset.prod (Multiset.map (fun a => X - ↑C a) (roots (map i p))) * q ≠ 0