Documentation

HexArith.Montgomery.InvNat

One Newton/Hensel refinement step for the positive Montgomery inverse.

Equations
Instances For

    Starting from the odd-modulus seed x = p, five refinement steps lift the inverse from mod 2^3 to mod 2^96 ≥ 2^64.

    Equations
    Instances For
      def montInv (p : UInt64) :

      The user-facing Montgomery inverse is the negated positive inverse.

      Equations
      Instances For
        theorem montPosInv_spec (p : UInt64) (hp_odd : p.toNat % 2 = 1) :

        The positive Montgomery inverse satisfies p * x ≡ 1 (mod 2^64).

        theorem montInv_spec (p : UInt64) (hp_odd : p.toNat % 2 = 1) :

        The negated Montgomery inverse satisfies p * p' ≡ -1 (mod 2^64).