Theorem: GaloisField.finrank
File: Mathlib/FieldTheory/Finite/GaloisField.lean

tactic: set g_poly := (X ^ p ^ n - X : (ZMod p)[X])
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n

tactic: have hp : 1 < p := h_prime.out.one_lt
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n

tactic: have aux : g_poly ≠ 0 := FiniteField.X_pow_card_pow_sub_X_ne_zero _ h hp
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n

tactic: have key : Fintype.card (g_poly.rootSet (GaloisField p n)) = g_poly.natDegree :=
  card_rootSet_eq_natDegree (galois_poly_separable p _ (dvd_pow (dvd_refl p) h))
    (SplittingField.splits (X ^ p ^ n - X : (ZMod p)[X]))
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = g_poly.natDegree
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n

tactic: have nat_degree_eq : g_poly.natDegree = p ^ n :=
  FiniteField.X_pow_card_pow_sub_X_natDegree_eq _ h hp
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = g_poly.natDegree
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = g_poly.natDegree
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n

tactic: rw [nat_degree_eq] at key
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = g_poly.natDegree
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n

tactic: suffices g_poly.rootSet (GaloisField p n) = Set.univ by
  simp_rw [this, ← Fintype.ofEquiv_card (Equiv.Set.univ _)] at key
  rw [@card_eq_pow_finrank (ZMod p) _ _ _ _ _ (_), ZMod.card] at key
  exact Nat.pow_right_injective (Nat.Prime.one_lt' p).out key
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ g_poly.rootSet (GaloisField p n) = Set.univ

tactic: rw [Set.eq_univ_iff_forall]
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ g_poly.rootSet (GaloisField p n) = Set.univ
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ ∀ (x : GaloisField p n), x ∈ g_poly.rootSet (GaloisField p n)

tactic: suffices ∀ (x) (hx : x ∈ (⊤ : Subalgebra (ZMod p) (GaloisField p n))),
    x ∈ (X ^ p ^ n - X : (ZMod p)[X]).rootSet (GaloisField p n)
  by simpa
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ ∀ (x : GaloisField p n), x ∈ g_poly.rootSet (GaloisField p n)
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ ∀ x ∈ ⊤, x ∈ (X ^ p ^ n - X).rootSet (GaloisField p n)

tactic: rw [← SplittingField.adjoin_rootSet]
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ ∀ x ∈ ⊤, x ∈ (X ^ p ^ n - X).rootSet (GaloisField p n)
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ ∀ x ∈ Algebra.adjoin (ZMod p) ((X ^ p ^ n - X).rootSet (X ^ p ^ n - X).SplittingField),
    x ∈ (X ^ p ^ n - X).rootSet (GaloisField p n)

tactic: simp_rw [Algebra.mem_adjoin_iff]
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ ∀ x ∈ Algebra.adjoin (ZMod p) ((X ^ p ^ n - X).rootSet (X ^ p ^ n - X).SplittingField),
    x ∈ (X ^ p ^ n - X).rootSet (GaloisField p n)
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ ∀
    x ∈
      Subring.closure
        (Set.range ⇑(algebraMap (ZMod p) (GaloisField p n)) ∪ (X ^ p ^ n - X).rootSet (X ^ p ^ n - X).SplittingField),
    x ∈ (X ^ p ^ n - X).rootSet (GaloisField p n)

tactic: intro x hx
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
⊢ ∀
    x ∈
      Subring.closure
        (Set.range ⇑(algebraMap (ZMod p) (GaloisField p n)) ∪ (X ^ p ^ n - X).rootSet (X ^ p ^ n - X).SplittingField),
    x ∈ (X ^ p ^ n - X).rootSet (GaloisField p n)
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
x : GaloisField p n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod p) (GaloisField p n)) ∪ (X ^ p ^ n - X).rootSet (X ^ p ^ n - X).SplittingField)
⊢ x ∈ (X ^ p ^ n - X).rootSet (GaloisField p n)

