• 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-curve-fix
                • Montgomery-curve-equiv
                • Make-montgomery-curve
                  • Montgomery-curvep
                  • Change-montgomery-curve
                  • Montgomery-curve->b
                  • Montgomery-curve->a
                  • Montgomery-curve->p
                • 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-curve

    Make-montgomery-curve

    Basic constructor macro for montgomery-curve structures.

    Syntax
    (make-montgomery-curve [:p <p>] 
                           [:a <a>] 
                           [:b <b>]) 
    

    This is the usual way to construct montgomery-curve structures. It simply conses together a structure with the specified fields.

    This macro generates a new montgomery-curve structure from scratch. See also change-montgomery-curve, which can "change" an existing structure, instead.

    Definition

    This is an ordinary make- macro introduced by fty::defprod.

    Macro: make-montgomery-curve

    (defmacro make-montgomery-curve (&rest args)
      (std::make-aggregate 'montgomery-curve
                           args '((:p) (:a) (:b))
                           'make-montgomery-curve
                           nil))

    Function: montgomery-curve

    (defun montgomery-curve (p a b)
      (declare (xargs :guard (and (dm::primep p)
                                  (> p 2)
                                  (fep a p)
                                  (fep b p)
                                  (not (equal a 2))
                                  (not (equal a (mod -2 p)))
                                  (not (equal b 0)))))
      (let ((acl2::__function__ 'montgomery-curve))
        (declare (ignorable acl2::__function__))
        (let ((p (mbe :logic (if (and (dm::primep p) (> p 2)) p 3)
                      :exec p))
              (a (mbe :logic
                      (if (and (dm::primep p)
                               (> p 2)
                               (fep a p)
                               (not (equal a 2))
                               (not (equal a (mod -2 p))))
                          a
                        0)
                      :exec a))
              (b (mbe :logic
                      (if (and (dm::primep p)
                               (fep b p)
                               (not (equal b 0)))
                          b
                        1)
                      :exec b)))
          (list (cons 'p p)
                (cons 'a a)
                (cons 'b b)))))