Recognizer for toplevel structures.
(toplevelp x) → *
Function:
(defun toplevelp (x) (declare (xargs :guard t)) (let ((__function__ 'toplevelp)) (declare (ignorable __function__)) (and (consp x) (cond ((or (atom x) (eq (car x) :type)) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((get (std::da-nth 0 (cdr x)))) (type-definitionp get)))) ((eq (car x) :types) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((get (std::da-nth 0 (cdr x)))) (type-recursionp get)))) ((eq (car x) :function) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((get (std::da-nth 0 (cdr x)))) (function-definitionp get)))) ((eq (car x) :functions) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((get (std::da-nth 0 (cdr x)))) (function-recursionp get)))) ((eq (car x) :specification) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((get (std::da-nth 0 (cdr x)))) (function-specificationp get)))) ((eq (car x) :theorem) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((get (std::da-nth 0 (cdr x)))) (theoremp get)))) (t (and (eq (car x) :transform) (and (true-listp (cdr x)) (eql (len (cdr x)) 1)) (b* ((get (std::da-nth 0 (cdr x)))) (transformp get))))))))
Theorem:
(defthm consp-when-toplevelp (implies (toplevelp x) (consp x)) :rule-classes :compound-recognizer)