Get the kind (tag) of a expression structure.
(expression-kind x) → kind
Function:
(defun expression-kind$inline (x) (declare (xargs :guard (expressionp x))) (let ((__function__ 'expression-kind)) (declare (ignorable __function__)) (mbe :logic (cond ((or (atom x) (eq (car x) :literal)) :literal) ((eq (car x) :variable) :variable) ((eq (car x) :unary) :unary) ((eq (car x) :binary) :binary) ((eq (car x) :if) :if) ((eq (car x) :when) :when) ((eq (car x) :unless) :unless) ((eq (car x) :cond) :cond) ((eq (car x) :call) :call) ((eq (car x) :multi) :multi) ((eq (car x) :component) :component) ((eq (car x) :bind) :bind) ((eq (car x) :product-construct) :product-construct) ((eq (car x) :product-field) :product-field) ((eq (car x) :product-update) :product-update) ((eq (car x) :sum-construct) :sum-construct) ((eq (car x) :sum-field) :sum-field) ((eq (car x) :sum-update) :sum-update) ((eq (car x) :sum-test) :sum-test) (t :bad-expression)) :exec (car x))))
Theorem:
(defthm expression-kind-possibilities (or (equal (expression-kind x) :literal) (equal (expression-kind x) :variable) (equal (expression-kind x) :unary) (equal (expression-kind x) :binary) (equal (expression-kind x) :if) (equal (expression-kind x) :when) (equal (expression-kind x) :unless) (equal (expression-kind x) :cond) (equal (expression-kind x) :call) (equal (expression-kind x) :multi) (equal (expression-kind x) :component) (equal (expression-kind x) :bind) (equal (expression-kind x) :product-construct) (equal (expression-kind x) :product-field) (equal (expression-kind x) :product-update) (equal (expression-kind x) :sum-construct) (equal (expression-kind x) :sum-field) (equal (expression-kind x) :sum-update) (equal (expression-kind x) :sum-test) (equal (expression-kind x) :bad-expression)) :rule-classes ((:forward-chaining :trigger-terms ((expression-kind x)))))