Recognizer for montgomery-curve structures.
(montgomery-curvep x) → *
Function:
(defun montgomery-curvep (x) (declare (xargs :guard t)) (let ((acl2::__function__ 'montgomery-curvep)) (declare (ignorable acl2::__function__)) (and (mbe :logic (and (alistp x) (equal (strip-cars x) '(p a b))) :exec (fty::alist-with-carsp x '(p a b))) (b* ((?p (cdr (std::da-nth 0 x))) (?a (cdr (std::da-nth 1 x))) (?b (cdr (std::da-nth 2 x)))) (and (dm::primep p) (> p 2) (fep a p) (fep b p) (not (equal a 2)) (not (equal a (mod -2 p))) (not (equal b 0)))))))
Theorem:
(defthm consp-when-montgomery-curvep (implies (montgomery-curvep x) (consp x)) :rule-classes :compound-recognizer)