Theorem: Polynomial.roots_expand_pow_map_iterateFrobenius_le
File: Mathlib/FieldTheory/Perfect.lean

tactic: refine le_iff_count.2 fun r ↦ ?_
state_before: R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
⊢ Multiset.map (⇑(iterateFrobenius R p n)) ((expand R (p ^ n)) f).roots ≤ p ^ n • f.roots
state_after: R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
r : R
⊢ count r (Multiset.map (⇑(iterateFrobenius R p n)) ((expand R (p ^ n)) f).roots) ≤ count r (p ^ n • f.roots)

tactic: by_cases h : ∃ s, r = s ^ p ^ n
state_before: R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
r : R
⊢ count r (Multiset.map (⇑(iterateFrobenius R p n)) ((expand R (p ^ n)) f).roots) ≤ count r (p ^ n • f.roots)
state_after: case pos
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
r : R
h : ∃ s, r = s ^ p ^ n
⊢ count r (Multiset.map (⇑(iterateFrobenius R p n)) ((expand R (p ^ n)) f).roots) ≤ count r (p ^ n • f.roots)

case neg
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
r : R
h : ¬∃ s, r = s ^ p ^ n
⊢ count r (Multiset.map (⇑(iterateFrobenius R p n)) ((expand R (p ^ n)) f).roots) ≤ count r (p ^ n • f.roots)

tactic: convert Nat.zero_le _
state_before: case neg
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
r : R
h : ¬∃ s, r = s ^ p ^ n
⊢ count r (Multiset.map (⇑(iterateFrobenius R p n)) ((expand R (p ^ n)) f).roots) ≤ count r (p ^ n • f.roots)
state_after: case h.e'_3
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
r : R
h : ¬∃ s, r = s ^ p ^ n
⊢ count r (Multiset.map (⇑(iterateFrobenius R p n)) ((expand R (p ^ n)) f).roots) = 0

tactic: simp_rw [count_map, card_eq_zero]
state_before: case h.e'_3
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
r : R
h : ¬∃ s, r = s ^ p ^ n
⊢ count r (Multiset.map (⇑(iterateFrobenius R p n)) ((expand R (p ^ n)) f).roots) = 0
state_after: case h.e'_3
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
r : R
h : ¬∃ s, r = s ^ p ^ n
⊢ filter (fun a => r = (iterateFrobenius R p n) a) ((expand R (p ^ n)) f).roots = 0

tactic: exact ext' fun t ↦ count_zero t ▸ count_filter_of_neg fun h' ↦ h ⟨t, h'⟩
state_before: case h.e'_3
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
r : R
h : ¬∃ s, r = s ^ p ^ n
⊢ filter (fun a => r = (iterateFrobenius R p n) a) ((expand R (p ^ n)) f).roots = 0
state_after: no goals

tactic: obtain ⟨s, rfl⟩ := h
state_before: case pos
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
r : R
h : ∃ s, r = s ^ p ^ n
⊢ count r (Multiset.map (⇑(iterateFrobenius R p n)) ((expand R (p ^ n)) f).roots) ≤ count r (p ^ n • f.roots)
state_after: case pos.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
s : R
⊢ count (s ^ p ^ n) (Multiset.map (⇑(iterateFrobenius R p n)) ((expand R (p ^ n)) f).roots) ≤
    count (s ^ p ^ n) (p ^ n • f.roots)

tactic: simp_rw [count_nsmul, count_roots, ← rootMultiplicity_expand_pow, ← count_roots, count_map,
  count_eq_card_filter_eq]
state_before: case pos.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
s : R
⊢ count (s ^ p ^ n) (Multiset.map (⇑(iterateFrobenius R p n)) ((expand R (p ^ n)) f).roots) ≤
    count (s ^ p ^ n) (p ^ n • f.roots)
state_after: case pos.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
s : R
⊢ card (filter (fun a => s ^ p ^ n = (iterateFrobenius R p n) a) ((expand R (p ^ n)) f).roots) ≤
    card (filter (fun x => s = x) ((expand R (p ^ n)) f).roots)

tactic: exact card_le_card (monotone_filter_right _ fun _ h ↦ iterateFrobenius_inj R p n h)
state_before: case pos.intro
R : Type u_1
inst✝² : CommRing R
inst✝¹ : IsDomain R
p n : ℕ
inst✝ : ExpChar R p
f : R[X]
s : R
⊢ card (filter (fun a => s ^ p ^ n = (iterateFrobenius R p n) a) ((expand R (p ^ n)) f).roots) ≤
    card (filter (fun x => s = x) ((expand R (p ^ n)) f).roots)
state_after: no goals