Fixtype of the elements of the secp256k1 field.
These are natural numbers below the prime
Function:
(defun secp256k1-fieldp (x) (declare (xargs :guard t)) (integer-range-p 0 (secp256k1-field-prime) x))
Theorem:
(defthm booleanp-of-secp256k1-fieldp (b* ((yes/no (secp256k1-fieldp x))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm natp-and-below-prime-when-secp256k1-fieldp (implies (secp256k1-fieldp x) (and (natp x) (< x 115792089237316195423570985008687907853269984665640564039457584007908834671663))) :rule-classes :tau-system)
Function:
(defun secp256k1-field-fix (x) (declare (xargs :guard (secp256k1-fieldp x))) (mbe :logic (if (secp256k1-fieldp x) x 0) :exec x))
Theorem:
(defthm secp256k1-fieldp-of-secp256k1-field-fix (b* ((fixed-x (secp256k1-field-fix x))) (secp256k1-fieldp fixed-x)) :rule-classes :rewrite)
Theorem:
(defthm secp256k1-field-fix-when-secp256k1-fieldp (implies (secp256k1-fieldp x) (equal (secp256k1-field-fix x) x)))
Function:
(defun secp256k1-field-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (secp256k1-fieldp acl2::x) (secp256k1-fieldp acl2::y)))) (equal (secp256k1-field-fix acl2::x) (secp256k1-field-fix acl2::y)))
Theorem:
(defthm secp256k1-field-equiv-is-an-equivalence (and (booleanp (secp256k1-field-equiv x y)) (secp256k1-field-equiv x x) (implies (secp256k1-field-equiv x y) (secp256k1-field-equiv y x)) (implies (and (secp256k1-field-equiv x y) (secp256k1-field-equiv y z)) (secp256k1-field-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm secp256k1-field-equiv-implies-equal-secp256k1-field-fix-1 (implies (secp256k1-field-equiv acl2::x x-equiv) (equal (secp256k1-field-fix acl2::x) (secp256k1-field-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm secp256k1-field-fix-under-secp256k1-field-equiv (secp256k1-field-equiv (secp256k1-field-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-secp256k1-field-fix-1-forward-to-secp256k1-field-equiv (implies (equal (secp256k1-field-fix acl2::x) acl2::y) (secp256k1-field-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-secp256k1-field-fix-2-forward-to-secp256k1-field-equiv (implies (equal acl2::x (secp256k1-field-fix acl2::y)) (secp256k1-field-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm secp256k1-field-equiv-of-secp256k1-field-fix-1-forward (implies (secp256k1-field-equiv (secp256k1-field-fix acl2::x) acl2::y) (secp256k1-field-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm secp256k1-field-equiv-of-secp256k1-field-fix-2-forward (implies (secp256k1-field-equiv acl2::x (secp256k1-field-fix acl2::y)) (secp256k1-field-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)