Fixtype of secp256k1 private keys.
A private key is a positive integer below the order
Function:
(defun secp256k1-priv-key-p (x) (declare (xargs :guard t)) (integer-range-p 1 (secp256k1-group-prime) x))
Theorem:
(defthm booleanp-of-secp256k1-priv-key-p (b* ((yes/no (secp256k1-priv-key-p x))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(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:
(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:
(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:
(defthm secp256k1-priv-key-fix-when-secp256k1-priv-key-p (implies (secp256k1-priv-key-p x) (equal (secp256k1-priv-key-fix x) x)))
Function:
(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:
(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:
(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:
(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:
(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:
(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:
(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:
(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)