• Top
  • Console

Consolep

Recognizer for console structures.

Signature
(consolep x) → *

Definitions and Theorems

Function: consolep

(defun consolep (x)
  (declare (xargs :guard t))
  (let ((__function__ 'consolep))
    (declare (ignorable __function__))
    (and (consp x)
         (cond ((or (atom x) (eq (car x) :assert))
                (and (true-listp (cdr x))
                     (eql (len (cdr x)) 1)
                     (b* ((arg (std::da-nth 0 (cdr x))))
                       (expressionp arg))))
               ((eq (car x) :error)
                (and (true-listp (cdr x))
                     (eql (len (cdr x)) 2)
                     (b* ((string (std::da-nth 0 (cdr x)))
                          (exprs (std::da-nth 1 (cdr x))))
                       (and (char-listp string)
                            (expression-listp exprs)))))
               (t (and (eq (car x) :log)
                       (and (true-listp (cdr x))
                            (eql (len (cdr x)) 2))
                       (b* ((string (std::da-nth 0 (cdr x)))
                            (exprs (std::da-nth 1 (cdr x))))
                         (and (char-listp string)
                              (expression-listp exprs)))))))))

Theorem: consp-when-consolep

(defthm consp-when-consolep
  (implies (consolep x) (consp x))
  :rule-classes :compound-recognizer)