Recognizer for type structures.
(typep x) → *
Function:
(defun typep (x) (declare (xargs :guard t)) (let ((__function__ 'typep)) (declare (ignorable __function__)) (and (consp x) (cond ((or (atom x) (eq (car x) :boolean)) (and (true-listp (cdr x)) (eql (len (cdr x)) 0) (b* nil t))) ((eq (car x) :character) (and (true-listp (cdr x)) (eql (len (cdr x)) 0) (b* nil t))) ((eq (car x) :string) (and (true-listp (cdr x)) (eql (len (cdr x)) 0) (b* nil t))) ((eq (car x) :integer) (and (true-listp (cdr x)) (eql (len (cdr x)) 0) (b* nil t))) ((eq (car x) :set) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((element (std::da-nth 0 (cdr x)))) (typep element)))) ((eq (car x) :sequence) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((element (std::da-nth 0 (cdr x)))) (typep element)))) ((eq (car x) :map) (and (true-listp (cdr x)) (eql (len (cdr x)) 2) (b* ((domain (std::da-nth 0 (cdr x))) (range (std::da-nth 1 (cdr x)))) (and (typep domain) (typep range))))) ((eq (car x) :option) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((base (std::da-nth 0 (cdr x)))) (typep base)))) (t (and (eq (car x) :defined) (and (true-listp (cdr x)) (eql (len (cdr x)) 1)) (b* ((name (std::da-nth 0 (cdr x)))) (identifierp name))))))))
Theorem:
(defthm consp-when-typep (implies (typep x) (consp x)) :rule-classes :compound-recognizer)