Recognizer for expression structures.
(expressionp x) → *
Function:
(defun expressionp (x) (declare (xargs :guard t)) (let ((__function__ 'expressionp)) (declare (ignorable __function__)) (and (consp x) (cond ((or (atom x) (eq (car x) :const)) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((value (std::da-nth 0 (cdr x)))) (integerp value)))) ((eq (car x) :var) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((name (std::da-nth 0 (cdr x)))) (stringp name)))) ((eq (car x) :add) (and (true-listp (cdr x)) (eql (len (cdr x)) 2) (b* ((arg1 (std::da-nth 0 (cdr x))) (arg2 (std::da-nth 1 (cdr x)))) (and (expressionp arg1) (expressionp arg2))))) (t (and (eq (car x) :mul) (and (true-listp (cdr x)) (eql (len (cdr x)) 2)) (b* ((arg1 (std::da-nth 0 (cdr x))) (arg2 (std::da-nth 1 (cdr x)))) (and (expressionp arg1) (expressionp arg2)))))))))
Theorem:
(defthm consp-when-expressionp (implies (expressionp x) (consp x)) :rule-classes :compound-recognizer)