l3lab/ntp-mathlib huggingface dataset:
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
⊢ ∃ a, (frobenius K p) a = y

Next tactic:
have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
⊢ degree f ≠ 0

Next tactic:
rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; 

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
⊢ p ≠ 0

Next tactic:
exact hp.out.ne_zero
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
⊢ ∃ a, (frobenius K p) a = y

Next tactic:
let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
⊢ ∃ a, (frobenius K p) a = y

Next tactic:
have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by 

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
⊢ (aeval a) f = 0

Next tactic:
rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
  

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
hfa : (aeval a) f = 0
⊢ ∃ a, (frobenius K p) a = y

Next tactic:
have ha_pow : a ^ p = ι y := by rwa [AlgHom.map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hfa
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
  have ha_pow : a ^ p = ι y := by 

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
hfa : (aeval a) f = 0
⊢ a ^ p = ι y

Next tactic:
rwa [AlgHom.map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hfa
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
  have ha_pow : a ^ p = ι y := by rwa [AlgHom.map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hfa
  

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
hfa : (aeval a) f = 0
ha_pow : a ^ p = ι y
⊢ ∃ a, (frobenius K p) a = y

Next tactic:
let g : K[X] := minpoly K a
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
  have ha_pow : a ^ p = ι y := by rwa [AlgHom.map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hfa
  let g : K[X] := minpoly K a
  

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
hfa : (aeval a) f = 0
ha_pow : a ^ p = ι y
g : K[X] := minpoly K a
⊢ ∃ a, (frobenius K p) a = y

Next tactic:
suffices : (g.map ι).natDegree = 1
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
  have ha_pow : a ^ p = ι y := by rwa [AlgHom.map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hfa
  let g : K[X] := minpoly K a
  suffices : (g.map ι).natDegree = 1
  · 

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
hfa : (aeval a) f = 0
ha_pow : a ^ p = ι y
g : K[X] := minpoly K a
this : natDegree (map ι g) = 1
⊢ ∃ a, (frobenius K p) a = y

Next tactic:
rw [g.natDegree_map, ← degree_eq_iff_natDegree_eq_of_pos Nat.one_pos] at this
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
  have ha_pow : a ^ p = ι y := by rwa [AlgHom.map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hfa
  let g : K[X] := minpoly K a
  suffices : (g.map ι).natDegree = 1
  · rw [g.natDegree_map, ← degree_eq_iff_natDegree_eq_of_pos Nat.one_pos] at this
    

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
hfa : (aeval a) f = 0
ha_pow : a ^ p = ι y
g : K[X] := minpoly K a
this : degree g = ↑1
⊢ ∃ a, (frobenius K p) a = y

Next tactic:
obtain ⟨a' : K, ha' : ι a' = a⟩ := minpoly.mem_range_of_degree_eq_one K a this
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
  have ha_pow : a ^ p = ι y := by rwa [AlgHom.map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hfa
  let g : K[X] := minpoly K a
  suffices : (g.map ι).natDegree = 1
  · rw [g.natDegree_map, ← degree_eq_iff_natDegree_eq_of_pos Nat.one_pos] at this
    obtain ⟨a' : K, ha' : ι a' = a⟩ := minpoly.mem_range_of_degree_eq_one K a this
    

Proof state:
case intro
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
hfa : (aeval a) f = 0
ha_pow : a ^ p = ι y
g : K[X] := minpoly K a
this : degree g = ↑1
a' : K
ha' : ι a' = a
⊢ ∃ a, (frobenius K p) a = y

Next tactic:
refine' ⟨a', NoZeroSMulDivisors.algebraMap_injective K L _⟩
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
  have ha_pow : a ^ p = ι y := by rwa [AlgHom.map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hfa
  let g : K[X] := minpoly K a
  suffices : (g.map ι).natDegree = 1
  · rw [g.natDegree_map, ← degree_eq_iff_natDegree_eq_of_pos Nat.one_pos] at this
    obtain ⟨a' : K, ha' : ι a' = a⟩ := minpoly.mem_range_of_degree_eq_one K a this
    refine' ⟨a', NoZeroSMulDivisors.algebraMap_injective K L _⟩
    

Proof state:
case intro
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
hfa : (aeval a) f = 0
ha_pow : a ^ p = ι y
g : K[X] := minpoly K a
this : degree g = ↑1
a' : K
ha' : ι a' = a
⊢ (algebraMap K L) ((frobenius K p) a') = (algebraMap K L) y

Next tactic:
rw [RingHom.map_frobenius, ha', frobenius_def, ha_pow]
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
  have ha_pow : a ^ p = ι y := by rwa [AlgHom.map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hfa
  let g : K[X] := minpoly K a
  suffices : (g.map ι).natDegree = 1
  · rw [g.natDegree_map, ← degree_eq_iff_natDegree_eq_of_pos Nat.one_pos] at this
    obtain ⟨a' : K, ha' : ι a' = a⟩ := minpoly.mem_range_of_degree_eq_one K a this
    refine' ⟨a', NoZeroSMulDivisors.algebraMap_injective K L _⟩
    rw [RingHom.map_frobenius, ha', frobenius_def, ha_pow]
  

Proof state:
case this
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
hfa : (aeval a) f = 0
ha_pow : a ^ p = ι y
g : K[X] := minpoly K a
⊢ natDegree (map ι g) = 1

Next tactic:
have hg_dvd : g.map ι ∣ (X - C a) ^ p := by
    convert Polynomial.map_dvd ι (minpoly.dvd K a hfa)
    rw [sub_pow_char, Polynomial.map_sub, Polynomial.map_pow, map_X, map_C, ← ha_pow, map_pow]
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
  have ha_pow : a ^ p = ι y := by rwa [AlgHom.map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hfa
  let g : K[X] := minpoly K a
  suffices : (g.map ι).natDegree = 1
  · rw [g.natDegree_map, ← degree_eq_iff_natDegree_eq_of_pos Nat.one_pos] at this
    obtain ⟨a' : K, ha' : ι a' = a⟩ := minpoly.mem_range_of_degree_eq_one K a this
    refine' ⟨a', NoZeroSMulDivisors.algebraMap_injective K L _⟩
    rw [RingHom.map_frobenius, ha', frobenius_def, ha_pow]
  have hg_dvd : g.map ι ∣ (X - C a) ^ p := by
    

Proof state:
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
hfa : (aeval a) f = 0
ha_pow : a ^ p = ι y
g : K[X] := minpoly K a
⊢ map ι g ∣ (X - C a) ^ p

Next tactic:
convert Polynomial.map_dvd ι (minpoly.dvd K a hfa)
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
  have ha_pow : a ^ p = ι y := by rwa [AlgHom.map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hfa
  let g : K[X] := minpoly K a
  suffices : (g.map ι).natDegree = 1
  · rw [g.natDegree_map, ← degree_eq_iff_natDegree_eq_of_pos Nat.one_pos] at this
    obtain ⟨a' : K, ha' : ι a' = a⟩ := minpoly.mem_range_of_degree_eq_one K a this
    refine' ⟨a', NoZeroSMulDivisors.algebraMap_injective K L _⟩
    rw [RingHom.map_frobenius, ha', frobenius_def, ha_pow]
  have hg_dvd : g.map ι ∣ (X - C a) ^ p := by
    convert Polynomial.map_dvd ι (minpoly.dvd K a hfa)
    

Proof state:
case h.e'_4
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
hfa : (aeval a) f = 0
ha_pow : a ^ p = ι y
g : K[X] := minpoly K a
⊢ (X - C a) ^ p = map ι f

Next tactic:
rw [sub_pow_char, Polynomial.map_sub, Polynomial.map_pow, map_X, map_C, ← ha_pow, map_pow]
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
  have ha_pow : a ^ p = ι y := by rwa [AlgHom.map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hfa
  let g : K[X] := minpoly K a
  suffices : (g.map ι).natDegree = 1
  · rw [g.natDegree_map, ← degree_eq_iff_natDegree_eq_of_pos Nat.one_pos] at this
    obtain ⟨a' : K, ha' : ι a' = a⟩ := minpoly.mem_range_of_degree_eq_one K a this
    refine' ⟨a', NoZeroSMulDivisors.algebraMap_injective K L _⟩
    rw [RingHom.map_frobenius, ha', frobenius_def, ha_pow]
  have hg_dvd : g.map ι ∣ (X - C a) ^ p := by
    convert Polynomial.map_dvd ι (minpoly.dvd K a hfa)
    rw [sub_pow_char, Polynomial.map_sub, Polynomial.map_pow, map_X, map_C, ← ha_pow, map_pow]
  

Proof state:
case this
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
hfa : (aeval a) f = 0
ha_pow : a ^ p = ι y
g : K[X] := minpoly K a
hg_dvd : map ι g ∣ (X - C a) ^ p
⊢ natDegree (map ι g) = 1

Next tactic:
have ha : IsIntegral K a := .of_finite K a
/-- A perfect field of characteristic `p` (prime) is a perfect ring. -/
instance toPerfectRing (p : ℕ) [hp : Fact p.Prime] [CharP K p] : PerfectRing K p := by
  refine' PerfectRing.ofSurjective _ _ $ fun y ↦ _
  let f : K[X] := X ^ p - C y
  let L := f.SplittingField
  let ι := algebraMap K L
  have hf_deg : f.degree ≠ 0 := by
    rw [degree_X_pow_sub_C hp.out.pos y, p.cast_ne_zero]; exact hp.out.ne_zero
  let a : L := f.rootOfSplits ι (SplittingField.splits f) hf_deg
  have hfa : aeval a f = 0 := by rw [aeval_def, map_rootOfSplits _ (SplittingField.splits f) hf_deg]
  have ha_pow : a ^ p = ι y := by rwa [AlgHom.map_sub, aeval_X_pow, aeval_C, sub_eq_zero] at hfa
  let g : K[X] := minpoly K a
  suffices : (g.map ι).natDegree = 1
  · rw [g.natDegree_map, ← degree_eq_iff_natDegree_eq_of_pos Nat.one_pos] at this
    obtain ⟨a' : K, ha' : ι a' = a⟩ := minpoly.mem_range_of_degree_eq_one K a this
    refine' ⟨a', NoZeroSMulDivisors.algebraMap_injective K L _⟩
    rw [RingHom.map_frobenius, ha', frobenius_def, ha_pow]
  have hg_dvd : g.map ι ∣ (X - C a) ^ p := by
    convert Polynomial.map_dvd ι (minpoly.dvd K a hfa)
    rw [sub_pow_char, Polynomial.map_sub, Polynomial.map_pow, map_X, map_C, ← ha_pow, map_pow]
  have ha : IsIntegral K a := .of_finite K a
  

Proof state:
case this
K : Type u_1
inst✝² : Field K
inst✝¹ : PerfectField K
p : ℕ
hp : Fact (Nat.Prime p)
inst✝ : CharP K p
y : K
f : K[X] := X ^ p - C y
L : Type u_1 := SplittingField f
ι : K →+* L := algebraMap K L
hf_deg : degree f ≠ 0
a : L := rootOfSplits ι (_ : Splits (algebraMap K (SplittingField f)) f) hf_deg
hfa : (aeval a) f = 0
ha_pow : a ^ p = ι y
g : K[X] := minpoly K a
hg_dvd : map ι g ∣ (X - C a) ^ p
ha : IsIntegral K a
⊢ natDegree (map ι g) = 1

Next tactic:
have hg_pow : g.map ι = (X - C a) ^ (g.map ι).natDegree := by
    obtain ⟨q, -, hq⟩ := (dvd_prime_pow (prime_X_sub_C a) p).mp hg_dvd
    rw [eq_of_monic_of_associated ((minpoly.monic ha).map ι) ((monic_X_sub_C a).pow q) hq,
      natDegree_pow, natDegree_X_sub_C, mul_one]