Recognizer for dec/oct/hex-const structures.
(dec/oct/hex-constp x) → *
Function:
(defun dec/oct/hex-constp (x) (declare (xargs :guard t)) (and (consp x) (cond ((or (atom x) (eq (car x) :dec)) (and (b* ((value (cdr x))) (posp value)))) ((eq (car x) :oct) (and (consp (cdr x)) (b* ((leading-zeros (car (cdr x))) (value (cdr (cdr x)))) (and (posp leading-zeros) (natp value))))) (t (and (eq (car x) :hex) (and (consp (cdr x))) (b* ((prefix (car (cdr x))) (digits (cdr (cdr x)))) (and (hprefixp prefix) (hex-digit-char-listp digits))))))))
Theorem:
(defthm consp-when-dec/oct/hex-constp (implies (dec/oct/hex-constp x) (consp x)) :rule-classes :compound-recognizer)