tactic: cases p
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
x : GaloisField p n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod p) (GaloisField p n)) ∪ (X ^ p ^ n - X).rootSet (X ^ p ^ n - X).SplittingField)
⊢ x ∈ (X ^ p ^ n - X).rootSet (GaloisField p n)
state_after: case zero
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝¹ n✝ n : ℕ
h : n ≠ 0
h_prime : Fact (Nat.Prime 0)
g_poly : (ZMod 0)[X] := X ^ 0 ^ n - X
hp : 1 < 0
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField 0 n)) = 0 ^ n
nat_degree_eq : g_poly.natDegree = 0 ^ n
x : GaloisField 0 n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod 0) (GaloisField 0 n)) ∪ (X ^ 0 ^ n - X).rootSet (X ^ 0 ^ n - X).SplittingField)
⊢ x ∈ (X ^ 0 ^ n - X).rootSet (GaloisField 0 n)

case succ
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ x ∈ (X ^ (n✝ + 1) ^ n - X).rootSet (GaloisField (n✝ + 1) n)

tactic: cases hp
state_before: case zero
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝¹ n✝ n : ℕ
h : n ≠ 0
h_prime : Fact (Nat.Prime 0)
g_poly : (ZMod 0)[X] := X ^ 0 ^ n - X
hp : 1 < 0
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField 0 n)) = 0 ^ n
nat_degree_eq : g_poly.natDegree = 0 ^ n
x : GaloisField 0 n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod 0) (GaloisField 0 n)) ∪ (X ^ 0 ^ n - X).rootSet (X ^ 0 ^ n - X).SplittingField)
⊢ x ∈ (X ^ 0 ^ n - X).rootSet (GaloisField 0 n)

case succ
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ x ∈ (X ^ (n✝ + 1) ^ n - X).rootSet (GaloisField (n✝ + 1) n)
state_after: case succ
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ x ∈ (X ^ (n✝ + 1) ^ n - X).rootSet (GaloisField (n✝ + 1) n)

tactic: refine Subring.closure_induction hx ?_ ?_ ?_ ?_ ?_ ?_ <;> simp_rw [mem_rootSet_of_ne aux]
state_before: case succ
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ x ∈ (X ^ (n✝ + 1) ^ n - X).rootSet (GaloisField (n✝ + 1) n)
state_after: case succ.refine_1
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ ∀
    x ∈
      Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField,
    (aeval x) g_poly = 0

case succ.refine_2
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ (aeval 0) g_poly = 0

case succ.refine_3
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ (aeval 1) g_poly = 0

case succ.refine_4
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ ∀ (x y : GaloisField (n✝ + 1) n), (aeval x) g_poly = 0 → (aeval y) g_poly = 0 → (aeval (x + y)) g_poly = 0

case succ.refine_5
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ ∀ (x : GaloisField (n✝ + 1) n), (aeval x) g_poly = 0 → (aeval (-x)) g_poly = 0

case succ.refine_6
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ ∀ (x y : GaloisField (n✝ + 1) n), (aeval x) g_poly = 0 → (aeval y) g_poly = 0 → (aeval (x * y)) g_poly = 0

tactic: simp_rw [this, ← Fintype.ofEquiv_card (Equiv.Set.univ _)] at key
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
this : g_poly.rootSet (GaloisField p n) = Set.univ
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
nat_degree_eq : g_poly.natDegree = p ^ n
this : g_poly.rootSet (GaloisField p n) = Set.univ
key : Fintype.card (GaloisField p n) = p ^ n
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n

tactic: rw [@card_eq_pow_finrank (ZMod p) _ _ _ _ _ (_), ZMod.card] at key
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
nat_degree_eq : g_poly.natDegree = p ^ n
this : g_poly.rootSet (GaloisField p n) = Set.univ
key : Fintype.card (GaloisField p n) = p ^ n
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n
state_after: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
nat_degree_eq : g_poly.natDegree = p ^ n
this : g_poly.rootSet (GaloisField p n) = Set.univ
key : p ^ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = p ^ n
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n

