• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Error-checking
        • Apt
        • Abnf
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Prime-field-constraint-systems
        • Soft
        • Bv
        • Imp-language
        • Event-macros
        • Bitcoin
        • Ethereum
        • Yul
        • Zcash
        • ACL2-programming-language
        • Prime-fields
        • Java
        • C
        • Syntheto
        • Number-theory
        • Cryptography
          • R1cs
          • Interfaces
          • Sha-2
          • Keccak
          • Kdf
          • Mimc
          • Padding
          • Hmac
          • Elliptic-curves
            • Secp256k1-attachment
            • Twisted-edwards
            • Montgomery
            • Edwards-bls12
            • Short-weierstrass-curves
            • Birational-montgomery-twisted-edwards
            • Has-square-root?-satisfies-pfield-squarep
            • Secp256k1
            • Secp256k1-domain-parameters
            • Secp256k1-types
              • Secp256k1-priv-key
                • Secp256k1-priv-key-p
                • Secp256k1-priv-key-fix
              • Secp256k1-pub-key
              • Secp256k1-field
              • Secp256k1-point
              • Secp256k1-point-to-bytes
              • Secp256k1-point-infinityp
              • Secp256k1-point-generator
            • Pfield-squarep
            • Secp256k1-interface
            • Bls12-377-domain-parameters
            • Prime-field-extra-rules
            • Points
          • Attachments
          • Elliptic-curve-digital-signature-algorithm
        • Lists-light
        • File-io-light
        • Json
        • Built-ins
        • Solidity
        • Axe
        • Std-extensions
        • Htclient
        • Typed-lists-light
        • Arithmetic-light
      • X86isa
      • Execloader
      • Axe
    • Testing-utilities
    • Math
  • Secp256k1-types

Secp256k1-priv-key

Fixtype of secp256k1 private keys.

A private key is a positive integer below the order n.

Definitions and Theorems

Function: secp256k1-priv-key-p

(defun secp256k1-priv-key-p (x)
       (declare (xargs :guard t))
       (integer-range-p 1 (secp256k1-group-prime)
                        x))

Theorem: booleanp-of-secp256k1-priv-key-p

(defthm booleanp-of-secp256k1-priv-key-p
        (b* ((yes/no (secp256k1-priv-key-p x)))
            (booleanp yes/no))
        :rule-classes :rewrite)

Theorem: posp-and-below-order-when-secp256k1-priv-key-p

(defthm
 posp-and-below-order-when-secp256k1-priv-key-p
 (implies
  (secp256k1-priv-key-p privkey)
  (and
   (posp privkey)
   (<
    privkey
    115792089237316195423570985008687907852837564279074904382605163141518161494337)))
 :rule-classes :tau-system)

Function: secp256k1-priv-key-fix

(defun secp256k1-priv-key-fix (x)
       (declare (xargs :guard (secp256k1-priv-key-p x)))
       (mbe :logic (if (secp256k1-priv-key-p x) x 1)
            :exec x))

Theorem: secp256k1-priv-key-p-of-secp256k1-priv-key-fix

(defthm secp256k1-priv-key-p-of-secp256k1-priv-key-fix
        (b* ((fixed-x (secp256k1-priv-key-fix x)))
            (secp256k1-priv-key-p fixed-x))
        :rule-classes :rewrite)

Theorem: secp256k1-priv-key-fix-when-secp256k1-priv-key-p

(defthm secp256k1-priv-key-fix-when-secp256k1-priv-key-p
        (implies (secp256k1-priv-key-p x)
                 (equal (secp256k1-priv-key-fix x) x)))

Function: secp256k1-priv-key-equiv$inline

(defun secp256k1-priv-key-equiv$inline
       (acl2::x acl2::y)
       (declare (xargs :guard (and (secp256k1-priv-key-p acl2::x)
                                   (secp256k1-priv-key-p acl2::y))))
       (equal (secp256k1-priv-key-fix acl2::x)
              (secp256k1-priv-key-fix acl2::y)))

Theorem: secp256k1-priv-key-equiv-is-an-equivalence

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

Theorem: secp256k1-priv-key-equiv-implies-equal-secp256k1-priv-key-fix-1

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

Theorem: secp256k1-priv-key-fix-under-secp256k1-priv-key-equiv

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

Theorem: equal-of-secp256k1-priv-key-fix-1-forward-to-secp256k1-priv-key-equiv

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

Theorem: equal-of-secp256k1-priv-key-fix-2-forward-to-secp256k1-priv-key-equiv

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

Theorem: secp256k1-priv-key-equiv-of-secp256k1-priv-key-fix-1-forward

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

Theorem: secp256k1-priv-key-equiv-of-secp256k1-priv-key-fix-2-forward

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

Subtopics

Secp256k1-priv-key-p
Recognizer for secp256k1-priv-key.
Secp256k1-priv-key-fix
Fixer for secp256k1-priv-key.