• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Community
    • 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
            • Short-weierstrass-curves
            • Birational-montgomery-twisted-edwards
            • Has-square-root?-satisfies-pfield-squarep
            • Secp256k1
            • Secp256k1-domain-parameters
            • Secp256k1-types
              • Secp256k1-priv-key
              • Secp256k1-pub-key
              • Secp256k1-field
              • Secp256k1-point
                • Secp256k1-point-fix
                  • Secp256k1-point-equiv
                  • Make-secp256k1-point
                  • Secp256k1-point->y
                  • Secp256k1-point->x
                  • Change-secp256k1-point
                  • Secp256k1-pointp
                • Secp256k1-point-to-bytes
                • Secp256k1-point-infinityp
                • Secp256k1-point-generator
              • 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
    • Secp256k1-point

    Secp256k1-point-fix

    Fixing function for secp256k1-point structures.

    Signature
    (secp256k1-point-fix p) → new-x
    Arguments
    p — Guard (secp256k1-pointp p).
    Returns
    new-x — Type (secp256k1-pointp new-x).

    Definitions and Theorems

    Function: secp256k1-point-fix$inline

    (defun secp256k1-point-fix$inline (p)
      (declare (xargs :guard (secp256k1-pointp p)))
      (let ((acl2::__function__ 'secp256k1-point-fix))
        (declare (ignorable acl2::__function__))
        (mbe :logic
             (b* ((x (secp256k1-field-fix (std::da-nth 0 p)))
                  (y (secp256k1-field-fix (std::da-nth 1 p))))
               (list x y))
             :exec p)))

    Theorem: secp256k1-pointp-of-secp256k1-point-fix

    (defthm secp256k1-pointp-of-secp256k1-point-fix
      (b* ((new-x (secp256k1-point-fix$inline p)))
        (secp256k1-pointp new-x))
      :rule-classes :rewrite)

    Theorem: secp256k1-point-fix-when-secp256k1-pointp

    (defthm secp256k1-point-fix-when-secp256k1-pointp
      (implies (secp256k1-pointp p)
               (equal (secp256k1-point-fix p) p)))

    Function: secp256k1-point-equiv$inline

    (defun secp256k1-point-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (secp256k1-pointp acl2::x)
                                  (secp256k1-pointp acl2::y))))
      (equal (secp256k1-point-fix acl2::x)
             (secp256k1-point-fix acl2::y)))

    Theorem: secp256k1-point-equiv-is-an-equivalence

    (defthm secp256k1-point-equiv-is-an-equivalence
      (and (booleanp (secp256k1-point-equiv x y))
           (secp256k1-point-equiv x x)
           (implies (secp256k1-point-equiv x y)
                    (secp256k1-point-equiv y x))
           (implies (and (secp256k1-point-equiv x y)
                         (secp256k1-point-equiv y z))
                    (secp256k1-point-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: secp256k1-point-equiv-implies-equal-secp256k1-point-fix-1

    (defthm secp256k1-point-equiv-implies-equal-secp256k1-point-fix-1
      (implies (secp256k1-point-equiv acl2::x x-equiv)
               (equal (secp256k1-point-fix acl2::x)
                      (secp256k1-point-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: secp256k1-point-fix-under-secp256k1-point-equiv

    (defthm secp256k1-point-fix-under-secp256k1-point-equiv
      (secp256k1-point-equiv (secp256k1-point-fix acl2::x)
                             acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-secp256k1-point-fix-1-forward-to-secp256k1-point-equiv

    (defthm
        equal-of-secp256k1-point-fix-1-forward-to-secp256k1-point-equiv
      (implies (equal (secp256k1-point-fix acl2::x)
                      acl2::y)
               (secp256k1-point-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-secp256k1-point-fix-2-forward-to-secp256k1-point-equiv

    (defthm
        equal-of-secp256k1-point-fix-2-forward-to-secp256k1-point-equiv
      (implies (equal acl2::x (secp256k1-point-fix acl2::y))
               (secp256k1-point-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: secp256k1-point-equiv-of-secp256k1-point-fix-1-forward

    (defthm secp256k1-point-equiv-of-secp256k1-point-fix-1-forward
      (implies (secp256k1-point-equiv (secp256k1-point-fix acl2::x)
                                      acl2::y)
               (secp256k1-point-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: secp256k1-point-equiv-of-secp256k1-point-fix-2-forward

    (defthm secp256k1-point-equiv-of-secp256k1-point-fix-2-forward
      (implies
           (secp256k1-point-equiv acl2::x (secp256k1-point-fix acl2::y))
           (secp256k1-point-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)