Documentation

Atlas.EllipticCurves.code.FiniteFields

@[reducible, inline]
abbrev ๐”ฝ (p : โ„•) :

Notation ๐”ฝ p for the finite field with p elements, defined as ZMod p (the quotient โ„ค / p โ„ค). Matches Definition 3.2.

Instances For
    def Fp (p : โ„•) :

    Alternative non-abbrev synonym Fp p := ZMod p for ๐”ฝ p.

    Instances For
      @[reducible, inline]
      abbrev ๐”ฝq (p : โ„•) [Fact (Nat.Prime p)] (n : โ„•) :

      Notation ๐”ฝq p n for the finite field with p^n elements, defined as GaloisField p n (the splitting field of X^(p^n) - X over ๐”ฝ_p). Matches Definition 3.4.

      Instances For

        ๐”ฝq p n is, by definition, the splitting field of X^(p^n) - X over ๐”ฝ_p, matching the splitting-field description in Definition 3.4.

        theorem ๐”ฝq_frobenius (p : โ„•) [Fact (Nat.Prime p)] (n : โ„•) (hn : n โ‰  0) (x : ๐”ฝq p n) :
        x ^ p ^ n = x

        Frobenius identity in ๐”ฝq p n: every element satisfies x^(p^n) = x, i.e. ๐”ฝq p n consists of roots of X^(p^n) - X.

        theorem ๐”ฝq_card (p : โ„•) [Fact (Nat.Prime p)] (n : โ„•) (hn : n โ‰  0) :

        Theorem 3.6 (cardinality half): ๐”ฝq p n has exactly p^n elements.

        ๐”ฝq p 1 is canonically isomorphic to ๐”ฝ_p = ZMod p as a ZMod p-algebra.

        Instances For
          theorem ๐”ฝq_card_thm36 (p : โ„•) [Fact (Nat.Prime p)] (n : โ„•) (hn : n โ‰  0) :

          Theorem 3.6, cardinality half: |๐”ฝq p n| = p^n.

          noncomputable def ๐”ฝq_ringEquiv_of_card (p : โ„•) [Fact (Nat.Prime p)] (n : โ„•) (hn : n โ‰  0) (K : Type u_1) [Field K] [Fintype K] (hK : Fintype.card K = p ^ n) :

          Theorem 3.6, uniqueness half (data form): a choice of ring isomorphism between any finite field K of cardinality p^n and ๐”ฝq p n.

          Instances For
            theorem ๐”ฝq_unique_of_card (p : โ„•) [Fact (Nat.Prime p)] (n : โ„•) (hn : n โ‰  0) (K : Type u_1) [Field K] [Fintype K] (hK : Fintype.card K = p ^ n) :

            Theorem 3.6, uniqueness half (propositional form): any finite field of cardinality p^n is isomorphic to ๐”ฝq p n.

            theorem Fq_unique_of_card (p : โ„•) [Fact (Nat.Prime p)] (n : โ„•) {K : Type u_1} [Field K] [Fintype K] (hn : n โ‰  0) (hcard : Fintype.card K = p ^ n) :

            Alias of ๐”ฝq_unique_of_card with implicit arguments restructured.

            theorem finite_fields_isomorphic_of_card_eq (Kโ‚ : Type u_1) (Kโ‚‚ : Type u_2) [Field Kโ‚] [Field Kโ‚‚] [Fintype Kโ‚] [Fintype Kโ‚‚] (h : Fintype.card Kโ‚ = Fintype.card Kโ‚‚) :
            Nonempty (Kโ‚ โ‰ƒ+* Kโ‚‚)

            Two finite fields of the same cardinality are isomorphic โ€” a general form of the uniqueness statement in Theorem 3.6.

            Theorem 3.8: ๐”ฝ_{p^m} embeds into ๐”ฝ_{p^n} (as a ZMod p-algebra) iff m โˆฃ n.

            @[implicit_reducible]
            instance Fp_field (p : โ„•) [hp : Fact (Nat.Prime p)] :

            ๐”ฝ p is a field whenever p is prime.

            theorem Fp_canonical_map (p : โ„•) [Fact (Nat.Prime p)] (K : Type u_1) [Field K] [CharP K p] :
            โˆƒ (f : ๐”ฝ p โ†’+* K), Function.Injective โ‡‘f

            Theorem 3.3 (existence of canonical embedding): every field K of characteristic p admits a canonical injective ring homomorphism from ๐”ฝ p.

            theorem Fp_unique_of_card (p : โ„•) (hp : Nat.Prime p) (K : Type u_1) [Field K] [Fintype K] (hK : Fintype.card K = p) :

            Theorem 3.3 (uniqueness): every field of cardinality p (with p prime) is isomorphic to ๐”ฝ p.

            theorem fields_of_card_prime_isomorphic (p : โ„•) (hp : Nat.Prime p) (Kโ‚ : Type u_1) (Kโ‚‚ : Type u_2) [Field Kโ‚] [Field Kโ‚‚] [Fintype Kโ‚] [Fintype Kโ‚‚] (hKโ‚ : Fintype.card Kโ‚ = p) (hKโ‚‚ : Fintype.card Kโ‚‚ = p) :
            Nonempty (Kโ‚ โ‰ƒ+* Kโ‚‚)

            Two fields of prime cardinality p are isomorphic, by Theorem 3.3.

            theorem char_p_contains_Fp (p : โ„•) [Fact (Nat.Prime p)] (K : Type u_1) [Field K] [CharP K p] :
            โˆƒ (f : ๐”ฝ p โ†’+* K), Function.Injective โ‡‘f

            Restatement of Fp_canonical_map: any field of characteristic p contains a copy of ๐”ฝ p via an injective ring homomorphism.

            theorem Fp_unique_of_card_prime (p : โ„•) (hp : Nat.Prime p) (K : Type u_1) [Field K] [Fintype K] (hK : Fintype.card K = p) :

            Alias of Fp_unique_of_card: any field of prime cardinality p is isomorphic to ๐”ฝ p.

            Definition 3.17: f is separable iff it has deg f distinct roots in any algebraic closure โ€” encoded here via Mathlib's Polynomial.Separable.

            Instances For

              A polynomial is inseparable iff it is not separable.

              Instances For

                Unfolding lemma: IsSeparablePoly f is definitionally f.Separable.

                Unfolding lemma: IsInseparablePoly f is definitionally ยฌ f.Separable.

                One of the equivalent formulations from Definition 3.17: separability is the same as f being coprime to its derivative f'.

                theorem Polynomial.separable_iff_card_rootSet_eq_natDegree {k : Type u_1} [Field k] {K : Type u_2} [Field K] [Algebra k K] {f : Polynomial k} (hf : f โ‰  0) (hsplit : (map (algebraMap k K) f).Splits) :

                Definition 3.17, distinct-roots criterion: if f splits over K, then f is separable iff |{roots of f in K}| = deg f.

                A separable polynomial is squarefree (one half of the squarefree-on-every- extension characterization in Definition 3.17).

                Over a perfect field, separability and squarefreeness coincide for polynomials.

                Lemma 3.20: an irreducible polynomial f is inseparable iff its formal derivative f' is identically zero.

                theorem finite_mult_subgroup_of_field_isCyclic (k : Type u_1) [Field k] (G : Subgroup kหฃ) [Finite โ†ฅG] :
                IsCyclic โ†ฅG

                Theorem 3.12: every finite subgroup of the multiplicative group kหฃ of a field is cyclic.

                Corollary 3.13: the multiplicative group kหฃ of a finite field is cyclic.

                Specialization of Corollary 3.13 to ๐”ฝq p n: the multiplicative group (๐”ฝq p n)หฃ is cyclic.

                Definition 3.14: a monic irreducible f โˆˆ ๐”ฝ_p[x] is primitive iff its adjoined root has order p^(deg f) - 1 (i.e. generates the multiplicative group of ๐”ฝ_p[x]/(f)).

                Instances For

                  A primitive polynomial is monic.

                  A primitive polynomial is irreducible.

                  For a primitive polynomial f, its adjoined root has order p^(deg f) - 1.

                  Equivalence: a field k is perfect (Definition 3.21) iff every irreducible polynomial in k[x] is separable.

                  theorem finite_field_isPerfect (K : Type u_1) [Field K] [Finite K] :

                  Theorem 3.22: every finite field is perfect.

                  Theorem 3.9 (data form): for any irreducible f โˆˆ ๐”ฝ_p[x] of positive degree n, the quotient ring ๐”ฝ_p[x]/(f) is ring-isomorphic to ๐”ฝ_{p^n}.

                  Instances For

                    Theorem 3.9 (propositional form): for irreducible f of positive degree, ๐”ฝ_p[x]/(f) โ‰ƒ ๐”ฝ_{p^{deg f}}.

                    Corollary 3.10: every irreducible f โˆˆ ๐”ฝ_p[x] of positive degree n splits completely in ๐”ฝ_{p^n}.

                    Restatement of Corollary 3.10 with GaloisField notation: irreducible f โˆˆ ๐”ฝ_p[x] of positive degree n splits completely in GaloisField p n.

                    noncomputable def conwayCoeff (p : โ„•) [Fact (Nat.Prime p)] (f : Polynomial (ZMod p)) (i : โ„•) :

                    The i-th Conway coefficient of an order polynomial f from Definition 3.16: take (-1)^(deg f - i)ยทcoeff_i(f) and reduce to a natural number in [0, p).

                    Instances For
                      def conwayLT (p : โ„•) [Fact (Nat.Prime p)] (f g : Polynomial (ZMod p)) :

                      The strict lexicographic order on Conway coefficients used to compare two order polynomials of the same degree, per Definition 3.16.

                      Instances For
                        def ConwayCompatible (p : โ„•) [Fact (Nat.Prime p)] (fam : (m : โ„•) โ†’ 0 < m โ†’ Polynomial (ZMod p)) (n : โ„•) (f : Polynomial (ZMod p)) :

                        Conway compatibility (Definition 3.16): for every proper divisor m โˆฃ n and every root ฮฑ of fam m, f(ฮฑ^(n/m)) = 0 holds in the algebraic closure of ๐”ฝ_p.

                        Instances For
                          structure IsConwayPolynomialSystem (p : โ„•) [Fact (Nat.Prime p)] (fam : (n : โ„•) โ†’ 0 < n โ†’ Polynomial (ZMod p)) :

                          A family fam : โˆ€ n > 0, ๐”ฝ_p[X] is a Conway polynomial system if it satisfies the recursive definition (Definition 3.16): the degree-one case is X - r for the least primitive root r; each higher polynomial is primitive, has the right degree, is compatible with smaller members, and is minimal under the Conway lex order among such primitives.

                          Instances For
                            theorem conwayPolynomialSystem_exists (p : โ„•) [Fact (Nat.Prime p)] :
                            โˆƒ (fam : (n : โ„•) โ†’ 0 < n โ†’ Polynomial (ZMod p)), IsConwayPolynomialSystem p fam

                            Existence of a Conway polynomial system over ๐”ฝ_p (Definition 3.16).

                            theorem orderOf_adjoinRoot_root_eq_orderOf (F : Type u_1) [Field F] (E : Type u_2) [Field E] [Algebra F E] (ฮฑ : E) (hint : IsIntegral F ฮฑ) :

                            Auxiliary lemma for Theorem 3.15: for an integral element ฮฑ of E/F, the order of AdjoinRoot.root (minpoly F ฮฑ) equals orderOf ฮฑ, via the ring isomorphism between F[x]/(minpoly ฮฑ) and F(ฮฑ).

                            theorem primitive_poly_exists (p : โ„•) [hp : Fact (Nat.Prime p)] (n : โ„•) (hn : 0 < n) :

                            Theorem 3.15 (existence half): for every prime p and positive n, there exists a primitive polynomial of degree n in ๐”ฝ_p[x]. The construction takes the minimal polynomial of a generator of (๐”ฝ_{p^n})หฃ.

                            theorem nat_card_eq_mul_of_const_fiber {A : Type u_1} {B : Type u_2} [Finite A] [Finite B] (f : A โ†’ B) (k : โ„•) (hfib : โˆ€ (b : B), Nat.card { a : A // f a = b } = k) :

                            Generic counting lemma: if f : A โ†’ B has every fibre of cardinality k, then |A| = k ยท |B|. Used in counting primitive polynomials in Theorem 3.15.

                            theorem adjoin_top_of_unit_generator (p : โ„•) [hp : Fact (Nat.Prime p)] (n : โ„•) (hn : 0 < n) (g : (GaloisField p n)หฃ) (hg : orderOf g = p ^ n - 1) :
                            (ZMod p)โŸฎโ†‘gโŸฏ = โŠค

                            If g is a unit of ๐”ฝ_{p^n} of order p^n - 1, then g generates the multiplicative group of ๐”ฝ_{p^n} and ๐”ฝ_p(g) = ๐”ฝ_{p^n}.

                            theorem generator_minpoly_is_prim (p : โ„•) [hp : Fact (Nat.Prime p)] (n : โ„•) (hn : 0 < n) (g : (GaloisField p n)หฃ) (hg : orderOf g = p ^ n - 1) :

                            If g is a generator of (๐”ฝ_{p^n})หฃ, then its minimal polynomial over ๐”ฝ_p is a primitive polynomial of degree n (cf. Theorem 3.15).

                            The set of primitive polynomials of degree n in ๐”ฝ_p[x] is finite: a primitive polynomial of degree n is determined by its n lower coefficients in ๐”ฝ_p, of which there are finitely many.

                            theorem card_generators_eq_totient (p : โ„•) [hp : Fact (Nat.Prime p)] (n : โ„•) (hn : 0 < n) :
                            Nat.card { g : (GaloisField p n)หฃ // orderOf g = p ^ n - 1 } = (p ^ n - 1).totient

                            In a cyclic group (๐”ฝ_{p^n})หฃ of order p^n - 1, the number of generators is ฯ†(p^n - 1) (Euler totient), the standard counting fact.

                            noncomputable def minpoly_of_generator (p : โ„•) [hp : Fact (Nat.Prime p)] (n : โ„•) (hn : 0 < n) (g : { g : (GaloisField p n)หฃ // orderOf g = p ^ n - 1 }) :

                            The map from multiplicative generators of ๐”ฝ_{p^n} to primitive polynomials of degree n, sending g to its minimal polynomial over ๐”ฝ_p.

                            Instances For

                              Each primitive polynomial of degree n is the minimal polynomial of exactly n generators of (๐”ฝ_{p^n})หฃ (its n Galois conjugates).

                              Theorem 3.15 (counting half): the number of primitive polynomials of degree n in ๐”ฝ_p[x] is ฯ†(p^n - 1) / n.