Documentation

HexGF2Mathlib.Field

2 is prime, the characteristic fact both packed correspondences need to name the generic field over F_2. Stated once here rather than inside each namespace, since the two copies were identical.

2 is a prime modulus, so Hex.ZMod64 2 is a field and the generic quotient-field construction applies to Hex.FpPoly 2.

The packed irreducible modulus viewed inside the generic FpPoly 2 representation.

Equations
Instances For
    theorem HexGF2Mathlib.GF2n.modulusFpPoly_degree_pos {n : } {irr : UInt64} {hn : 0 < n} {hn64 : n < 64} :

    The generic FpPoly 2 modulus inherits positive degree from the packed single-word modulus, whose degree is the fixed extension degree n > 0.

    Packed irreducibility transports across the GF2Poly ≃+* FpPoly 2 conversion layer.

    @[reducible, inline]
    abbrev HexGF2Mathlib.GF2n.GenericFiniteField {n : } {irr : UInt64} {hn : 0 < n} {hn64 : n < 64} {hirr : (Hex.GF2Poly.ofUInt64Monic irr n).Irreducible} :

    The generic finite-field model corresponding to the packed single-word GF(2^n) wrapper.

    Equations
    Instances For
      def HexGF2Mathlib.GF2n.toGeneric {n : } {irr : UInt64} {hn : 0 < n} {hn64 : n < 64} {hirr : (Hex.GF2Poly.ofUInt64Monic irr n).Irreducible} (x : Hex.GF2n n irr hn hn64 hirr) :

      Interpret a packed single-word field element inside the generic quotient field model.

      Equations
      Instances For
        def HexGF2Mathlib.GF2n.ofGeneric {n : } {irr : UInt64} {hn : 0 < n} {hn64 : n < 64} {hirr : (Hex.GF2Poly.ofUInt64Monic irr n).Irreducible} (x : GenericFiniteField) :
        Hex.GF2n n irr hn hn64 hirr

        Repack the canonical representative of a generic quotient-field element as a single-word GF(2^n) element.

        Equations
        Instances For
          @[simp]
          theorem HexGF2Mathlib.GF2n.ofGeneric_toGeneric {n : } {irr : UInt64} {hn : 0 < n} {hn64 : n < 64} {hirr : (Hex.GF2Poly.ofUInt64Monic irr n).Irreducible} (x : Hex.GF2n n irr hn hn64 hirr) :

          Embedding a single-word element in the generic model and repacking recovers it: the packed val is already the canonical representative.

          @[simp]
          theorem HexGF2Mathlib.GF2n.toGeneric_ofGeneric {n : } {irr : UInt64} {hn : 0 < n} {hn64 : n < 64} {hirr : (Hex.GF2Poly.ofUInt64Monic irr n).Irreducible} (x : GenericFiniteField) :

          Repacking a generic element and re-embedding recovers it: the round trip loses nothing because both sides store the same reduced residue.

          @[simp]
          theorem HexGF2Mathlib.GF2n.toGeneric_add {n : } {irr : UInt64} {hn : 0 < n} {hn64 : n < 64} {hirr : (Hex.GF2Poly.ofUInt64Monic irr n).Irreducible} (x y : Hex.GF2n n irr hn hn64 hirr) :

          The single-word embedding is additive: packed XOR-then-reduce agrees with addition in the generic quotient field.

          @[simp]
          theorem HexGF2Mathlib.GF2n.toGeneric_mul {n : } {irr : UInt64} {hn : 0 < n} {hn64 : n < 64} {hirr : (Hex.GF2Poly.ofUInt64Monic irr n).Irreducible} (x y : Hex.GF2n n irr hn hn64 hirr) :

          The single-word embedding is multiplicative: the packed carry-less multiply-then-reduce agrees with multiplication in the generic quotient field.

          def HexGF2Mathlib.GF2n.equiv {n : } {irr : UInt64} {hn : 0 < n} {hn64 : n < 64} {hirr : (Hex.GF2Poly.ofUInt64Monic irr n).Irreducible} :
          Hex.GF2n n irr hn hn64 hirr ≃+* GenericFiniteField

          The packed single-word field wrapper is ring-equivalent to the generic finite-field construction over the transported modulus.

          Equations
          Instances For
            def HexGF2Mathlib.GF2n.finEquiv {n : } {irr : UInt64} {hn : 0 < n} {hn64 : n < 64} {hirr : (Hex.GF2Poly.ofUInt64Monic irr n).Irreducible} :
            Hex.GF2n n irr hn hn64 hirr Fin (2 ^ n)

            Single-word packed field elements are indexed by their bounded canonical word representatives.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              @[instance_reducible]
              noncomputable instance HexGF2Mathlib.GF2n.instFintype {n : } {irr : UInt64} {hn : 0 < n} {hn64 : n < 64} {hirr : (Hex.GF2Poly.ofUInt64Monic irr n).Irreducible} :
              Fintype (Hex.GF2n n irr hn hn64 hirr)
              Equations
              theorem HexGF2Mathlib.GF2n.fintype_card {n : } {irr : UInt64} {hn : 0 < n} {hn64 : n < 64} {hirr : (Hex.GF2Poly.ofUInt64Monic irr n).Irreducible} :
              Fintype.card (Hex.GF2n n irr hn hn64 hirr) = 2 ^ n

              A single-word GF(2^n) has 2 ^ n elements, read off the val bound rather than transported across the ring equivalence.

              @[reducible, inline]

              Reduced packed representatives modulo f, isolated from the field wrapper so Mathlib-side finite support can be transported before the final public GF2nPoly cardinality statements are proved.

              Equations
              Instances For

                The executable packed quotient wrapper is exactly the reduced-representative subtype used for finite support.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Encode a reduced packed representative as a bounded binary index.

                  Equations
                  Instances For

                    Decode a bounded binary index into the corresponding reduced packed representative.

                    Equations
                    Instances For
                      @[simp]

                      Decoding a bounded index and re-encoding it returns the index.

                      @[simp]

                      Encoding a reduced representative and decoding it returns the representative.

                      Reduced packed representatives are equivalent to the finite binary index space determined by the modulus degree.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        The packed irreducible modulus viewed inside the generic FpPoly 2 representation.

                        Equations
                        Instances For

                          The generic FpPoly 2 modulus inherits positive degree from the packed modulus, which carries it as the explicit hypothesis hdeg : 0 < f.natDegree.

                          This positivity is not derivable from hirr alone: Hex.GF2Poly.Irreducible (HexGF2/Euclid.lean:57) is f ≠ 0 ∧ ∀ a b, a * b = f → a.natDegree = 0 ∨ b.natDegree = 0, which admits the unit f = 1 (its only factorisations 1 = 1 * 1 have both factors of degree 0), and toFpPoly 1 = 1 has degree 0. Throughout HexGF2, positive degree is taken from a separate hypothesis, never from irreducibility. So the arbitrary-degree wrapper requires 0 < f.natDegree exactly as the single-word GF2n wrapper requires hn : 0 < n above; the toFpPoly transport preserves it via degree?_toFpPoly.

                          Packed irreducibility transports across the GF2Poly ≃+* FpPoly 2 conversion layer.

                          @[reducible, inline]

                          The generic finite-field model corresponding to the packed arbitrary-degree GF(2^n) wrapper.

                          Equations
                          Instances For

                            Interpret a packed quotient-field element inside the generic quotient field model.

                            Equations
                            Instances For

                              Repack the canonical representative of a generic quotient-field element as a packed GF(2^n) residue.

                              Equations
                              Instances For

                                FpPoly.degree of a transported packed polynomial equals its packed degree.

                                Reduction-compatibility bridge. Packed remainder reduction modulo f transports across the GF2Poly ≃+* FpPoly 2 conversion layer to the generic quotient-ring reduction GFqRing.reduceMod. This is the missing transport that lets the GF2nPoly quotient round-trip / add / mul obligations follow from the already-proved packed-level ring equivalence.

                                Equality of generic finite-field elements from equality of canonical representatives.

                                The canonical representative of a packed element embedded into the generic model is simply its packed value, transported to FpPoly 2.

                                @[simp]

                                Embedding a packed residue in the generic model and repacking recovers it: the packed value is already reduced modulo f.

                                @[simp]

                                Repacking a generic element and re-embedding recovers it.

                                @[simp]
                                theorem HexGF2Mathlib.GF2nPoly.toGeneric_add {f : Hex.GF2Poly} {hirr : f.Irreducible} {hdeg : 0 < f.natDegree} (x y : Hex.GF2nPoly f hirr) :

                                The packed-quotient embedding is additive.

                                @[simp]
                                theorem HexGF2Mathlib.GF2nPoly.toGeneric_mul {f : Hex.GF2Poly} {hirr : f.Irreducible} {hdeg : 0 < f.natDegree} (x y : Hex.GF2nPoly f hirr) :

                                The packed-quotient embedding is multiplicative.

                                The packed arbitrary-degree field wrapper is ring-equivalent to the generic finite-field construction over the transported modulus.

                                Equations
                                Instances For

                                  Packed arbitrary-degree field elements are indexed by reduced packed representatives below the modulus degree.

                                  Equations
                                  Instances For

                                    The packed quotient by f has 2 ^ deg f elements, counted through its reduced-representative subtype.