The canonical representative of a transferred class is the executable residue's
Nat value: (toZMod a).val = a.toNat. Callers reading the Mathlib-side val of a
transferred element recover the machine residue without unfolding the conversion.
Round-trip Hex.ZMod64 → ZMod →
Hex.ZMod64 is the identity. This is the left-inverse law making
HexModArithMathlib.ZMod64.toZMod injective; a caller that transfers a
residue to Mathlib and back recovers it unchanged.
Round-trip ZMod → Hex.ZMod64 →
ZMod is the identity. Together with
HexModArithMathlib.ZMod64.ofZMod_toZMod, this shows the two conversions
are mutually inverse and define a ring equivalence.
HexModArithMathlib.ZMod64.toZMod is additive, so callers can push
the conversion through a sum and transfer additive
ZMod identities back to Hex.ZMod64.
toZMod commutes with negation, so additive inverses transfer out to ZMod.
toZMod commutes with subtraction, so differences transfer out to ZMod.
HexModArithMathlib.ZMod64.toZMod is multiplicative, so callers can
push the conversion through a product and transfer multiplicative
ZMod identities back to Hex.ZMod64.
toZMod commutes with the Int cast: an integer built in ZMod64 transfers to the
same integer in ZMod. Lets callers move signed integer coefficients across the correspondence.
toZMod commutes with Nat powers, so exponentiation transfers out to ZMod.
The executable Hex.ZMod64 representation is ring-equivalent to
Mathlib's ZMod.
Equations
- HexModArithMathlib.ZMod64.equiv = { toFun := HexModArithMathlib.ZMod64.toZMod, invFun := HexModArithMathlib.ZMod64.ofZMod, left_inv := ⋯, right_inv := ⋯, map_mul' := ⋯, map_add' := ⋯ }
Instances For
equiv acts as toZMod on elements. Rewrites the bundled ring equivalence to the
bare conversion, so the transport @[simp] lemmas above fire on equiv applications.
equiv.symm acts as ofZMod on elements. Rewrites the inverse ring equivalence to
the bare conversion, so the transport @[simp] lemmas above fire on equiv.symm
applications.