Recognizer for literal structures.
(literalp x) → *
Function:
(defun literalp (x) (declare (xargs :guard t)) (let ((__function__ 'literalp)) (declare (ignorable __function__)) (and (consp x) (cond ((or (atom x) (eq (car x) :integer)) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((get (std::da-nth 0 (cdr x)))) (integer-literalp get)))) ((eq (car x) :fpoint) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((get (std::da-nth 0 (cdr x)))) (floating-point-literalp get)))) ((eq (car x) :char) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((get (std::da-nth 0 (cdr x)))) (char-literalp get)))) ((eq (car x) :string) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((get (std::da-nth 0 (cdr x)))) (string-literalp get)))) ((eq (car x) :boolean) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((get (std::da-nth 0 (cdr x)))) (booleanp get)))) (t (and (eq (car x) :null) (and (true-listp (cdr x)) (eql (len (cdr x)) 0)) (b* nil t)))))))
Theorem:
(defthm consp-when-literalp (implies (literalp x) (consp x)) :rule-classes :compound-recognizer)