• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
        • Yul
        • Zcash
        • ACL2-programming-language
        • Prime-fields
        • Json
        • Syntheto
        • File-io-light
        • Cryptography
          • R1cs
          • Interfaces
          • Sha-2
          • Keccak
          • Kdf
          • Mimc
          • Padding
          • Hmac
          • Elliptic-curves
            • Secp256k1-attachment
            • Twisted-edwards
            • Montgomery
              • Montgomery-mul
              • Montgomery-add
              • Montgomery-point-orderp
                • Montgomery-add-commutativity
                • Montgomery-mul-distributivity-over-scalar-addition
                • Montgomery-add-associativity
                • Birational-montgomery-twisted-edwards
                • Montgomery-curve
                • Montgomery-mul-nonneg
                • Montgomery-not-point-with-x-minus1-when-a-minus-2-over-b-not-square
                • Point-on-montgomery-p
                • Montgomery-neg
                • Montgomery-sub
                • Montgomery-add-closure
                • Montgomery-only-point-with-y-0-when-aa-minus-4-non-square
                • Montgomery-point-order-leastp
                • Montgomery-distinct-x-when-nonzero-mul-in-order-range
                • Montgomery-add-inverse-uniqueness
                • Montgomery-distributivity-of-neg-over-add
                • Montgomery-mul-associativity
                • Montgomery-points-with-same-x-have-same-or-neg-y
                • Montgomery-zero
                • Montgomery-points-with-same-x-are-same-or-neg-point
                • Montgomery-mul-of-mod-order
                • Montgomery-neg-inverse
                • Montgomery-zero-identity
                • Point-on-montgomery-finite-when-not-zero
              • Short-weierstrass-curves
              • Birational-montgomery-twisted-edwards
              • Has-square-root?-satisfies-pfield-squarep
              • Secp256k1
              • Secp256k1-domain-parameters
              • Secp256k1-types
              • Pfield-squarep
              • Secp256k1-interface
              • Prime-field-extra-rules
              • Points
            • Attachments
            • Elliptic-curve-digital-signature-algorithm
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Montgomery

    Montgomery-point-orderp

    Check if a point on a Montgomery curve has a certain order.

    Signature
    (montgomery-point-orderp point order curve) → yes/no
    Arguments
    point — Guard (pointp point).
    order — Guard (natp order).
    curve — Guard (montgomery-curvep curve).
    Returns
    yes/no — Type (booleanp yes/no).

    A point P has order n if and only if n > 0, n P is the neutral element, and m P is not the neutral element for every 0 < m < n.

    Every point on the curve has an order, so there should really be a function that returns that. However, defining that function requires some theorems that we do not have yet; thus, for now we define this predicate instead. We plan to define the function that returns the order eventually.

    Definitions and Theorems

    Theorem: montgomery-point-order-leastp-necc

    (defthm montgomery-point-order-leastp-necc
     (implies
       (montgomery-point-order-leastp point order curve)
       (implies (and (natp order1)
                     (< 0 order1)
                     (< order1 (nfix order)))
                (b* ((order1*point (montgomery-mul order1 point curve)))
                  (not (equal order1*point (montgomery-zero)))))))

    Theorem: booleanp-of-montgomery-point-order-leastp

    (defthm booleanp-of-montgomery-point-order-leastp
      (b* ((bool (montgomery-point-order-leastp point order curve)))
        (booleanp bool))
      :rule-classes :type-prescription)

    Theorem: montgomery-point-order-leastp-of-point-fix-point

    (defthm montgomery-point-order-leastp-of-point-fix-point
      (equal (montgomery-point-order-leastp (point-fix point)
                                            order curve)
             (montgomery-point-order-leastp point order curve)))

    Theorem: montgomery-point-order-leastp-point-equiv-congruence-on-point

    (defthm
          montgomery-point-order-leastp-point-equiv-congruence-on-point
     (implies
        (point-equiv point point-equiv)
        (equal (montgomery-point-order-leastp point order curve)
               (montgomery-point-order-leastp point-equiv order curve)))
     :rule-classes :congruence)

    Theorem: montgomery-point-order-leastp-of-nfix-order

    (defthm montgomery-point-order-leastp-of-nfix-order
      (equal (montgomery-point-order-leastp point (nfix order)
                                            curve)
             (montgomery-point-order-leastp point order curve)))

    Theorem: montgomery-point-order-leastp-nat-equiv-congruence-on-order

    (defthm montgomery-point-order-leastp-nat-equiv-congruence-on-order
     (implies
        (nat-equiv order order-equiv)
        (equal (montgomery-point-order-leastp point order curve)
               (montgomery-point-order-leastp point order-equiv curve)))
     :rule-classes :congruence)

    Theorem: montgomery-point-order-leastp-of-montgomery-curve-fix-curve

    (defthm montgomery-point-order-leastp-of-montgomery-curve-fix-curve
     (equal
      (montgomery-point-order-leastp point
                                     order (montgomery-curve-fix curve))
      (montgomery-point-order-leastp point order curve)))

    Theorem: montgomery-point-order-leastp-montgomery-curve-equiv-congruence-on-curve

    (defthm
     montgomery-point-order-leastp-montgomery-curve-equiv-congruence-on-curve
     (implies
        (montgomery-curve-equiv curve curve-equiv)
        (equal (montgomery-point-order-leastp point order curve)
               (montgomery-point-order-leastp point order curve-equiv)))
     :rule-classes :congruence)

    Function: montgomery-point-orderp

    (defun montgomery-point-orderp (point order curve)
      (declare (xargs :guard (and (pointp point)
                                  (natp order)
                                  (montgomery-curvep curve))))
      (declare (xargs :guard (point-on-montgomery-p point curve)))
      (let ((acl2::__function__ 'montgomery-point-orderp))
        (declare (ignorable acl2::__function__))
        (b* ((order (nfix order))
             (order*point (montgomery-mul order point curve)))
          (and (> order 0)
               (equal order*point (montgomery-zero))
               (montgomery-point-order-leastp point order curve)))))

    Theorem: booleanp-of-montgomery-point-orderp

    (defthm booleanp-of-montgomery-point-orderp
      (b* ((yes/no (montgomery-point-orderp point order curve)))
        (booleanp yes/no))
      :rule-classes :rewrite)

    Theorem: montgomery-point-orderp-of-point-fix-point

    (defthm montgomery-point-orderp-of-point-fix-point
      (equal (montgomery-point-orderp (point-fix point)
                                      order curve)
             (montgomery-point-orderp point order curve)))

    Theorem: montgomery-point-orderp-point-equiv-congruence-on-point

    (defthm montgomery-point-orderp-point-equiv-congruence-on-point
     (implies (point-equiv point point-equiv)
              (equal (montgomery-point-orderp point order curve)
                     (montgomery-point-orderp point-equiv order curve)))
     :rule-classes :congruence)

    Theorem: montgomery-point-orderp-of-nfix-order

    (defthm montgomery-point-orderp-of-nfix-order
      (equal (montgomery-point-orderp point (nfix order)
                                      curve)
             (montgomery-point-orderp point order curve)))

    Theorem: montgomery-point-orderp-nat-equiv-congruence-on-order

    (defthm montgomery-point-orderp-nat-equiv-congruence-on-order
     (implies (nat-equiv order order-equiv)
              (equal (montgomery-point-orderp point order curve)
                     (montgomery-point-orderp point order-equiv curve)))
     :rule-classes :congruence)

    Theorem: montgomery-point-orderp-of-montgomery-curve-fix-curve

    (defthm montgomery-point-orderp-of-montgomery-curve-fix-curve
     (equal (montgomery-point-orderp point
                                     order (montgomery-curve-fix curve))
            (montgomery-point-orderp point order curve)))

    Theorem: montgomery-point-orderp-montgomery-curve-equiv-congruence-on-curve

    (defthm
     montgomery-point-orderp-montgomery-curve-equiv-congruence-on-curve
     (implies (montgomery-curve-equiv curve curve-equiv)
              (equal (montgomery-point-orderp point order curve)
                     (montgomery-point-orderp point order curve-equiv)))
     :rule-classes :congruence)