tactic: exact Nat.pow_right_injective (Nat.Prime.one_lt' p).out key
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
nat_degree_eq : g_poly.natDegree = p ^ n
this : g_poly.rootSet (GaloisField p n) = Set.univ
key : p ^ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = p ^ n
⊢ FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n
state_after: no goals

tactic: simpa
state_before: p✝ : ℕ
inst✝ : Fact (Nat.Prime p✝)
n✝¹ p : ℕ
h_prime : Fact (Nat.Prime p)
n✝ n : ℕ
h : n ≠ 0
g_poly : (ZMod p)[X] := X ^ p ^ n - X
hp : 1 < p
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField p n)) = p ^ n
nat_degree_eq : g_poly.natDegree = p ^ n
this : ∀ x ∈ ⊤, x ∈ (X ^ p ^ n - X).rootSet (GaloisField p n)
⊢ ∀ (x : GaloisField p n), x ∈ g_poly.rootSet (GaloisField p n)
state_after: no goals

tactic: rintro x (⟨r, rfl⟩ | hx)
state_before: case succ.refine_1
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ ∀
    x ∈
      Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField,
    (aeval x) g_poly = 0
state_after: case succ.refine_1.inl.intro
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
r : ZMod (n✝ + 1)
⊢ (aeval ((algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) r)) g_poly = 0

case succ.refine_1.inr
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x✝ : GaloisField (n✝ + 1) n
hx✝ :
  x✝ ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
