Natural-number literals reuse the quotient-ring cast and then rewrap the resulting reduced residue.
Equations
- Hex.GFqField.natCast f hf hp hirr n = Hex.GFqField.ofQuotient ↑n
Instances For
The additive identity in the finite-field wrapper.
Equations
- Hex.GFqField.zero f hf hp hirr = Hex.GFqField.ofQuotient 0
Instances For
The multiplicative identity in the finite-field wrapper.
Equations
- Hex.GFqField.one f hf hp hirr = Hex.GFqField.ofQuotient 1
Instances For
Field addition reuses the quotient-ring sum.
Equations
Instances For
Field multiplication reuses the quotient-ring product.
Equations
Instances For
Field negation reuses the quotient-ring additive inverse.
Equations
Instances For
Field subtraction reuses the quotient-ring difference.
Equations
Instances For
Exponentiation reuses the quotient-ring repeated-multiplication path.
Equations
- Hex.GFqField.pow x n = Hex.GFqField.ofQuotient (x.toQuotient ^ n)
Instances For
Natural scalar multiplication reuses the quotient-ring scalar action.
Equations
- Hex.GFqField.nsmul n x = Hex.GFqField.ofQuotient (n • x.toQuotient)
Instances For
Integer literals reuse the quotient-ring cast and then rewrap the reduced residue.
Equations
- Hex.GFqField.intCast f hf hp hirr i = Hex.GFqField.ofQuotient ↑i
Instances For
Integer scalar multiplication reuses the quotient-ring scalar action.
Equations
- Hex.GFqField.zsmul i x = Hex.GFqField.ofQuotient (i • x.toQuotient)
Instances For
The inverse polynomial representative for a quotient element.
This normalizes the extended-GCD left coefficient by the gcd's constant-unit factor, producing a polynomial whose residue is the multiplicative inverse whenever the quotient element is nonzero.
At zero this is not an inverse and does not claim to be: the extended GCD of 0
and f returns f itself, so the result is f scaled by the inverse of its own
constant coefficient. It stays public because inv is @[expose] and mentions
it, but inv decides the zero case before reaching it, and callers should
reason through the field-level lemmas below rather than by unfolding this.
Equations
- Hex.GFqField.invPoly x = Hex.DensePoly.scale ((Hex.DensePoly.xgcd (Hex.GFqRing.repr x) f).gcd.coeff 0)⁻¹ (Hex.DensePoly.xgcd (Hex.GFqRing.repr x) f).left
Instances For
Field inversion stays on the quotient-reduction path by reusing the
polynomial extended-GCD witness, normalized by the gcd's constant unit factor.
The 0 case follows the usual junk-value convention required by
Lean.Grind.Field.
Equations
- Hex.GFqField.inv x = if _hx : x = Hex.GFqField.zero f hf hp hirr then Hex.GFqField.zero f hf hp hirr else Hex.GFqField.ofPoly f hf hp hirr (Hex.GFqField.invPoly x.toQuotient)
Instances For
Division is multiplication by the inverse candidate.
Equations
- Hex.GFqField.div x y = Hex.GFqField.mul x (Hex.GFqField.inv y)
Instances For
Integer exponentiation uses the existing natural-power path together with the inverse candidate for negative exponents.
Equations
- Hex.GFqField.zpow x (Int.ofNat n) = Hex.GFqField.pow x n
- Hex.GFqField.zpow x (Int.negSucc n) = Hex.GFqField.inv (Hex.GFqField.pow x (n + 1))
Instances For
The Frobenius map is the p-th power map on the existing quotient
representation.
Equations
Instances For
Field-wrapper zero is backed by the quotient-ring zero.
Equations
- Hex.GFqField.instZeroFiniteField = { zero := Hex.GFqField.zero f hf hp hirr }
Field-wrapper one is backed by the quotient-ring one.
Equations
- Hex.GFqField.instOneFiniteField = { one := Hex.GFqField.one f hf hp hirr }
Field-wrapper addition delegates to quotient-ring addition.
Equations
Field-wrapper multiplication delegates to quotient-ring multiplication.
Equations
Field-wrapper negation delegates to quotient-ring negation.
Equations
Field-wrapper subtraction delegates to quotient-ring subtraction.
Equations
Natural powers use the quotient-ring square-and-multiply path.
Equations
Natural literals are quotient-ring natural literals rewrapped as field elements.
Equations
- Hex.GFqField.instNatCastFiniteField = { natCast := Hex.GFqField.natCast f hf hp hirr }
OfNat literals use the field wrapper's natural-literal implementation.
Equations
- Hex.GFqField.instOfNatFiniteField n = { ofNat := Hex.GFqField.natCast f hf hp hirr n }
Natural scalar multiplication delegates to quotient-ring scalar multiplication.
Equations
Integer literals are quotient-ring integer literals rewrapped as field elements.
Equations
- Hex.GFqField.instIntCastFiniteField = { intCast := Hex.GFqField.intCast f hf hp hirr }
Integer scalar multiplication delegates to quotient-ring scalar multiplication.
Equations
Field inversion uses the wrapper's extended-GCD inverse.
Equations
Field division is the wrapper's multiplication-by-inverse operation.
Equations
Integer powers use natural powers for nonnegative exponents and inversion for negative ones.
Equations
Zero projects to the quotient-ring zero.
One projects to the quotient-ring one.
The quotient-field wrapper is nontrivial.
Natural literals project to quotient-ring natural literals.
The representative of a natural literal is the reduced constant polynomial.
Equal ZMod64 residues give equal natural literals in the field wrapper.
Equal residues modulo p give equal natural literals in the field wrapper.
Equality of natural literals is equivalent to equality of their reduced constants.
Equality of natural literals is equivalent to congruence modulo p.
Addition projects to quotient-ring addition.
Multiplication projects to quotient-ring multiplication.
Negation projects to the quotient-ring additive inverse.
Subtraction projects to the quotient-ring difference.
Natural scalar multiplication projects to the quotient-ring scalar action.
Integer literals project to quotient-ring integer literals.
Integer scalar multiplication projects to the quotient-ring scalar action.
Natural powers project to quotient-ring natural powers.
Division projects to multiplication by the projected inverse.
Nonnegative integer powers project to quotient-ring natural powers.
Negative integer powers project through inversion of the positive power.
The field inverse uses the standard junk value at zero.
Division is field multiplication by inverse.
A nonzero field element cancels against its inverse on the right.
A nonzero field element cancels against its inverse on the left.
The additive-identity representative is the reduced form of 0.
The multiplicative-identity representative is the reduced form of 1.
The representative of a sum is the reduced sum of representatives.
The representative of a product is the reduced product of representatives.
The representative of a negation reduces from the negated representative.
The representative of a subtraction reduces from the difference of representatives.
The representative of a natural power is the quotient-ring power representative.
The representative of a quotient is the quotient-ring product with the projected inverse.
Nonnegative integer powers share the natural-power representative.
Negative integer powers represent the inverse of the corresponding positive power.
The representative of an integer cast lifts the quotient-ring cast.
The representative of a natural scalar action lifts the quotient-ring action.
The representative of an integer scalar action lifts the quotient-ring action.
Semiring laws for finite-field elements, transported from the quotient ring.
Equations
- One or more equations did not get rendered due to their size.
Ring laws for finite-field elements, transported from the quotient ring.
Equations
- One or more equations did not get rendered due to their size.
Commutative multiplication for finite-field elements, inherited from the quotient ring.
Equations
- Hex.GFqField.instCommRingFiniteField = { toRing := Hex.GFqField.instRingFiniteField, mul_comm := ⋯ }
The inverse of 1 is 1, since 1 * 1 = 1; a normalization step in the
field-structure proofs.
Double inverse is the identity: x⁻¹⁻¹ = x; obtained from inverse uniqueness
via the cancellation x⁻¹ * x = 1, with the zero case handled separately.
Double inverse stated through the inv-named function: (inv x)⁻¹ = x; the
form consumed where the explicit inv definition appears rather than the ⁻¹
notation.
The empty product pow x 0 = 1; the base case anchoring the exponentiation
recursion in the FiniteField power API.
Field laws for finite-field elements, using the field-level inverse lemmas.
Equations
- One or more equations did not get rendered due to their size.
Characteristic-p automation for natural literals in the finite field.
Frobenius is definitionally the p-th power map.
Frobenius projects to the quotient-ring p-th power.
The representative of Frobenius is the quotient-ring p-th power representative.