Documentation

HexModArithMathlib.ZMod64Equiv

Interpret an executable Hex.ZMod64 residue as a Mathlib ZMod class.

Equations
Instances For

    Rebuild an executable Hex.ZMod64 residue from a Mathlib ZMod class.

    Equations
    Instances For
      @[simp]

      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.

      @[simp]

      Round-trip Hex.ZMod64ZModHex.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.

      @[simp]

      Round-trip ZModHex.ZMod64ZMod is the identity. Together with HexModArithMathlib.ZMod64.ofZMod_toZMod, this shows the two conversions are mutually inverse and define a ring equivalence.

      @[simp]

      ofZMod carries Mathlib's 0 to the executable 0, so transferring the additive identity in from ZMod lands on ZMod64's identity.

      @[simp]

      toZMod carries the executable 0 to Mathlib's 0, so the additive identity transfers out to ZMod's identity.

      @[simp]

      toZMod carries the executable 1 to Mathlib's 1, so the multiplicative identity transfers out to ZMod's identity.

      @[simp]

      ofZMod carries Mathlib's 1 to the executable 1, so the multiplicative identity transfers in from ZMod to ZMod64.

      @[simp]

      HexModArithMathlib.ZMod64.toZMod is additive, so callers can push the conversion through a sum and transfer additive ZMod identities back to Hex.ZMod64.

      @[simp]

      toZMod commutes with negation, so additive inverses transfer out to ZMod.

      @[simp]

      toZMod commutes with subtraction, so differences transfer out to ZMod.

      @[simp]

      HexModArithMathlib.ZMod64.toZMod is multiplicative, so callers can push the conversion through a product and transfer multiplicative ZMod identities back to Hex.ZMod64.

      @[simp]

      toZMod commutes with the Nat cast: a numeral built in ZMod64 transfers to the same numeral in ZMod. Lets callers move Nat-literal coefficients across the correspondence.

      @[simp]

      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.

      @[simp]

      toZMod commutes with Nat powers, so exponentiation transfers out to ZMod.

      The executable Hex.ZMod64 representation is ring-equivalent to Mathlib's ZMod.

      Equations
      Instances For
        @[simp]

        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.

        @[simp]

        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.