field_theory.finite.galois_fieldMathlib.FieldTheory.Finite.GaloisField

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson, Alex J. Best, Johan Commelin, Eric Rodriguez, Ruben Van de Velde
 -/
 import Algebra.CharP.Algebra
-import Data.Zmod.Algebra
+import Data.ZMod.Algebra
 import FieldTheory.Finite.Basic
 import FieldTheory.Galois
 import FieldTheory.SplittingField.IsSplittingField
Diff
@@ -62,7 +62,7 @@ instance FiniteField.isSplittingField_sub (K F : Type _) [Field K] [Fintype K] [
 theorem galois_poly_separable {K : Type _} [Field K] (p q : ℕ) [CharP K p] (h : p ∣ q) :
     Separable (X ^ q - X : K[X]) := by
   use 1, X ^ q - X - 1
-  rw [← CharP.cast_eq_zero_iff K[X] p] at h 
+  rw [← CharP.cast_eq_zero_iff K[X] p] at h
   rw [derivative_sub, derivative_X_pow, derivative_X, C_eq_nat_cast, h]
   ring
 #align galois_poly_separable galois_poly_separable
@@ -110,11 +110,11 @@ theorem finrank {n} (h : n ≠ 0) : FiniteDimensional.finrank (ZMod p) (GaloisFi
       (splitting_field.splits g_poly)
   have nat_degree_eq : g_poly.natDegree = p ^ n :=
     FiniteField.X_pow_card_pow_sub_X_natDegree_eq _ h hp
-  rw [nat_degree_eq] at key 
+  rw [nat_degree_eq] at key
   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 
+    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
   rw [Set.eq_univ_iff_forall]
   suffices
@@ -131,8 +131,8 @@ theorem finrank {n} (h : n ≠ 0) : FiniteDimensional.finrank (ZMod p) (GaloisFi
   · rintro x (⟨r, rfl⟩ | hx)
     · simp only [aeval_X_pow, aeval_X, AlgHom.map_sub]
       rw [← map_pow, ZMod.pow_card_pow, sub_self]
-    · dsimp only [GaloisField] at hx 
-      rwa [mem_root_set_of_ne aux] at hx ; infer_instance
+    · dsimp only [GaloisField] at hx
+      rwa [mem_root_set_of_ne aux] at hx; infer_instance
   · dsimp only [g_poly]
     rw [← coeff_zero_eq_aeval_zero']
     simp only [coeff_X_pow, coeff_X_zero, sub_zero, _root_.map_eq_zero, ite_eq_right_iff,
@@ -237,7 +237,7 @@ def algEquivOfCardEq (p : ℕ) [Fact p.Prime] [Algebra (ZMod p) K] [Algebra (ZMo
   have : CharP K' p := by rw [← Algebra.charP_iff (ZMod p) K' p]; exact ZMod.charP p
   choose n a hK using FiniteField.card K p
   choose n' a' hK' using FiniteField.card K' p
-  rw [hK, hK'] at hKK' 
+  rw [hK, hK'] at hKK'
   have hGalK := GaloisField.algEquivGaloisField p n hK
   have hK'Gal := (GaloisField.algEquivGaloisField p n' hK').symm
   rw [Nat.pow_right_injective (Fact.out (Nat.Prime p)).one_lt hKK'] at *
@@ -260,7 +260,7 @@ def ringEquivOfCardEq (hKK' : Fintype.card K = Fintype.card K') : K ≃+* K' :=
     -- := eq_prime_of_eq_prime_pow
     by_contra hne
     have h2 := Nat.coprime_pow_primes n n' hp hp' hne
-    rw [(Eq.congr hK hK').mp hKK', Nat.coprime_self, pow_eq_one_iff (PNat.ne_zero n')] at h2 
+    rw [(Eq.congr hK hK').mp hKK', Nat.coprime_self, pow_eq_one_iff (PNat.ne_zero n')] at h2
     exact Nat.Prime.ne_one hp' h2
     all_goals infer_instance
   rw [← hpp'] at *
Diff
@@ -50,7 +50,11 @@ instance FiniteField.isSplittingField_sub (K F : Type _) [Field K] [Fintype K] [
       FiniteField.X_pow_card_sub_X_natDegree_eq K Fintype.one_lt_card
     rw [← splits_id_iff_splits, splits_iff_card_roots, Polynomial.map_sub, Polynomial.map_pow,
       map_X, h, FiniteField.roots_X_pow_card_sub_X K, ← Finset.card_def, Finset.card_univ]
-  adjoin_rootSet := by classical
+  adjoin_rootSet := by
+    classical
+    trans Algebra.adjoin F ((roots (X ^ Fintype.card K - X : K[X])).toFinset : Set K)
+    · simp only [root_set, Polynomial.map_pow, map_X, Polynomial.map_sub]
+    · rw [FiniteField.roots_X_pow_card_sub_X, val_to_finset, coe_univ, Algebra.adjoin_univ]
 #align finite_field.has_sub.sub.polynomial.is_splitting_field FiniteField.isSplittingField_sub
 -/
 
Diff
@@ -50,11 +50,7 @@ instance FiniteField.isSplittingField_sub (K F : Type _) [Field K] [Fintype K] [
       FiniteField.X_pow_card_sub_X_natDegree_eq K Fintype.one_lt_card
     rw [← splits_id_iff_splits, splits_iff_card_roots, Polynomial.map_sub, Polynomial.map_pow,
       map_X, h, FiniteField.roots_X_pow_card_sub_X K, ← Finset.card_def, Finset.card_univ]
-  adjoin_rootSet := by
-    classical
-    trans Algebra.adjoin F ((roots (X ^ Fintype.card K - X : K[X])).toFinset : Set K)
-    · simp only [root_set, Polynomial.map_pow, map_X, Polynomial.map_sub]
-    · rw [FiniteField.roots_X_pow_card_sub_X, val_to_finset, coe_univ, Algebra.adjoin_univ]
+  adjoin_rootSet := by classical
 #align finite_field.has_sub.sub.polynomial.is_splitting_field FiniteField.isSplittingField_sub
 -/
 
Diff
@@ -3,11 +3,11 @@ Copyright (c) 2021 Johan Commelin. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson, Alex J. Best, Johan Commelin, Eric Rodriguez, Ruben Van de Velde
 -/
-import Mathbin.Algebra.CharP.Algebra
-import Mathbin.Data.Zmod.Algebra
-import Mathbin.FieldTheory.Finite.Basic
-import Mathbin.FieldTheory.Galois
-import Mathbin.FieldTheory.SplittingField.IsSplittingField
+import Algebra.CharP.Algebra
+import Data.Zmod.Algebra
+import FieldTheory.Finite.Basic
+import FieldTheory.Galois
+import FieldTheory.SplittingField.IsSplittingField
 
 #align_import field_theory.finite.galois_field from "leanprover-community/mathlib"@"1b089e3bdc3ce6b39cd472543474a0a137128c6c"
 
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2021 Johan Commelin. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson, Alex J. Best, Johan Commelin, Eric Rodriguez, Ruben Van de Velde
-
-! This file was ported from Lean 3 source module field_theory.finite.galois_field
-! leanprover-community/mathlib commit 1b089e3bdc3ce6b39cd472543474a0a137128c6c
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.CharP.Algebra
 import Mathbin.Data.Zmod.Algebra
@@ -14,6 +9,8 @@ import Mathbin.FieldTheory.Finite.Basic
 import Mathbin.FieldTheory.Galois
 import Mathbin.FieldTheory.SplittingField.IsSplittingField
 
+#align_import field_theory.finite.galois_field from "leanprover-community/mathlib"@"1b089e3bdc3ce6b39cd472543474a0a137128c6c"
+
 /-!
 # Galois fields
 
Diff
@@ -43,9 +43,9 @@ open Polynomial Finset
 
 open scoped Polynomial
 
-#print FiniteField.HasSub.Sub.Polynomial.isSplittingField /-
-instance FiniteField.HasSub.Sub.Polynomial.isSplittingField (K F : Type _) [Field K] [Fintype K]
-    [Field F] [Algebra F K] : IsSplittingField F K (X ^ Fintype.card K - X)
+#print FiniteField.isSplittingField_sub /-
+instance FiniteField.isSplittingField_sub (K F : Type _) [Field K] [Fintype K] [Field F]
+    [Algebra F K] : IsSplittingField F K (X ^ Fintype.card K - X)
     where
   Splits :=
     by
@@ -58,7 +58,7 @@ instance FiniteField.HasSub.Sub.Polynomial.isSplittingField (K F : Type _) [Fiel
     trans Algebra.adjoin F ((roots (X ^ Fintype.card K - X : K[X])).toFinset : Set K)
     · simp only [root_set, Polynomial.map_pow, map_X, Polynomial.map_sub]
     · rw [FiniteField.roots_X_pow_card_sub_X, val_to_finset, coe_univ, Algebra.adjoin_univ]
-#align finite_field.has_sub.sub.polynomial.is_splitting_field FiniteField.HasSub.Sub.Polynomial.isSplittingField
+#align finite_field.has_sub.sub.polynomial.is_splitting_field FiniteField.isSplittingField_sub
 -/
 
 #print galois_poly_separable /-
@@ -164,8 +164,8 @@ theorem card (h : n ≠ 0) : Fintype.card (GaloisField p n) = p ^ n :=
 #align galois_field.card GaloisField.card
 -/
 
-#print GaloisField.splits_zMod_x_pow_sub_x /-
-theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (X ^ p - X) :=
+#print GaloisField.splits_zmod_X_pow_sub_X /-
+theorem splits_zmod_X_pow_sub_X : Splits (RingHom.id (ZMod p)) (X ^ p - X) :=
   by
   have hp : 1 < p := (Fact.out (Nat.Prime p)).one_lt
   have h1 : roots (X ^ p - X : (ZMod p)[X]) = finset.univ.val :=
@@ -177,7 +177,7 @@ theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (X ^ p - X) :=
   cases p;
   cases hp
   rw [splits_iff_card_roots, h1, ← Finset.card_def, Finset.card_univ, h2, ZMod.card]
-#align galois_field.splits_zmod_X_pow_sub_X GaloisField.splits_zMod_x_pow_sub_x
+#align galois_field.splits_zmod_X_pow_sub_X GaloisField.splits_zmod_X_pow_sub_X
 -/
 
 #print GaloisField.equivZmodP /-
@@ -191,16 +191,16 @@ def equivZmodP : GaloisField p 1 ≃ₐ[ZMod p] ZMod p :=
 
 variable {K : Type _} [Field K] [Fintype K] [Algebra (ZMod p) K]
 
-#print GaloisField.splits_x_pow_card_sub_x /-
-theorem splits_x_pow_card_sub_x : Splits (algebraMap (ZMod p) K) (X ^ Fintype.card K - X) :=
-  (FiniteField.HasSub.Sub.Polynomial.isSplittingField K (ZMod p)).Splits
-#align galois_field.splits_X_pow_card_sub_X GaloisField.splits_x_pow_card_sub_x
+#print GaloisField.splits_X_pow_card_sub_X /-
+theorem splits_X_pow_card_sub_X : Splits (algebraMap (ZMod p) K) (X ^ Fintype.card K - X) :=
+  (FiniteField.isSplittingField_sub K (ZMod p)).Splits
+#align galois_field.splits_X_pow_card_sub_X GaloisField.splits_X_pow_card_sub_X
 -/
 
 #print GaloisField.isSplittingField_of_card_eq /-
 theorem isSplittingField_of_card_eq (h : Fintype.card K = p ^ n) :
     IsSplittingField (ZMod p) K (X ^ p ^ n - X) :=
-  h ▸ FiniteField.HasSub.Sub.Polynomial.isSplittingField K (ZMod p)
+  h ▸ FiniteField.isSplittingField_sub K (ZMod p)
 #align galois_field.is_splitting_field_of_card_eq GaloisField.isSplittingField_of_card_eq
 -/
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson, Alex J. Best, Johan Commelin, Eric Rodriguez, Ruben Van de Velde
 
 ! This file was ported from Lean 3 source module field_theory.finite.galois_field
-! leanprover-community/mathlib commit 0723536a0522d24fc2f159a096fb3304bef77472
+! leanprover-community/mathlib commit 1b089e3bdc3ce6b39cd472543474a0a137128c6c
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -17,6 +17,9 @@ import Mathbin.FieldTheory.SplittingField.IsSplittingField
 /-!
 # Galois fields
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 If `p` is a prime number, and `n` a natural number,
 then `galois_field p n` is defined as the splitting field of `X^(p^n) - X` over `zmod p`.
 It is a finite field with `p ^ n` elements.
Diff
@@ -40,6 +40,7 @@ open Polynomial Finset
 
 open scoped Polynomial
 
+#print FiniteField.HasSub.Sub.Polynomial.isSplittingField /-
 instance FiniteField.HasSub.Sub.Polynomial.isSplittingField (K F : Type _) [Field K] [Fintype K]
     [Field F] [Algebra F K] : IsSplittingField F K (X ^ Fintype.card K - X)
     where
@@ -55,7 +56,9 @@ instance FiniteField.HasSub.Sub.Polynomial.isSplittingField (K F : Type _) [Fiel
     · simp only [root_set, Polynomial.map_pow, map_X, Polynomial.map_sub]
     · rw [FiniteField.roots_X_pow_card_sub_X, val_to_finset, coe_univ, Algebra.adjoin_univ]
 #align finite_field.has_sub.sub.polynomial.is_splitting_field FiniteField.HasSub.Sub.Polynomial.isSplittingField
+-/
 
+#print galois_poly_separable /-
 theorem galois_poly_separable {K : Type _} [Field K] (p q : ℕ) [CharP K p] (h : p ∣ q) :
     Separable (X ^ q - X : K[X]) := by
   use 1, X ^ q - X - 1
@@ -63,7 +66,9 @@ theorem galois_poly_separable {K : Type _} [Field K] (p q : ℕ) [CharP K p] (h
   rw [derivative_sub, derivative_X_pow, derivative_X, C_eq_nat_cast, h]
   ring
 #align galois_poly_separable galois_poly_separable
+-/
 
+#print GaloisField /-
 /-- A finite field with `p ^ n` elements.
 Every field with the same cardinality is (non-canonically)
 isomorphic to this field. -/
@@ -71,6 +76,7 @@ def GaloisField (p : ℕ) [Fact p.Prime] (n : ℕ) :=
   SplittingField (X ^ p ^ n - X : (ZMod p)[X])
 deriving Field
 #align galois_field GaloisField
+-/
 
 instance : Inhabited (@GaloisField 2 (Fact.mk Nat.prime_two) 1) :=
   ⟨37⟩
@@ -93,6 +99,7 @@ instance : Fintype (GaloisField p n) :=
   dsimp only [GaloisField]
   exact FiniteDimensional.fintypeOfFintype (ZMod p) (GaloisField p n)
 
+#print GaloisField.finrank /-
 theorem finrank {n} (h : n ≠ 0) : FiniteDimensional.finrank (ZMod p) (GaloisField p n) = n :=
   by
   set g_poly := (X ^ p ^ n - X : (ZMod p)[X])
@@ -144,13 +151,17 @@ theorem finrank {n} (h : n ≠ 0) : FiniteDimensional.finrank (ZMod p) (GaloisFi
     intro x y hx hy
     rw [hx, hy]
 #align galois_field.finrank GaloisField.finrank
+-/
 
+#print GaloisField.card /-
 theorem card (h : n ≠ 0) : Fintype.card (GaloisField p n) = p ^ n :=
   by
   let b := IsNoetherian.finsetBasis (ZMod p) (GaloisField p n)
   rw [Module.card_fintype b, ← FiniteDimensional.finrank_eq_card_basis b, ZMod.card, finrank p h]
 #align galois_field.card GaloisField.card
+-/
 
+#print GaloisField.splits_zMod_x_pow_sub_x /-
 theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (X ^ p - X) :=
   by
   have hp : 1 < p := (Fact.out (Nat.Prime p)).one_lt
@@ -164,24 +175,31 @@ theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (X ^ p - X) :=
   cases hp
   rw [splits_iff_card_roots, h1, ← Finset.card_def, Finset.card_univ, h2, ZMod.card]
 #align galois_field.splits_zmod_X_pow_sub_X GaloisField.splits_zMod_x_pow_sub_x
+-/
 
+#print GaloisField.equivZmodP /-
 /-- A Galois field with exponent 1 is equivalent to `zmod` -/
 def equivZmodP : GaloisField p 1 ≃ₐ[ZMod p] ZMod p :=
   let h : (X ^ p ^ 1 : (ZMod p)[X]) = X ^ Fintype.card (ZMod p) := by rw [pow_one, ZMod.card p]
   let inst : IsSplittingField (ZMod p) (ZMod p) (X ^ p ^ 1 - X) := by rw [h]; infer_instance
   (@IsSplittingField.algEquiv _ (ZMod p) _ _ _ (X ^ p ^ 1 - X : (ZMod p)[X]) inst).symm
 #align galois_field.equiv_zmod_p GaloisField.equivZmodP
+-/
 
 variable {K : Type _} [Field K] [Fintype K] [Algebra (ZMod p) K]
 
+#print GaloisField.splits_x_pow_card_sub_x /-
 theorem splits_x_pow_card_sub_x : Splits (algebraMap (ZMod p) K) (X ^ Fintype.card K - X) :=
   (FiniteField.HasSub.Sub.Polynomial.isSplittingField K (ZMod p)).Splits
 #align galois_field.splits_X_pow_card_sub_X GaloisField.splits_x_pow_card_sub_x
+-/
 
+#print GaloisField.isSplittingField_of_card_eq /-
 theorem isSplittingField_of_card_eq (h : Fintype.card K = p ^ n) :
     IsSplittingField (ZMod p) K (X ^ p ^ n - X) :=
   h ▸ FiniteField.HasSub.Sub.Polynomial.isSplittingField K (ZMod p)
 #align galois_field.is_splitting_field_of_card_eq GaloisField.isSplittingField_of_card_eq
+-/
 
 instance (priority := 100) {K K' : Type _} [Field K] [Field K'] [Finite K'] [Algebra K K'] :
     IsGalois K K' := by
@@ -195,11 +213,13 @@ instance (priority := 100) {K K' : Type _} [Field K] [Field K'] [Finite K'] [Alg
         (let ⟨n, hp, hn⟩ := FiniteField.card K' p
         hn.symm ▸ dvd_pow_self p n.NeZero))
 
+#print GaloisField.algEquivGaloisField /-
 /-- Any finite field is (possibly non canonically) isomorphic to some Galois field. -/
 def algEquivGaloisField (h : Fintype.card K = p ^ n) : K ≃ₐ[ZMod p] GaloisField p n :=
   haveI := is_splitting_field_of_card_eq _ _ h
   is_splitting_field.alg_equiv _ _
 #align galois_field.alg_equiv_galois_field GaloisField.algEquivGaloisField
+-/
 
 end GaloisField
 
@@ -207,6 +227,7 @@ namespace FiniteField
 
 variable {K : Type _} [Field K] [Fintype K] {K' : Type _} [Field K'] [Fintype K']
 
+#print FiniteField.algEquivOfCardEq /-
 /-- Uniqueness of finite fields:
   Any two finite fields of the same cardinality are (possibly non canonically) isomorphic-/
 def algEquivOfCardEq (p : ℕ) [Fact p.Prime] [Algebra (ZMod p) K] [Algebra (ZMod p) K']
@@ -222,7 +243,9 @@ def algEquivOfCardEq (p : ℕ) [Fact p.Prime] [Algebra (ZMod p) K] [Algebra (ZMo
   rw [Nat.pow_right_injective (Fact.out (Nat.Prime p)).one_lt hKK'] at *
   use AlgEquiv.trans hGalK hK'Gal
 #align finite_field.alg_equiv_of_card_eq FiniteField.algEquivOfCardEq
+-/
 
+#print FiniteField.ringEquivOfCardEq /-
 /-- Uniqueness of finite fields:
   Any two finite fields of the same cardinality are (possibly non canonically) isomorphic-/
 def ringEquivOfCardEq (hKK' : Fintype.card K = Fintype.card K') : K ≃+* K' :=
@@ -246,6 +269,7 @@ def ringEquivOfCardEq (hKK' : Fintype.card K = Fintype.card K') : K ≃+* K' :=
   letI : Algebra (ZMod p) K' := ZMod.algebra _ _
   exact alg_equiv_of_card_eq p hKK'
 #align finite_field.ring_equiv_of_card_eq FiniteField.ringEquivOfCardEq
+-/
 
 end FiniteField
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson, Alex J. Best, Johan Commelin, Eric Rodriguez, Ruben Van de Velde
 
 ! This file was ported from Lean 3 source module field_theory.finite.galois_field
-! leanprover-community/mathlib commit 4b05d3f4f0601dca8abf99c4ec99187682ed0bba
+! leanprover-community/mathlib commit 0723536a0522d24fc2f159a096fb3304bef77472
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -165,8 +165,6 @@ theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (X ^ p - X) :=
   rw [splits_iff_card_roots, h1, ← Finset.card_def, Finset.card_univ, h2, ZMod.card]
 #align galois_field.splits_zmod_X_pow_sub_X GaloisField.splits_zMod_x_pow_sub_x
 
-attribute [-instance] ZMod.algebra
-
 /-- A Galois field with exponent 1 is equivalent to `zmod` -/
 def equivZmodP : GaloisField p 1 ≃ₐ[ZMod p] ZMod p :=
   let h : (X ^ p ^ 1 : (ZMod p)[X]) = X ^ Fintype.card (ZMod p) := by rw [pow_one, ZMod.card p]
@@ -244,6 +242,8 @@ def ringEquivOfCardEq (hKK' : Fintype.card K = Fintype.card K') : K ≃+* K' :=
     all_goals infer_instance
   rw [← hpp'] at *
   haveI := fact_iff.2 hp
+  letI : Algebra (ZMod p) K := ZMod.algebra _ _
+  letI : Algebra (ZMod p) K' := ZMod.algebra _ _
   exact alg_equiv_of_card_eq p hKK'
 #align finite_field.ring_equiv_of_card_eq FiniteField.ringEquivOfCardEq
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson, Alex J. Best, Johan Commelin, Eric Rodriguez, Ruben Van de Velde
 
 ! This file was ported from Lean 3 source module field_theory.finite.galois_field
-! leanprover-community/mathlib commit 9fb8964792b4237dac6200193a0d533f1b3f7423
+! leanprover-community/mathlib commit 4b05d3f4f0601dca8abf99c4ec99187682ed0bba
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -165,11 +165,13 @@ theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (X ^ p - X) :=
   rw [splits_iff_card_roots, h1, ← Finset.card_def, Finset.card_univ, h2, ZMod.card]
 #align galois_field.splits_zmod_X_pow_sub_X GaloisField.splits_zMod_x_pow_sub_x
 
+attribute [-instance] ZMod.algebra
+
 /-- A Galois field with exponent 1 is equivalent to `zmod` -/
 def equivZmodP : GaloisField p 1 ≃ₐ[ZMod p] ZMod p :=
-  have h : (X ^ p ^ 1 : (ZMod p)[X]) = X ^ Fintype.card (ZMod p) := by rw [pow_one, ZMod.card p]
-  have inst : IsSplittingField (ZMod p) (ZMod p) (X ^ p ^ 1 - X) := by rw [h]; infer_instance
-  (is_splitting_field.alg_equiv (ZMod p) (X ^ p ^ 1 - X : (ZMod p)[X])).symm
+  let h : (X ^ p ^ 1 : (ZMod p)[X]) = X ^ Fintype.card (ZMod p) := by rw [pow_one, ZMod.card p]
+  let inst : IsSplittingField (ZMod p) (ZMod p) (X ^ p ^ 1 - X) := by rw [h]; infer_instance
+  (@IsSplittingField.algEquiv _ (ZMod p) _ _ _ (X ^ p ^ 1 - X : (ZMod p)[X]) inst).symm
 #align galois_field.equiv_zmod_p GaloisField.equivZmodP
 
 variable {K : Type _} [Field K] [Fintype K] [Algebra (ZMod p) K]
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson, Alex J. Best, Johan Commelin, Eric Rodriguez, Ruben Van de Velde
 
 ! This file was ported from Lean 3 source module field_theory.finite.galois_field
-! leanprover-community/mathlib commit df76f43357840485b9d04ed5dee5ab115d420e87
+! leanprover-community/mathlib commit 9fb8964792b4237dac6200193a0d533f1b3f7423
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -49,10 +49,10 @@ instance FiniteField.HasSub.Sub.Polynomial.isSplittingField (K F : Type _) [Fiel
       FiniteField.X_pow_card_sub_X_natDegree_eq K Fintype.one_lt_card
     rw [← splits_id_iff_splits, splits_iff_card_roots, Polynomial.map_sub, Polynomial.map_pow,
       map_X, h, FiniteField.roots_X_pow_card_sub_X K, ← Finset.card_def, Finset.card_univ]
-  adjoin_roots := by
+  adjoin_rootSet := by
     classical
     trans Algebra.adjoin F ((roots (X ^ Fintype.card K - X : K[X])).toFinset : Set K)
-    · simp only [Polynomial.map_pow, map_X, Polynomial.map_sub]
+    · simp only [root_set, Polynomial.map_pow, map_X, Polynomial.map_sub]
     · rw [FiniteField.roots_X_pow_card_sub_X, val_to_finset, coe_univ, Algebra.adjoin_univ]
 #align finite_field.has_sub.sub.polynomial.is_splitting_field FiniteField.HasSub.Sub.Polynomial.isSplittingField
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson, Alex J. Best, Johan Commelin, Eric Rodriguez, Ruben Van de Velde
 
 ! This file was ported from Lean 3 source module field_theory.finite.galois_field
-! leanprover-community/mathlib commit 12a85fac627bea918960da036049d611b1a3ee43
+! leanprover-community/mathlib commit df76f43357840485b9d04ed5dee5ab115d420e87
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -12,7 +12,7 @@ import Mathbin.Algebra.CharP.Algebra
 import Mathbin.Data.Zmod.Algebra
 import Mathbin.FieldTheory.Finite.Basic
 import Mathbin.FieldTheory.Galois
-import Mathbin.FieldTheory.SplittingField
+import Mathbin.FieldTheory.SplittingField.IsSplittingField
 
 /-!
 # Galois fields
Diff
@@ -46,14 +46,14 @@ instance FiniteField.HasSub.Sub.Polynomial.isSplittingField (K F : Type _) [Fiel
   Splits :=
     by
     have h : (X ^ Fintype.card K - X : K[X]).natDegree = Fintype.card K :=
-      FiniteField.x_pow_card_sub_x_natDegree_eq K Fintype.one_lt_card
+      FiniteField.X_pow_card_sub_X_natDegree_eq K Fintype.one_lt_card
     rw [← splits_id_iff_splits, splits_iff_card_roots, Polynomial.map_sub, Polynomial.map_pow,
-      map_X, h, FiniteField.roots_x_pow_card_sub_x K, ← Finset.card_def, Finset.card_univ]
+      map_X, h, FiniteField.roots_X_pow_card_sub_X K, ← Finset.card_def, Finset.card_univ]
   adjoin_roots := by
     classical
-      trans Algebra.adjoin F ((roots (X ^ Fintype.card K - X : K[X])).toFinset : Set K)
-      · simp only [Polynomial.map_pow, map_X, Polynomial.map_sub]
-      · rw [FiniteField.roots_x_pow_card_sub_x, val_to_finset, coe_univ, Algebra.adjoin_univ]
+    trans Algebra.adjoin F ((roots (X ^ Fintype.card K - X : K[X])).toFinset : Set K)
+    · simp only [Polynomial.map_pow, map_X, Polynomial.map_sub]
+    · rw [FiniteField.roots_X_pow_card_sub_X, val_to_finset, coe_univ, Algebra.adjoin_univ]
 #align finite_field.has_sub.sub.polynomial.is_splitting_field FiniteField.HasSub.Sub.Polynomial.isSplittingField
 
 theorem galois_poly_separable {K : Type _} [Field K] (p q : ℕ) [CharP K p] (h : p ∣ q) :
@@ -97,12 +97,12 @@ theorem finrank {n} (h : n ≠ 0) : FiniteDimensional.finrank (ZMod p) (GaloisFi
   by
   set g_poly := (X ^ p ^ n - X : (ZMod p)[X])
   have hp : 1 < p := (Fact.out (Nat.Prime p)).one_lt
-  have aux : g_poly ≠ 0 := FiniteField.x_pow_card_pow_sub_x_ne_zero _ h hp
+  have aux : g_poly ≠ 0 := FiniteField.X_pow_card_pow_sub_X_ne_zero _ h hp
   have key : Fintype.card (g_poly.rootSet (GaloisField p n)) = g_poly.natDegree :=
     card_root_set_eq_nat_degree (galois_poly_separable p _ (dvd_pow (dvd_refl p) h))
       (splitting_field.splits g_poly)
   have nat_degree_eq : g_poly.natDegree = p ^ n :=
-    FiniteField.x_pow_card_pow_sub_x_natDegree_eq _ h hp
+    FiniteField.X_pow_card_pow_sub_X_natDegree_eq _ h hp
   rw [nat_degree_eq] at key 
   suffices g_poly.rootSet (GaloisField p n) = Set.univ
     by
@@ -156,9 +156,9 @@ theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (X ^ p - X) :=
   have hp : 1 < p := (Fact.out (Nat.Prime p)).one_lt
   have h1 : roots (X ^ p - X : (ZMod p)[X]) = finset.univ.val :=
     by
-    convert FiniteField.roots_x_pow_card_sub_x _
+    convert FiniteField.roots_X_pow_card_sub_X _
     exact (ZMod.card p).symm
-  have h2 := FiniteField.x_pow_card_sub_x_natDegree_eq (ZMod p) hp
+  have h2 := FiniteField.X_pow_card_sub_X_natDegree_eq (ZMod p) hp
   -- We discharge the `p = 0` separately, to avoid typeclass issues on `zmod p`.
   cases p;
   cases hp
Diff
@@ -59,7 +59,7 @@ instance FiniteField.HasSub.Sub.Polynomial.isSplittingField (K F : Type _) [Fiel
 theorem galois_poly_separable {K : Type _} [Field K] (p q : ℕ) [CharP K p] (h : p ∣ q) :
     Separable (X ^ q - X : K[X]) := by
   use 1, X ^ q - X - 1
-  rw [← CharP.cast_eq_zero_iff K[X] p] at h
+  rw [← CharP.cast_eq_zero_iff K[X] p] at h 
   rw [derivative_sub, derivative_X_pow, derivative_X, C_eq_nat_cast, h]
   ring
 #align galois_poly_separable galois_poly_separable
@@ -68,7 +68,8 @@ theorem galois_poly_separable {K : Type _} [Field K] (p q : ℕ) [CharP K p] (h
 Every field with the same cardinality is (non-canonically)
 isomorphic to this field. -/
 def GaloisField (p : ℕ) [Fact p.Prime] (n : ℕ) :=
-  SplittingField (X ^ p ^ n - X : (ZMod p)[X])deriving Field
+  SplittingField (X ^ p ^ n - X : (ZMod p)[X])
+deriving Field
 #align galois_field GaloisField
 
 instance : Inhabited (@GaloisField 2 (Fact.mk Nat.prime_two) 1) :=
@@ -102,11 +103,11 @@ theorem finrank {n} (h : n ≠ 0) : FiniteDimensional.finrank (ZMod p) (GaloisFi
       (splitting_field.splits g_poly)
   have nat_degree_eq : g_poly.natDegree = p ^ n :=
     FiniteField.x_pow_card_pow_sub_x_natDegree_eq _ h hp
-  rw [nat_degree_eq] at key
+  rw [nat_degree_eq] at key 
   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
+    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
   rw [Set.eq_univ_iff_forall]
   suffices
@@ -123,8 +124,8 @@ theorem finrank {n} (h : n ≠ 0) : FiniteDimensional.finrank (ZMod p) (GaloisFi
   · rintro x (⟨r, rfl⟩ | hx)
     · simp only [aeval_X_pow, aeval_X, AlgHom.map_sub]
       rw [← map_pow, ZMod.pow_card_pow, sub_self]
-    · dsimp only [GaloisField] at hx
-      rwa [mem_root_set_of_ne aux] at hx; infer_instance
+    · dsimp only [GaloisField] at hx 
+      rwa [mem_root_set_of_ne aux] at hx ; infer_instance
   · dsimp only [g_poly]
     rw [← coeff_zero_eq_aeval_zero']
     simp only [coeff_X_pow, coeff_X_zero, sub_zero, _root_.map_eq_zero, ite_eq_right_iff,
@@ -215,7 +216,7 @@ def algEquivOfCardEq (p : ℕ) [Fact p.Prime] [Algebra (ZMod p) K] [Algebra (ZMo
   have : CharP K' p := by rw [← Algebra.charP_iff (ZMod p) K' p]; exact ZMod.charP p
   choose n a hK using FiniteField.card K p
   choose n' a' hK' using FiniteField.card K' p
-  rw [hK, hK'] at hKK'
+  rw [hK, hK'] at hKK' 
   have hGalK := GaloisField.algEquivGaloisField p n hK
   have hK'Gal := (GaloisField.algEquivGaloisField p n' hK').symm
   rw [Nat.pow_right_injective (Fact.out (Nat.Prime p)).one_lt hKK'] at *
@@ -236,7 +237,7 @@ def ringEquivOfCardEq (hKK' : Fintype.card K = Fintype.card K') : K ≃+* K' :=
     -- := eq_prime_of_eq_prime_pow
     by_contra hne
     have h2 := Nat.coprime_pow_primes n n' hp hp' hne
-    rw [(Eq.congr hK hK').mp hKK', Nat.coprime_self, pow_eq_one_iff (PNat.ne_zero n')] at h2
+    rw [(Eq.congr hK hK').mp hKK', Nat.coprime_self, pow_eq_one_iff (PNat.ne_zero n')] at h2 
     exact Nat.Prime.ne_one hp' h2
     all_goals infer_instance
   rw [← hpp'] at *
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson, Alex J. Best, Johan Commelin, Eric Rodriguez, Ruben Van de Velde
 
 ! This file was ported from Lean 3 source module field_theory.finite.galois_field
-! leanprover-community/mathlib commit bbeb185db4ccee8ed07dc48449414ebfa39cb821
+! leanprover-community/mathlib commit 12a85fac627bea918960da036049d611b1a3ee43
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -12,6 +12,7 @@ import Mathbin.Algebra.CharP.Algebra
 import Mathbin.Data.Zmod.Algebra
 import Mathbin.FieldTheory.Finite.Basic
 import Mathbin.FieldTheory.Galois
+import Mathbin.FieldTheory.SplittingField
 
 /-!
 # Galois fields
@@ -35,10 +36,26 @@ It is a finite field with `p ^ n` elements.
 
 noncomputable section
 
-open Polynomial
+open Polynomial Finset
 
 open scoped Polynomial
 
+instance FiniteField.HasSub.Sub.Polynomial.isSplittingField (K F : Type _) [Field K] [Fintype K]
+    [Field F] [Algebra F K] : IsSplittingField F K (X ^ Fintype.card K - X)
+    where
+  Splits :=
+    by
+    have h : (X ^ Fintype.card K - X : K[X]).natDegree = Fintype.card K :=
+      FiniteField.x_pow_card_sub_x_natDegree_eq K Fintype.one_lt_card
+    rw [← splits_id_iff_splits, splits_iff_card_roots, Polynomial.map_sub, Polynomial.map_pow,
+      map_X, h, FiniteField.roots_x_pow_card_sub_x K, ← Finset.card_def, Finset.card_univ]
+  adjoin_roots := by
+    classical
+      trans Algebra.adjoin F ((roots (X ^ Fintype.card K - X : K[X])).toFinset : Set K)
+      · simp only [Polynomial.map_pow, map_X, Polynomial.map_sub]
+      · rw [FiniteField.roots_x_pow_card_sub_x, val_to_finset, coe_univ, Algebra.adjoin_univ]
+#align finite_field.has_sub.sub.polynomial.is_splitting_field FiniteField.HasSub.Sub.Polynomial.isSplittingField
+
 theorem galois_poly_separable {K : Type _} [Field K] (p q : ℕ) [CharP K p] (h : p ∣ q) :
     Separable (X ^ q - X : K[X]) := by
   use 1, X ^ q - X - 1
Diff
@@ -37,7 +37,7 @@ noncomputable section
 
 open Polynomial
 
-open Polynomial
+open scoped Polynomial
 
 theorem galois_poly_separable {K : Type _} [Field K] (p q : ℕ) [CharP K p] (h : p ∣ q) :
     Separable (X ^ q - X : K[X]) := by
Diff
@@ -100,15 +100,14 @@ theorem finrank {n} (h : n ≠ 0) : FiniteDimensional.finrank (ZMod p) (GaloisFi
   simp_rw [Algebra.mem_adjoin_iff]
   intro x hx
   -- We discharge the `p = 0` separately, to avoid typeclass issues on `zmod p`.
-  cases p
+  cases p;
   cases hp
   apply Subring.closure_induction hx <;> clear! x <;> simp_rw [mem_root_set_of_ne aux]
   · rintro x (⟨r, rfl⟩ | hx)
     · simp only [aeval_X_pow, aeval_X, AlgHom.map_sub]
       rw [← map_pow, ZMod.pow_card_pow, sub_self]
     · dsimp only [GaloisField] at hx
-      rwa [mem_root_set_of_ne aux] at hx
-      infer_instance
+      rwa [mem_root_set_of_ne aux] at hx; infer_instance
   · dsimp only [g_poly]
     rw [← coeff_zero_eq_aeval_zero']
     simp only [coeff_X_pow, coeff_X_zero, sub_zero, _root_.map_eq_zero, ite_eq_right_iff,
@@ -143,7 +142,7 @@ theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (X ^ p - X) :=
     exact (ZMod.card p).symm
   have h2 := FiniteField.x_pow_card_sub_x_natDegree_eq (ZMod p) hp
   -- We discharge the `p = 0` separately, to avoid typeclass issues on `zmod p`.
-  cases p
+  cases p;
   cases hp
   rw [splits_iff_card_roots, h1, ← Finset.card_def, Finset.card_univ, h2, ZMod.card]
 #align galois_field.splits_zmod_X_pow_sub_X GaloisField.splits_zMod_x_pow_sub_x
@@ -151,10 +150,7 @@ theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (X ^ p - X) :=
 /-- A Galois field with exponent 1 is equivalent to `zmod` -/
 def equivZmodP : GaloisField p 1 ≃ₐ[ZMod p] ZMod p :=
   have h : (X ^ p ^ 1 : (ZMod p)[X]) = X ^ Fintype.card (ZMod p) := by rw [pow_one, ZMod.card p]
-  have inst : IsSplittingField (ZMod p) (ZMod p) (X ^ p ^ 1 - X) :=
-    by
-    rw [h]
-    infer_instance
+  have inst : IsSplittingField (ZMod p) (ZMod p) (X ^ p ^ 1 - X) := by rw [h]; infer_instance
   (is_splitting_field.alg_equiv (ZMod p) (X ^ p ^ 1 - X : (ZMod p)[X])).symm
 #align galois_field.equiv_zmod_p GaloisField.equivZmodP
 
@@ -198,12 +194,8 @@ variable {K : Type _} [Field K] [Fintype K] {K' : Type _} [Field K'] [Fintype K'
 def algEquivOfCardEq (p : ℕ) [Fact p.Prime] [Algebra (ZMod p) K] [Algebra (ZMod p) K']
     (hKK' : Fintype.card K = Fintype.card K') : K ≃ₐ[ZMod p] K' :=
   by
-  have : CharP K p := by
-    rw [← Algebra.charP_iff (ZMod p) K p]
-    exact ZMod.charP p
-  have : CharP K' p := by
-    rw [← Algebra.charP_iff (ZMod p) K' p]
-    exact ZMod.charP p
+  have : CharP K p := by rw [← Algebra.charP_iff (ZMod p) K p]; exact ZMod.charP p
+  have : CharP K' p := by rw [← Algebra.charP_iff (ZMod p) K' p]; exact ZMod.charP p
   choose n a hK using FiniteField.card K p
   choose n' a' hK' using FiniteField.card K' p
   rw [hK, hK'] at hKK'
Diff
@@ -174,7 +174,7 @@ instance (priority := 100) {K K' : Type _} [Field K] [Field K'] [Finite K'] [Alg
   cases nonempty_fintype K'
   obtain ⟨p, hp⟩ := CharP.exists K
   haveI : CharP K p := hp
-  haveI : CharP K' p := charP_of_injective_algebra_map' K K' p
+  haveI : CharP K' p := charP_of_injective_algebraMap' K K' p
   exact
     IsGalois.of_separable_splitting_field
       (galois_poly_separable p (Fintype.card K')
Diff
@@ -40,7 +40,7 @@ open Polynomial
 open Polynomial
 
 theorem galois_poly_separable {K : Type _} [Field K] (p q : ℕ) [CharP K p] (h : p ∣ q) :
-    Separable (x ^ q - x : K[X]) := by
+    Separable (X ^ q - X : K[X]) := by
   use 1, X ^ q - X - 1
   rw [← CharP.cast_eq_zero_iff K[X] p] at h
   rw [derivative_sub, derivative_X_pow, derivative_X, C_eq_nat_cast, h]
@@ -51,7 +51,7 @@ theorem galois_poly_separable {K : Type _} [Field K] (p q : ℕ) [CharP K p] (h
 Every field with the same cardinality is (non-canonically)
 isomorphic to this field. -/
 def GaloisField (p : ℕ) [Fact p.Prime] (n : ℕ) :=
-  SplittingField (x ^ p ^ n - x : (ZMod p)[X])deriving Field
+  SplittingField (X ^ p ^ n - X : (ZMod p)[X])deriving Field
 #align galois_field GaloisField
 
 instance : Inhabited (@GaloisField 2 (Fact.mk Nat.prime_two) 1) :=
@@ -64,7 +64,7 @@ variable (p : ℕ) [Fact p.Prime] (n : ℕ)
 instance : Algebra (ZMod p) (GaloisField p n) :=
   SplittingField.algebra _
 
-instance : IsSplittingField (ZMod p) (GaloisField p n) (x ^ p ^ n - x) :=
+instance : IsSplittingField (ZMod p) (GaloisField p n) (X ^ p ^ n - X) :=
   Polynomial.IsSplittingField.splittingField _
 
 instance : CharP (GaloisField p n) p :=
@@ -134,7 +134,7 @@ theorem card (h : n ≠ 0) : Fintype.card (GaloisField p n) = p ^ n :=
   rw [Module.card_fintype b, ← FiniteDimensional.finrank_eq_card_basis b, ZMod.card, finrank p h]
 #align galois_field.card GaloisField.card
 
-theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (x ^ p - x) :=
+theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (X ^ p - X) :=
   by
   have hp : 1 < p := (Fact.out (Nat.Prime p)).one_lt
   have h1 : roots (X ^ p - X : (ZMod p)[X]) = finset.univ.val :=
@@ -150,8 +150,8 @@ theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (x ^ p - x) :=
 
 /-- A Galois field with exponent 1 is equivalent to `zmod` -/
 def equivZmodP : GaloisField p 1 ≃ₐ[ZMod p] ZMod p :=
-  have h : (x ^ p ^ 1 : (ZMod p)[X]) = x ^ Fintype.card (ZMod p) := by rw [pow_one, ZMod.card p]
-  have inst : IsSplittingField (ZMod p) (ZMod p) (x ^ p ^ 1 - x) :=
+  have h : (X ^ p ^ 1 : (ZMod p)[X]) = X ^ Fintype.card (ZMod p) := by rw [pow_one, ZMod.card p]
+  have inst : IsSplittingField (ZMod p) (ZMod p) (X ^ p ^ 1 - X) :=
     by
     rw [h]
     infer_instance
@@ -160,12 +160,12 @@ def equivZmodP : GaloisField p 1 ≃ₐ[ZMod p] ZMod p :=
 
 variable {K : Type _} [Field K] [Fintype K] [Algebra (ZMod p) K]
 
-theorem splits_x_pow_card_sub_x : Splits (algebraMap (ZMod p) K) (x ^ Fintype.card K - x) :=
+theorem splits_x_pow_card_sub_x : Splits (algebraMap (ZMod p) K) (X ^ Fintype.card K - X) :=
   (FiniteField.HasSub.Sub.Polynomial.isSplittingField K (ZMod p)).Splits
 #align galois_field.splits_X_pow_card_sub_X GaloisField.splits_x_pow_card_sub_x
 
 theorem isSplittingField_of_card_eq (h : Fintype.card K = p ^ n) :
-    IsSplittingField (ZMod p) K (x ^ p ^ n - x) :=
+    IsSplittingField (ZMod p) K (X ^ p ^ n - X) :=
   h ▸ FiniteField.HasSub.Sub.Polynomial.isSplittingField K (ZMod p)
 #align galois_field.is_splitting_field_of_card_eq GaloisField.isSplittingField_of_card_eq
 

Changes in mathlib4

mathlib3
mathlib4
chore: Rename nat_cast/int_cast/rat_cast to natCast/intCast/ratCast (#11486)

Now that I am defining NNRat.cast, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast/intCast/ratCast over nat_cast/int_cast/rat_cast, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.

Diff
@@ -56,7 +56,7 @@ theorem galois_poly_separable {K : Type*} [Field K] (p q : ℕ) [CharP K p] (h :
     Separable (X ^ q - X : K[X]) := by
   use 1, X ^ q - X - 1
   rw [← CharP.cast_eq_zero_iff K[X] p] at h
-  rw [derivative_sub, derivative_X_pow, derivative_X, C_eq_nat_cast, h]
+  rw [derivative_sub, derivative_X_pow, derivative_X, C_eq_natCast, h]
   ring
 #align galois_poly_separable galois_poly_separable
 
chore: prepare Lean version bump with explicit simp (#10999)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -121,24 +121,24 @@ theorem finrank {n} (h : n ≠ 0) : FiniteDimensional.finrank (ZMod p) (GaloisFi
   cases p; cases hp
   refine Subring.closure_induction hx ?_ ?_ ?_ ?_ ?_ ?_ <;> simp_rw [mem_rootSet_of_ne aux]
   · rintro x (⟨r, rfl⟩ | hx)
-    · simp only [map_sub, map_pow, aeval_X]
+    · simp only [g_poly, map_sub, map_pow, aeval_X]
       rw [← map_pow, ZMod.pow_card_pow, sub_self]
     · dsimp only [GaloisField] at hx
       rwa [mem_rootSet_of_ne aux] at hx
   · rw [← coeff_zero_eq_aeval_zero']
-    simp only [coeff_X_pow, coeff_X_zero, sub_zero, _root_.map_eq_zero, ite_eq_right_iff,
+    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]
     intro hn
     exact Nat.not_lt_zero 1 (pow_eq_zero hn.symm ▸ hp)
-  · simp
-  · simp only [aeval_X_pow, aeval_X, AlgHom.map_sub, add_pow_char_pow, sub_eq_zero]
+  · simp [g_poly]
+  · simp only [g_poly, aeval_X_pow, aeval_X, AlgHom.map_sub, add_pow_char_pow, sub_eq_zero]
     intro x y hx hy
     rw [hx, hy]
   · intro x hx
-    simp only [sub_eq_zero, aeval_X_pow, aeval_X, AlgHom.map_sub, sub_neg_eq_add] at *
+    simp only [g_poly, sub_eq_zero, aeval_X_pow, aeval_X, AlgHom.map_sub, sub_neg_eq_add] at *
     rw [neg_pow, hx, CharP.neg_one_pow_char_pow]
     simp
-  · simp only [aeval_X_pow, aeval_X, AlgHom.map_sub, mul_pow, sub_eq_zero]
+  · simp only [g_poly, aeval_X_pow, aeval_X, AlgHom.map_sub, mul_pow, sub_eq_zero]
     intro x y hx hy
     rw [hx, hy]
 #align galois_field.finrank GaloisField.finrank
style: reduce spacing variation in "porting note" comments (#10886)

In this pull request, I have systematically eliminated the leading whitespace preceding the colon (:) within all unlabelled or unclassified porting notes. This adjustment facilitates a more efficient review process for the remaining notes by ensuring no entries are overlooked due to formatting inconsistencies.

Diff
@@ -97,7 +97,7 @@ theorem finrank {n} (h : n ≠ 0) : FiniteDimensional.finrank (ZMod p) (GaloisFi
   set g_poly := (X ^ p ^ n - X : (ZMod p)[X])
   have hp : 1 < p := h_prime.out.one_lt
   have aux : g_poly ≠ 0 := FiniteField.X_pow_card_pow_sub_X_ne_zero _ h hp
-  -- Porting note : in the statment of `key`, replaced `g_poly` by its value otherwise the
+  -- Porting note: in the statment of `key`, replaced `g_poly` by its value otherwise the
   -- proof fails
   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))
style: fix multiple spaces before colon (#7411)

Purely cosmetic PR

Diff
@@ -65,7 +65,7 @@ variable (p : ℕ) [Fact p.Prime] (n : ℕ)
 /-- A finite field with `p ^ n` elements.
 Every field with the same cardinality is (non-canonically)
 isomorphic to this field. -/
-def GaloisField  := SplittingField (X ^ p ^ n - X : (ZMod p)[X])
+def GaloisField := SplittingField (X ^ p ^ n - X : (ZMod p)[X])
 -- deriving Field -- Porting note: see https://github.com/leanprover-community/mathlib4/issues/5020
 #align galois_field GaloisField
 
feat: roots in an algebra (#6740)

Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>

Diff
@@ -48,7 +48,7 @@ instance FiniteField.isSplittingField_sub (K F : Type*) [Field K] [Fintype K]
   adjoin_rootSet' := by
     classical
     trans Algebra.adjoin F ((roots (X ^ Fintype.card K - X : K[X])).toFinset : Set K)
-    · simp only [rootSet, Polynomial.map_pow, map_X, Polynomial.map_sub]
+    · simp only [rootSet, aroots, Polynomial.map_pow, map_X, Polynomial.map_sub]
     · rw [FiniteField.roots_X_pow_card_sub_X, val_toFinset, coe_univ, Algebra.adjoin_univ]
 #align finite_field.has_sub.sub.polynomial.is_splitting_field FiniteField.isSplittingField_sub
 
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -38,7 +38,7 @@ open Polynomial Finset
 
 open scoped Polynomial
 
-instance FiniteField.isSplittingField_sub (K F : Type _) [Field K] [Fintype K]
+instance FiniteField.isSplittingField_sub (K F : Type*) [Field K] [Fintype K]
     [Field F] [Algebra F K] : IsSplittingField F K (X ^ Fintype.card K - X) where
   splits' := by
     have h : (X ^ Fintype.card K - X : K[X]).natDegree = Fintype.card K :=
@@ -52,7 +52,7 @@ instance FiniteField.isSplittingField_sub (K F : Type _) [Field K] [Fintype K]
     · rw [FiniteField.roots_X_pow_card_sub_X, val_toFinset, coe_univ, Algebra.adjoin_univ]
 #align finite_field.has_sub.sub.polynomial.is_splitting_field FiniteField.isSplittingField_sub
 
-theorem galois_poly_separable {K : Type _} [Field K] (p q : ℕ) [CharP K p] (h : p ∣ q) :
+theorem galois_poly_separable {K : Type*} [Field K] (p q : ℕ) [CharP K p] (h : p ∣ q) :
     Separable (X ^ q - X : K[X]) := by
   use 1, X ^ q - X - 1
   rw [← CharP.cast_eq_zero_iff K[X] p] at h
@@ -167,7 +167,7 @@ def equivZmodP : GaloisField p 1 ≃ₐ[ZMod p] ZMod p :=
   (@IsSplittingField.algEquiv _ (ZMod p) _ _ _ (X ^ p ^ 1 - X : (ZMod p)[X]) inst).symm
 #align galois_field.equiv_zmod_p GaloisField.equivZmodP
 
-variable {K : Type _} [Field K] [Fintype K] [Algebra (ZMod p) K]
+variable {K : Type*} [Field K] [Fintype K] [Algebra (ZMod p) K]
 
 theorem splits_X_pow_card_sub_X : Splits (algebraMap (ZMod p) K) (X ^ Fintype.card K - X) :=
   (FiniteField.isSplittingField_sub K (ZMod p)).splits
@@ -179,7 +179,7 @@ theorem isSplittingField_of_card_eq (h : Fintype.card K = p ^ n) :
   h ▸ FiniteField.isSplittingField_sub K (ZMod p)
 #align galois_field.is_splitting_field_of_card_eq GaloisField.isSplittingField_of_card_eq
 
-instance (priority := 100) {K K' : Type _} [Field K] [Field K'] [Finite K'] [Algebra K K'] :
+instance (priority := 100) {K K' : Type*} [Field K] [Field K'] [Finite K'] [Algebra K K'] :
     IsGalois K K' := by
   cases nonempty_fintype K'
   obtain ⟨p, hp⟩ := CharP.exists K
@@ -200,7 +200,7 @@ end GaloisField
 
 namespace FiniteField
 
-variable {K : Type _} [Field K] [Fintype K] {K' : Type _} [Field K'] [Fintype K']
+variable {K : Type*} [Field K] [Fintype K] {K' : Type*} [Field K'] [Fintype K']
 
 /-- Uniqueness of finite fields:
   Any two finite fields of the same cardinality are (possibly non canonically) isomorphic-/
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2021 Johan Commelin. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson, Alex J. Best, Johan Commelin, Eric Rodriguez, Ruben Van de Velde
-
-! This file was ported from Lean 3 source module field_theory.finite.galois_field
-! leanprover-community/mathlib commit 0723536a0522d24fc2f159a096fb3304bef77472
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Algebra.CharP.Algebra
 import Mathlib.Data.ZMod.Algebra
@@ -14,6 +9,8 @@ import Mathlib.FieldTheory.Finite.Basic
 import Mathlib.FieldTheory.Galois
 import Mathlib.FieldTheory.SplittingField.IsSplittingField
 
+#align_import field_theory.finite.galois_field from "leanprover-community/mathlib"@"0723536a0522d24fc2f159a096fb3304bef77472"
+
 /-!
 # Galois fields
 
chore: cleanup whitespace (#5988)

Grepping for [^ .:{-] [^ :] and reviewing the results. Once I started I couldn't stop. :-)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -152,7 +152,7 @@ theorem card (h : n ≠ 0) : Fintype.card (GaloisField p n) = p ^ n := by
 #align galois_field.card GaloisField.card
 
 theorem splits_zmod_X_pow_sub_X : Splits (RingHom.id (ZMod p)) (X ^ p - X) := by
-  have hp : 1 < p :=  h_prime.out.one_lt
+  have hp : 1 < p := h_prime.out.one_lt
   have h1 : roots (X ^ p - X : (ZMod p)[X]) = Finset.univ.val := by
     convert FiniteField.roots_X_pow_card_sub_X (ZMod p)
     exact (ZMod.card p).symm
chore: tidy various files (#5449)
Diff
@@ -41,7 +41,7 @@ open Polynomial Finset
 
 open scoped Polynomial
 
-instance FiniteField.HasSub.Sub.Polynomial.isSplittingField (K F : Type _) [Field K] [Fintype K]
+instance FiniteField.isSplittingField_sub (K F : Type _) [Field K] [Fintype K]
     [Field F] [Algebra F K] : IsSplittingField F K (X ^ Fintype.card K - X) where
   splits' := by
     have h : (X ^ Fintype.card K - X : K[X]).natDegree = Fintype.card K :=
@@ -53,7 +53,7 @@ instance FiniteField.HasSub.Sub.Polynomial.isSplittingField (K F : Type _) [Fiel
     trans Algebra.adjoin F ((roots (X ^ Fintype.card K - X : K[X])).toFinset : Set K)
     · simp only [rootSet, Polynomial.map_pow, map_X, Polynomial.map_sub]
     · rw [FiniteField.roots_X_pow_card_sub_X, val_toFinset, coe_univ, Algebra.adjoin_univ]
-#align finite_field.has_sub.sub.polynomial.is_splitting_field FiniteField.HasSub.Sub.Polynomial.isSplittingField
+#align finite_field.has_sub.sub.polynomial.is_splitting_field FiniteField.isSplittingField_sub
 
 theorem galois_poly_separable {K : Type _} [Field K] (p q : ℕ) [CharP K p] (h : p ∣ q) :
     Separable (X ^ q - X : K[X]) := by
@@ -72,8 +72,8 @@ def GaloisField  := SplittingField (X ^ p ^ n - X : (ZMod p)[X])
 -- deriving Field -- Porting note: see https://github.com/leanprover-community/mathlib4/issues/5020
 #align galois_field GaloisField
 
-instance : Field (GaloisField p n) := by
-  dsimp only [GaloisField]; exact SplittingField.instFieldSplittingField _
+instance : Field (GaloisField p n) :=
+  inferInstanceAs (Field (SplittingField _))
 
 instance : Inhabited (@GaloisField 2 (Fact.mk Nat.prime_two) 1) := ⟨37⟩
 
@@ -151,7 +151,7 @@ theorem card (h : n ≠ 0) : Fintype.card (GaloisField p n) = p ^ n := by
   rw [Module.card_fintype b, ← FiniteDimensional.finrank_eq_card_basis b, ZMod.card, finrank p h]
 #align galois_field.card GaloisField.card
 
-theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (X ^ p - X) := by
+theorem splits_zmod_X_pow_sub_X : Splits (RingHom.id (ZMod p)) (X ^ p - X) := by
   have hp : 1 < p :=  h_prime.out.one_lt
   have h1 : roots (X ^ p - X : (ZMod p)[X]) = Finset.univ.val := by
     convert FiniteField.roots_X_pow_card_sub_X (ZMod p)
@@ -161,7 +161,7 @@ theorem splits_zMod_x_pow_sub_x : Splits (RingHom.id (ZMod p)) (X ^ p - X) := by
   cases p; cases hp
   rw [splits_iff_card_roots, h1, ← Finset.card_def, Finset.card_univ, h2, ZMod.card]
 set_option linter.uppercaseLean3 false in
-#align galois_field.splits_zmod_X_pow_sub_X GaloisField.splits_zMod_x_pow_sub_x
+#align galois_field.splits_zmod_X_pow_sub_X GaloisField.splits_zmod_X_pow_sub_X
 
 /-- A Galois field with exponent 1 is equivalent to `ZMod` -/
 def equivZmodP : GaloisField p 1 ≃ₐ[ZMod p] ZMod p :=
@@ -172,14 +172,14 @@ def equivZmodP : GaloisField p 1 ≃ₐ[ZMod p] ZMod p :=
 
 variable {K : Type _} [Field K] [Fintype K] [Algebra (ZMod p) K]
 
-theorem splits_x_pow_card_sub_x : Splits (algebraMap (ZMod p) K) (X ^ Fintype.card K - X) :=
-  (FiniteField.HasSub.Sub.Polynomial.isSplittingField K (ZMod p)).splits
+theorem splits_X_pow_card_sub_X : Splits (algebraMap (ZMod p) K) (X ^ Fintype.card K - X) :=
+  (FiniteField.isSplittingField_sub K (ZMod p)).splits
 set_option linter.uppercaseLean3 false in
-#align galois_field.splits_X_pow_card_sub_X GaloisField.splits_x_pow_card_sub_x
+#align galois_field.splits_X_pow_card_sub_X GaloisField.splits_X_pow_card_sub_X
 
 theorem isSplittingField_of_card_eq (h : Fintype.card K = p ^ n) :
     IsSplittingField (ZMod p) K (X ^ p ^ n - X) :=
-  h ▸ FiniteField.HasSub.Sub.Polynomial.isSplittingField K (ZMod p)
+  h ▸ FiniteField.isSplittingField_sub K (ZMod p)
 #align galois_field.is_splitting_field_of_card_eq GaloisField.isSplittingField_of_card_eq
 
 instance (priority := 100) {K K' : Type _} [Field K] [Field K'] [Finite K'] [Algebra K K'] :
@@ -228,7 +228,6 @@ def ringEquivOfCardEq (hKK' : Fintype.card K = Fintype.card K') : K ≃+* K' :=
   choose n hp hK using FiniteField.card K p
   choose n' hp' hK' using FiniteField.card K' p'
   have hpp' : p = p' := by
-    -- := eq_prime_of_eq_prime_pow
     by_contra hne
     have h2 := Nat.coprime_pow_primes n n' hp hp' hne
     rw [(Eq.congr hK hK').mp hKK', Nat.coprime_self, pow_eq_one_iff (PNat.ne_zero n')] at h2
feat: port FieldTheory.Finite.GaloisField (#5139)

This PR should wait until the discussion here is resolved

Co-authored-by: Riccardo Brasca <riccardo.brasca@gmail.com>

Dependencies 10 + 693

694 files ported (98.6%)
285181 lines ported (98.8%)
Show graph

The unported dependencies are