Get the attributes from any expression.
Function:
(defun vl-expr->atts (x) (declare (xargs :guard (vl-expr-p x))) (let ((__function__ 'vl-expr->atts)) (declare (ignorable __function__)) (vl-expr-case x :vl-special x.atts :vl-literal x.atts :vl-index x.atts :vl-unary x.atts :vl-binary x.atts :vl-qmark x.atts :vl-mintypmax x.atts :vl-concat x.atts :vl-multiconcat x.atts :vl-bitselect-expr x.atts :vl-partselect-expr x.atts :vl-stream x.atts :vl-call x.atts :vl-cast x.atts :vl-inside x.atts :vl-tagged x.atts :vl-pattern x.atts :vl-eventexpr x.atts)))
Theorem:
(defthm vl-atts-p-of-vl-expr->atts (b* ((atts (vl-expr->atts x))) (vl-atts-p atts)) :rule-classes :rewrite)
Theorem:
(defthm vl-expr->atts-of-vl-expr-fix-x (equal (vl-expr->atts (vl-expr-fix x)) (vl-expr->atts x)))
Theorem:
(defthm vl-expr->atts-vl-expr-equiv-congruence-on-x (implies (vl-expr-equiv x x-equiv) (equal (vl-expr->atts x) (vl-expr->atts x-equiv))) :rule-classes :congruence)
The following are goofy rules: normally we want to normalize things to
Theorem:
(defthm vl-expr-atts-when-vl-special (implies (vl-expr-case x :vl-special) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-special))) (equal (vl-expr->atts x) (vl-special->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-special)))) (equal (vl-special->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-literal (implies (vl-expr-case x :vl-literal) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-literal))) (equal (vl-expr->atts x) (vl-literal->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-literal)))) (equal (vl-literal->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-index (implies (vl-expr-case x :vl-index) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-index))) (equal (vl-expr->atts x) (vl-index->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-index)))) (equal (vl-index->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-unary (implies (vl-expr-case x :vl-unary) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-unary))) (equal (vl-expr->atts x) (vl-unary->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-unary)))) (equal (vl-unary->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-binary (implies (vl-expr-case x :vl-binary) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-binary))) (equal (vl-expr->atts x) (vl-binary->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-binary)))) (equal (vl-binary->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-qmark (implies (vl-expr-case x :vl-qmark) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-qmark))) (equal (vl-expr->atts x) (vl-qmark->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-qmark)))) (equal (vl-qmark->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-mintypmax (implies (vl-expr-case x :vl-mintypmax) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-mintypmax))) (equal (vl-expr->atts x) (vl-mintypmax->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-mintypmax)))) (equal (vl-mintypmax->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-concat (implies (vl-expr-case x :vl-concat) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-concat))) (equal (vl-expr->atts x) (vl-concat->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-concat)))) (equal (vl-concat->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-multiconcat (implies (vl-expr-case x :vl-multiconcat) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-multiconcat))) (equal (vl-expr->atts x) (vl-multiconcat->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-multiconcat)))) (equal (vl-multiconcat->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-bitselect-expr (implies (vl-expr-case x :vl-bitselect-expr) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-bitselect-expr))) (equal (vl-expr->atts x) (vl-bitselect-expr->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-bitselect-expr)))) (equal (vl-bitselect-expr->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-partselect-expr (implies (vl-expr-case x :vl-partselect-expr) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-partselect-expr))) (equal (vl-expr->atts x) (vl-partselect-expr->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-partselect-expr)))) (equal (vl-partselect-expr->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-stream (implies (vl-expr-case x :vl-stream) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-stream))) (equal (vl-expr->atts x) (vl-stream->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-stream)))) (equal (vl-stream->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-call (implies (vl-expr-case x :vl-call) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-call))) (equal (vl-expr->atts x) (vl-call->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-call)))) (equal (vl-call->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-cast (implies (vl-expr-case x :vl-cast) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-cast))) (equal (vl-expr->atts x) (vl-cast->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-cast)))) (equal (vl-cast->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-inside (implies (vl-expr-case x :vl-inside) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-inside))) (equal (vl-expr->atts x) (vl-inside->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-inside)))) (equal (vl-inside->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-tagged (implies (vl-expr-case x :vl-tagged) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-tagged))) (equal (vl-expr->atts x) (vl-tagged->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-tagged)))) (equal (vl-tagged->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-pattern (implies (vl-expr-case x :vl-pattern) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-pattern))) (equal (vl-expr->atts x) (vl-pattern->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-pattern)))) (equal (vl-pattern->atts x) (vl-expr->atts x))))))
Theorem:
(defthm vl-expr-atts-when-vl-eventexpr (implies (vl-expr-case x :vl-eventexpr) (and (implies (syntaxp (and (consp x) (eq (car x) 'vl-eventexpr))) (equal (vl-expr->atts x) (vl-eventexpr->atts x))) (implies (syntaxp (not (and (consp x) (eq (car x) 'vl-eventexpr)))) (equal (vl-eventexpr->atts x) (vl-expr->atts x))))))
For recurring into the atts we may need to know this.
Theorem:
(defthm vl-atts-count-of-vl-expr->atts (< (vl-atts-count (vl-expr->atts x)) (vl-expr-count x)) :rule-classes :linear)