Recognizer for token structures.
(tokenp x) → *
Function:
(defun tokenp (x) (declare (xargs :guard t)) (let ((__function__ 'tokenp)) (declare (ignorable __function__)) (and (consp x) (cond ((or (atom x) (eq (car x) :keyword)) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((unwrap (std::da-nth 0 (cdr x)))) (stringp unwrap)))) ((eq (car x) :ident) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((unwrap (std::da-nth 0 (cdr x)))) (identp unwrap)))) ((eq (car x) :const) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((unwrap (std::da-nth 0 (cdr x)))) (constp unwrap)))) ((eq (car x) :string) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((unwrap (std::da-nth 0 (cdr x)))) (stringlitp unwrap)))) (t (and (eq (car x) :punctuator) (and (true-listp (cdr x)) (eql (len (cdr x)) 1)) (b* ((unwrap (std::da-nth 0 (cdr x)))) (stringp unwrap))))))))
Theorem:
(defthm consp-when-tokenp (implies (tokenp x) (consp x)) :rule-classes :compound-recognizer)