Modular square root
Checks if
Function:
(defun has-square-root? (a p) (declare (xargs :guard (and (natp a) (natp p)))) (declare (xargs :guard (and (natp a) (primep p) (not (equal p 2)) (< a p)))) (let ((acl2::__function__ 'has-square-root?)) (declare (ignorable acl2::__function__)) (and (primep p) (or (= a 0) (equal (acl2::mod-expt-fast a (/ (- p 1) 2) p) 1)))))
Theorem:
(defthm booleanp-of-has-square-root? (b* ((y/n (has-square-root? a p))) (booleanp y/n)) :rule-classes :rewrite)