• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
      • Riscv
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
      • Zcash
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • 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
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Montgomery

    Montgomery-sub

    Subtraction of two points of the Montgomery group.

    Signature
    (montgomery-sub point1 point2 curve) → point
    Arguments
    point1 — Guard (pointp point1).
    point2 — Guard (pointp point2).
    curve — Guard (montgomery-curvep curve).
    Returns
    point — Type (pointp point).

    This is, as usual in groups, essentially an abbreviation for adding the first point to the negation of the second point.

    Definitions and Theorems

    Function: montgomery-sub

    (defun montgomery-sub (point1 point2 curve)
     (declare (xargs :guard (and (pointp point1)
                                 (pointp point2)
                                 (montgomery-curvep curve))))
     (declare (xargs :guard (and (point-on-montgomery-p point1 curve)
                                 (point-on-montgomery-p point2 curve))))
     (let ((acl2::__function__ 'montgomery-sub))
       (declare (ignorable acl2::__function__))
       (montgomery-add point1 (montgomery-neg point2 curve)
                       curve)))

    Theorem: pointp-of-montgomery-sub

    (defthm pointp-of-montgomery-sub
      (b* ((point (montgomery-sub point1 point2 curve)))
        (pointp point))
      :rule-classes :rewrite)

    Theorem: montgomery-sub-of-point-fix-point1

    (defthm montgomery-sub-of-point-fix-point1
      (equal (montgomery-sub (point-fix point1)
                             point2 curve)
             (montgomery-sub point1 point2 curve)))

    Theorem: montgomery-sub-point-equiv-congruence-on-point1

    (defthm montgomery-sub-point-equiv-congruence-on-point1
      (implies (point-equiv point1 point1-equiv)
               (equal (montgomery-sub point1 point2 curve)
                      (montgomery-sub point1-equiv point2 curve)))
      :rule-classes :congruence)

    Theorem: montgomery-sub-of-point-fix-point2

    (defthm montgomery-sub-of-point-fix-point2
      (equal (montgomery-sub point1 (point-fix point2)
                             curve)
             (montgomery-sub point1 point2 curve)))

    Theorem: montgomery-sub-point-equiv-congruence-on-point2

    (defthm montgomery-sub-point-equiv-congruence-on-point2
      (implies (point-equiv point2 point2-equiv)
               (equal (montgomery-sub point1 point2 curve)
                      (montgomery-sub point1 point2-equiv curve)))
      :rule-classes :congruence)

    Theorem: montgomery-sub-of-montgomery-curve-fix-curve

    (defthm montgomery-sub-of-montgomery-curve-fix-curve
      (equal (montgomery-sub point1
                             point2 (montgomery-curve-fix curve))
             (montgomery-sub point1 point2 curve)))

    Theorem: montgomery-sub-montgomery-curve-equiv-congruence-on-curve

    (defthm montgomery-sub-montgomery-curve-equiv-congruence-on-curve
      (implies (montgomery-curve-equiv curve curve-equiv)
               (equal (montgomery-sub point1 point2 curve)
                      (montgomery-sub point1 point2 curve-equiv)))
      :rule-classes :congruence)