x : GaloisField (n✝ + 1) n
hx : x ∈ (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField
⊢ (aeval x) g_poly = 0

tactic: simp only [g_poly, map_sub, map_pow, aeval_X]
state_before: case succ.refine_1.inl.intro
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
r : ZMod (n✝ + 1)
⊢ (aeval ((algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) r)) g_poly = 0
state_after: case succ.refine_1.inl.intro
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
r : ZMod (n✝ + 1)
⊢ (algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) r ^ (n✝ + 1) ^ n -
      (algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) r =
    0

tactic: rw [← map_pow, ZMod.pow_card_pow, sub_self]
state_before: case succ.refine_1.inl.intro
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
r : ZMod (n✝ + 1)
⊢ (algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) r ^ (n✝ + 1) ^ n -
      (algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) r =
    0
state_after: no goals

tactic: rwa [mem_rootSet_of_ne aux] at hx
state_before: case succ.refine_1.inr
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x✝ : GaloisField (n✝ + 1) n
hx✝ :
  x✝ ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
x : GaloisField (n✝ + 1) n
hx : x ∈ (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField
⊢ (aeval x) g_poly = 0
state_after: no goals

tactic: rw [← coeff_zero_eq_aeval_zero']
state_before: case succ.refine_2
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ (aeval 0) g_poly = 0
state_after: case succ.refine_2
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ (algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) (g_poly.coeff 0) = 0

tactic: simp only [g_poly, coeff_X_pow, coeff_X_zero, sub_zero, _root_.map_eq_zero, ite_eq_right_iff,
  one_ne_zero, coeff_sub]
state_before: case succ.refine_2
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ (algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) (g_poly.coeff 0) = 0
state_after: case succ.refine_2
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ 0 = (n✝ + 1) ^ n → False

tactic: intro hn
state_before: case succ.refine_2
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ 0 = (n✝ + 1) ^ n → False
state_after: case succ.refine_2
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
hn : 0 = (n✝ + 1) ^ n
⊢ False

tactic: exact Nat.not_lt_zero 1 (pow_eq_zero hn.symm ▸ hp)
state_before: case succ.refine_2
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
hn : 0 = (n✝ + 1) ^ n
⊢ False
state_after: no goals

tactic: simp [g_poly]
state_before: case succ.refine_3
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ (aeval 1) g_poly = 0
state_after: no goals

tactic: simp only [g_poly, aeval_X_pow, aeval_X, AlgHom.map_sub, add_pow_char_pow, sub_eq_zero]
state_before: case succ.refine_4
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ ∀ (x y : GaloisField (n✝ + 1) n), (aeval x) g_poly = 0 → (aeval y) g_poly = 0 → (aeval (x + y)) g_poly = 0
state_after: case succ.refine_4
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ ∀ (x y : GaloisField (n✝ + 1) n),
    x ^ (n✝ + 1) ^ n = x → y ^ (n✝ + 1) ^ n = y → x ^ (n✝ + 1) ^ n + y ^ (n✝ + 1) ^ n = x + y

tactic: intro x y hx hy
state_before: case succ.refine_4
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ ∀ (x y : GaloisField (n✝ + 1) n),
    x ^ (n✝ + 1) ^ n = x → y ^ (n✝ + 1) ^ n = y → x ^ (n✝ + 1) ^ n + y ^ (n✝ + 1) ^ n = x + y
state_after: case succ.refine_4
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x✝ : GaloisField (n✝ + 1) n
hx✝ :
  x✝ ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
x y : GaloisField (n✝ + 1) n
hx : x ^ (n✝ + 1) ^ n = x
hy : y ^ (n✝ + 1) ^ n = y
⊢ x ^ (n✝ + 1) ^ n + y ^ (n✝ + 1) ^ n = x + y

tactic: rw [hx, hy]
state_before: case succ.refine_4
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x✝ : GaloisField (n✝ + 1) n
hx✝ :
  x✝ ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
x y : GaloisField (n✝ + 1) n
hx : x ^ (n✝ + 1) ^ n = x
hy : y ^ (n✝ + 1) ^ n = y
⊢ x ^ (n✝ + 1) ^ n + y ^ (n✝ + 1) ^ n = x + y
state_after: no goals

tactic: intro x hx
state_before: case succ.refine_5
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ ∀ (x : GaloisField (n✝ + 1) n), (aeval x) g_poly = 0 → (aeval (-x)) g_poly = 0
state_after: case succ.refine_5
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x✝ : GaloisField (n✝ + 1) n
hx✝ :
  x✝ ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
x : GaloisField (n✝ + 1) n
hx : (aeval x) g_poly = 0
⊢ (aeval (-x)) g_poly = 0

tactic: simp only [g_poly, sub_eq_zero, aeval_X_pow, aeval_X, AlgHom.map_sub, sub_neg_eq_add] at *
state_before: case succ.refine_5
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x✝ : GaloisField (n✝ + 1) n
hx✝ :
  x✝ ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
x : GaloisField (n✝ + 1) n
hx : (aeval x) g_poly = 0
⊢ (aeval (-x)) g_poly = 0
state_after: case succ.refine_5
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : X ^ (n✝ + 1) ^ n - X ≠ 0
key : Fintype.card ↑((X ^ (n✝ + 1) ^ n - X).rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : (X ^ (n✝ + 1) ^ n - X).natDegree = (n✝ + 1) ^ n
x✝ : GaloisField (n✝ + 1) n
hx✝ :
  x✝ ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
x : GaloisField (n✝ + 1) n
hx : x ^ (n✝ + 1) ^ n = x
⊢ (-x) ^ (n✝ + 1) ^ n + x = 0

tactic: rw [neg_pow, hx, CharP.neg_one_pow_char_pow]
state_before: case succ.refine_5
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : X ^ (n✝ + 1) ^ n - X ≠ 0
key : Fintype.card ↑((X ^ (n✝ + 1) ^ n - X).rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : (X ^ (n✝ + 1) ^ n - X).natDegree = (n✝ + 1) ^ n
x✝ : GaloisField (n✝ + 1) n
hx✝ :
  x✝ ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
x : GaloisField (n✝ + 1) n
hx : x ^ (n✝ + 1) ^ n = x
⊢ (-x) ^ (n✝ + 1) ^ n + x = 0
state_after: case succ.refine_5
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : X ^ (n✝ + 1) ^ n - X ≠ 0
key : Fintype.card ↑((X ^ (n✝ + 1) ^ n - X).rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : (X ^ (n✝ + 1) ^ n - X).natDegree = (n✝ + 1) ^ n
x✝ : GaloisField (n✝ + 1) n
hx✝ :
  x✝ ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
x : GaloisField (n✝ + 1) n
hx : x ^ (n✝ + 1) ^ n = x
⊢ -1 * x + x = 0

tactic: simp
state_before: case succ.refine_5
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : X ^ (n✝ + 1) ^ n - X ≠ 0
key : Fintype.card ↑((X ^ (n✝ + 1) ^ n - X).rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : (X ^ (n✝ + 1) ^ n - X).natDegree = (n✝ + 1) ^ n
x✝ : GaloisField (n✝ + 1) n
hx✝ :
  x✝ ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
x : GaloisField (n✝ + 1) n
hx : x ^ (n✝ + 1) ^ n = x
⊢ -1 * x + x = 0
state_after: no goals

tactic: simp only [g_poly, aeval_X_pow, aeval_X, AlgHom.map_sub, mul_pow, sub_eq_zero]
state_before: case succ.refine_6
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ ∀ (x y : GaloisField (n✝ + 1) n), (aeval x) g_poly = 0 → (aeval y) g_poly = 0 → (aeval (x * y)) g_poly = 0
state_after: case succ.refine_6
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ ∀ (x y : GaloisField (n✝ + 1) n),
    x ^ (n✝ + 1) ^ n = x → y ^ (n✝ + 1) ^ n = y → x ^ (n✝ + 1) ^ n * y ^ (n✝ + 1) ^ n = x * y

tactic: intro x y hx hy
state_before: case succ.refine_6
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x : GaloisField (n✝ + 1) n
hx :
  x ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
⊢ ∀ (x y : GaloisField (n✝ + 1) n),
    x ^ (n✝ + 1) ^ n = x → y ^ (n✝ + 1) ^ n = y → x ^ (n✝ + 1) ^ n * y ^ (n✝ + 1) ^ n = x * y
state_after: case succ.refine_6
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x✝ : GaloisField (n✝ + 1) n
hx✝ :
  x✝ ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
x y : GaloisField (n✝ + 1) n
hx : x ^ (n✝ + 1) ^ n = x
hy : y ^ (n✝ + 1) ^ n = y
⊢ x ^ (n✝ + 1) ^ n * y ^ (n✝ + 1) ^ n = x * y

tactic: rw [hx, hy]
state_before: case succ.refine_6
p : ℕ
inst✝ : Fact (Nat.Prime p)
n✝² n✝¹ n : ℕ
h : n ≠ 0
n✝ : ℕ
h_prime : Fact (Nat.Prime (n✝ + 1))
g_poly : (ZMod (n✝ + 1))[X] := X ^ (n✝ + 1) ^ n - X
hp : 1 < n✝ + 1
aux : g_poly ≠ 0
key : Fintype.card ↑(g_poly.rootSet (GaloisField (n✝ + 1) n)) = (n✝ + 1) ^ n
nat_degree_eq : g_poly.natDegree = (n✝ + 1) ^ n
x✝ : GaloisField (n✝ + 1) n
hx✝ :
  x✝ ∈
    Subring.closure
      (Set.range ⇑(algebraMap (ZMod (n✝ + 1)) (GaloisField (n✝ + 1) n)) ∪
        (X ^ (n✝ + 1) ^ n - X).rootSet (X ^ (n✝ + 1) ^ n - X).SplittingField)
x y : GaloisField (n✝ + 1) n
hx : x ^ (n✝ + 1) ^ n = x
hy : y ^ (n✝ + 1) ^ n = y
⊢ x ^ (n✝ + 1) ^ n * y ^ (n✝ + 1) ^ n = x * y
state_after: no goals