Executable finite-field elements are a thin wrapper around quotient-ring residues modulo an irreducible polynomial.
- toQuotient : GFqRing.PolyQuotient f hf
The underlying reduced quotient-ring residue backing this field element.
GFqRing.PolyQuotientis a prime-modulus type, and the witness it needs is the_hpthis structure already carries. Deriving the instance here rather than demanding it from callers keepsFiniteField's signature unchanged;ZMod64.PrimeModulusis aProp-valued class, so this instance and any ambient one are definitionally equal.
Instances For
Field equality is decidable, and decided by comparing canonical representatives: elements are wrappers around reduced quotient values, so equality of the wrapped values is equality of the elements.
Equations
- Hex.GFqField.instDecidableEqFiniteField x y = match decEq x.toQuotient y.toQuotient with | isTrue h => isTrue ⋯ | isFalse h => isFalse ⋯
Wrap a quotient-ring element as a finite-field element.
Equations
- Hex.GFqField.ofQuotient x = { toQuotient := x }
Instances For
Reduce a polynomial into the finite field by reusing the quotient-ring constructor.
The prime-modulus instance the quotient needs is derived from this
constructor's own hp, so callers holding only a primality proof do not have to
supply it a second time.
Equations
- Hex.GFqField.ofPoly f hf hp hirr g = Hex.GFqField.ofQuotient (Hex.GFqRing.ofPoly f hf g)
Instances For
Project a finite-field element to its canonical polynomial representative.
Equations
Instances For
Projecting a wrapped quotient element returns the original quotient.
Reducing a polynomial into the field projects to the quotient-ring reduction.
A wrapped quotient exposes the same canonical polynomial representative.
Rewrapping a field element through its quotient projection is the identity.
The representative of a polynomial coerced into the field is its reduced form.
Canonical field representatives are reduced below the modulus degree.
Equality of field elements is equality of their quotient representatives.
Extensionality through quotient representatives.