The quotient zero element.
Equations
- Hex.GFqRing.zero f hf = Hex.GFqRing.ofPoly f hf 0
Instances For
The quotient one element.
Equations
- Hex.GFqRing.one f hf = Hex.GFqRing.ofPoly f hf 1
Instances For
Embed a prime-field constant as a quotient-ring constant polynomial.
Equations
- Hex.GFqRing.const f hf c = Hex.GFqRing.ofPoly f hf (Hex.FpPoly.C c)
Instances For
Quotient addition reduces the sum of representatives.
Equations
- Hex.GFqRing.add x y = Hex.GFqRing.ofPoly f hf (Hex.GFqRing.repr x + Hex.GFqRing.repr y)
Instances For
Quotient multiplication reduces the product of representatives.
Equations
- Hex.GFqRing.mul x y = Hex.GFqRing.ofPoly f hf ((Hex.GFqRing.repr x).mulPackedFast (Hex.GFqRing.repr y))
Instances For
Quotient negation reduces the coefficientwise additive inverse.
Equations
- Hex.GFqRing.neg x = Hex.GFqRing.ofPoly f hf (-Hex.GFqRing.repr x)
Instances For
Quotient subtraction reduces the difference of representatives.
Equations
- Hex.GFqRing.sub x y = Hex.GFqRing.ofPoly f hf (Hex.GFqRing.repr x - Hex.GFqRing.repr y)
Instances For
Quotient exponentiation by square-and-multiply on the exponent bits, costing
O(log n) quotient-ring multiplications.
Equations
- Hex.GFqRing.pow x n = Hex.GFqRing.pow.go (Hex.GFqRing.one f hf) x n
Instances For
Equations
- Hex.GFqRing.pow.go acc base k = if hk : k = 0 then acc else have acc' := if k % 2 = 1 then Hex.GFqRing.mul acc base else acc; Hex.GFqRing.pow.go acc' (Hex.GFqRing.mul base base) (k / 2)
Instances For
Natural-number literals in the quotient ring are reduced constant polynomials.
Equations
- Hex.GFqRing.natCast f hf n = Hex.GFqRing.const f hf ↑n
Instances For
Natural scalar multiplication in the quotient ring.
Equations
- Hex.GFqRing.nsmul n x = Hex.GFqRing.nsmul.go (Hex.GFqRing.zero f hf) x n
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Integer literals in the quotient ring.
Equations
- Hex.GFqRing.intCast f hf (Int.ofNat n) = Hex.GFqRing.natCast f hf n
- Hex.GFqRing.intCast f hf (Int.negSucc n) = Hex.GFqRing.neg (Hex.GFqRing.natCast f hf (n + 1))
Instances For
Integer scalar multiplication in the quotient ring.
Equations
- Hex.GFqRing.zsmul (Int.ofNat n) x = Hex.GFqRing.nsmul n x
- Hex.GFqRing.zsmul (Int.negSucc n) x = Hex.GFqRing.neg (Hex.GFqRing.nsmul (n + 1) x)
Instances For
Equations
- Hex.GFqRing.instZeroPolyQuotient = { zero := Hex.GFqRing.zero f hf }
Equations
- Hex.GFqRing.instOnePolyQuotient = { one := Hex.GFqRing.one f hf }
Equations
Equations
Equations
Equations
Equations
Equations
- Hex.GFqRing.instNatCastPolyQuotient = { natCast := Hex.GFqRing.natCast f hf }
Equations
- Hex.GFqRing.instOfNatPolyQuotient n = { ofNat := Hex.GFqRing.natCast f hf n }
Equations
Equations
- Hex.GFqRing.instIntCastPolyQuotient = { intCast := Hex.GFqRing.intCast f hf }
Equations
The canonical representative of the quotient zero is the reduction of 0.
The multiplicative-identity representative is the reduction of 1.
The canonical representative of a constant quotient element is the reduction of C c.
Modulo any nonconstant polynomial, the zero and one quotient elements are distinct.
natCast unfolds to the corresponding constant quotient element.
The canonical representative of natCast n is the reduction of C (n : ZMod64 p).
Two natural-number casts coincide in the quotient ring whenever their prime-field casts do.
Two natural-number casts coincide in the quotient ring whenever they agree modulo p.
Equality of natural-number casts is equivalent to equality of the underlying reduced
constant polynomials. Internal stepping stone toward natCast_eq_natCast_iff_mod_eq; the forward
direction projects quotient-level natCast equality to reduceMod-level equality.
Equality of natural-number casts in the quotient ring is exactly equality modulo p.
This is the user-facing iff form (consumed for example by Lean.Grind.IsCharP on the field
layer); the reverse direction reduces to natCast_eq_of_mod_eq.
The canonical representative of a sum reduces the sum of representatives.
The canonical representative of a product reduces the product of representatives.
The canonical representative of a negation reduces the negation of the representative.
The canonical representative of a difference reduces the difference of representatives.
Quotient exponentiation via the Pow instance agrees with the internal pow definition.
Proof-only linear recurrence x^(n+1) = x^n * x, used to discharge the
pow_zero / pow_succ fields of the Lean.Grind.Semiring instance. The
executable pow is square-and-multiply (O(log n)); pow_eq_linearPow ties
the two together.
Equations
- Hex.GFqRing.linearPow x 0 = 1
- Hex.GFqRing.linearPow x n.succ = Hex.GFqRing.linearPow x n * x
Instances For
ofPoly applied to the zero polynomial yields the canonical zero quotient element.
ofPoly applied to the one polynomial yields the canonical one quotient element.
ofPoly applied to a constant polynomial agrees with const.
The representative of a negated constructed quotient element is the canonical reduction of the negated canonical representative.
The representative of a difference of constructed quotient elements is the canonical reduction of the difference of their canonical representatives.
Representative-level commutativity of addition used by quotient additive reasoning.
Representative-level left zero multiplication used by the quotient semiring instance.
Representative-level right zero multiplication used by the quotient semiring instance.
Representative-level commutativity of multiplication used by the quotient commutative ring instance.
The OfNat literal at n + 1 decomposes as the OfNat literal at n plus one in the
quotient ring. Witnesses the Lean.Grind.Semiring.natCast_succ axiom field.
Integer cast of a non-negative integer unfolds to the corresponding natCast.
Integer cast of -(n + 1) is the negation of the (n + 1) natural-number cast.
Canonical representative of intCast (Int.negSucc n) is the reduction of the negation of the
reduced C (n + 1 : ZMod64 p). The double reduceMod is the projection of the negation of the
canonical natCast representative.
Integer scalar multiplication by a non-negative integer unfolds to natural scalar multiplication.
Integer scalar multiplication by -(n + 1) is the negation of the (n + 1) natural scalar
multiplication.
Canonical representative of zsmul (Int.ofNat n) x reduces to the nsmul-level
representative.
Canonical representative of zsmul (Int.negSucc n) x is the reduction of the negation of the
(n + 1) natural scalar multiplication's representative.
Negation of the quotient zero is the quotient zero. Used by neg_zsmul_eq and
intCast_neg_eq (the Lean.Grind.Ring.neg_zsmul / intCast_neg axiom witnesses) for the
boundary n = 0 case.
Public alias for reduceMod_mul_reduceMod_congr: reducing both factors before quotient
reduction preserves the canonical representative.
The canonical representative of a quotient element is already reduced.
The representative of a sum of constructed quotient elements is the
canonical reduction of the unreduced polynomial sum. This is the simp normal form
for addition through ofPoly.
The representative of a product of constructed quotient elements is the
canonical reduction of the unreduced polynomial product. This is the simp normal
form for multiplication through ofPoly.
Representative-level left-zero law used to build the quotient Lean.Grind.Semiring.
Representative-level right-zero law used to build the quotient Lean.Grind.Semiring.
Representative-level associativity of addition used to build the quotient Lean.Grind.Semiring.
Representative-level left identity law for multiplication used by the quotient semiring instance.
Representative-level right identity law for multiplication used by the quotient semiring instance.
Representative-level associativity of multiplication used to build the quotient Lean.Grind.Semiring.
Representative-level left distributivity used to build the quotient Lean.Grind.Semiring.
Representative-level right distributivity used to build the quotient Lean.Grind.Semiring.
Representative-level left inverse law used to build the quotient Lean.Grind.Ring.
Quotient-level subtraction law used directly by the Lean.Grind.Ring instance.
Unfolded base of the nsmul recurrence: zero scalar multiplication yields the quotient zero.
The implementation nsmul.go runs binary decomposition (via linearNSmul); this lemma exposes
the textbook recurrence shape that Lean.Grind.Semiring's nsmul_zero axiom field consumes.
Unfolded step of the nsmul recurrence. This is a theorem about the projected behaviour, not
the implementation strategy: nsmul.go uses binary decomposition (via linearNSmul_double /
linearNSmul_double_add_one) instead of textbook n+1 ↦ pred + 1 recursion.
Consumed by Lean.Grind.Semiring's nsmul_succ axiom field.
Canonical representative of nsmul 0 x is the reduction of 0.
Canonical representative of nsmul (n + 1) x is the reduction of the sum of the previous
nsmul's representative and repr x.
Natural scalar multiplication agrees with multiplication by the corresponding natCast.
Witnesses the Lean.Grind.Semiring.nsmul_eq_natCast_mul axiom field.
Double negation in the quotient ring is the identity. Proved by the textbook additive-group
calculation -(-x) = -(-x) + (-x + x) = (-(-x) + -x) + x = 0 + x = x. Used by neg_zsmul_eq
and intCast_neg_eq for the Int.negSucc case.
Negation distributes over integer scalar multiplication. Witnesses the
Lean.Grind.Ring.neg_zsmul axiom field. The three branches handle i = Int.ofNat 0,
i = Int.ofNat (n + 1), and i = Int.negSucc n separately because Int.neg evaluates
differently on each.
Negation distributes over integer cast. Witnesses the Lean.Grind.Ring.intCast_neg axiom
field. Three branches mirror neg_zsmul_eq.
The executable square-and-multiply pow returns the same element as the
proof-only linear recurrence linearPow. The Lean.Grind.Semiring instance
rewrites by this equality to discharge its pow_succ field.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Hex.GFqRing.instCommRingPolyQuotient = { toRing := Hex.GFqRing.instRingPolyQuotient, mul_comm := ⋯ }