Computation of self-determined expression sizes.
(vl-expr-selfsize x ss ctx warnings) → (mv warnings size)
Warning: these functions should typically only be called by the expression-sizing transform.
Some failures are expected, e.g., we do not know how to size some system calls. In these cases we do not cause any warnings. But in other cases, a failure might mean that the expression is malformed in some way, e.g., maybe it references an undefined wire or contains a raw, "unindexed" reference to an array. In these cases we generate fatal warnings.
BOZO we might eventually add as inputs the full list of modules and a
modalist so that we can look up HIDs. An alternative would be to use the
annotations left by transforms such as the now-defunct
Theorem:
(defthm return-type-of-vl-expr-selfsize.warnings (b* (((mv ?warnings ?size) (vl-expr-selfsize x ss ctx warnings))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-vl-expr-selfsize.size (b* (((mv ?warnings ?size) (vl-expr-selfsize x ss ctx warnings))) (maybe-natp size)) :rule-classes :type-prescription)
Theorem:
(defthm return-type-of-vl-exprlist-selfsize.warnings (b* (((mv ?warnings ?size-list) (vl-exprlist-selfsize x ss ctx warnings))) (vl-warninglist-p warnings)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-vl-exprlist-selfsize.size-list (b* (((mv ?warnings ?size-list) (vl-exprlist-selfsize x ss ctx warnings))) (and (vl-maybe-nat-listp size-list) (equal (len size-list) (len x)))) :rule-classes :rewrite)
Theorem:
(defthm vl-expr-selfsize-of-vl-expr-fix-x (equal (vl-expr-selfsize (vl-expr-fix x) ss ctx warnings) (vl-expr-selfsize x ss ctx warnings)))
Theorem:
(defthm vl-expr-selfsize-of-vl-scopestack-fix-ss (equal (vl-expr-selfsize x (vl-scopestack-fix ss) ctx warnings) (vl-expr-selfsize x ss ctx warnings)))
Theorem:
(defthm vl-expr-selfsize-of-vl-context-fix-ctx (equal (vl-expr-selfsize x ss (vl-context-fix ctx) warnings) (vl-expr-selfsize x ss ctx warnings)))
Theorem:
(defthm vl-expr-selfsize-of-vl-warninglist-fix-warnings (equal (vl-expr-selfsize x ss ctx (vl-warninglist-fix warnings)) (vl-expr-selfsize x ss ctx warnings)))
Theorem:
(defthm vl-exprlist-selfsize-of-vl-exprlist-fix-x (equal (vl-exprlist-selfsize (vl-exprlist-fix x) ss ctx warnings) (vl-exprlist-selfsize x ss ctx warnings)))
Theorem:
(defthm vl-exprlist-selfsize-of-vl-scopestack-fix-ss (equal (vl-exprlist-selfsize x (vl-scopestack-fix ss) ctx warnings) (vl-exprlist-selfsize x ss ctx warnings)))
Theorem:
(defthm vl-exprlist-selfsize-of-vl-context-fix-ctx (equal (vl-exprlist-selfsize x ss (vl-context-fix ctx) warnings) (vl-exprlist-selfsize x ss ctx warnings)))
Theorem:
(defthm vl-exprlist-selfsize-of-vl-warninglist-fix-warnings (equal (vl-exprlist-selfsize x ss ctx (vl-warninglist-fix warnings)) (vl-exprlist-selfsize x ss ctx warnings)))
Theorem:
(defthm vl-expr-selfsize-vl-expr-equiv-congruence-on-x (implies (vl-expr-equiv x x-equiv) (equal (vl-expr-selfsize x ss ctx warnings) (vl-expr-selfsize x-equiv ss ctx warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-expr-selfsize-vl-scopestack-equiv-congruence-on-ss (implies (vl-scopestack-equiv ss ss-equiv) (equal (vl-expr-selfsize x ss ctx warnings) (vl-expr-selfsize x ss-equiv ctx warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-expr-selfsize-vl-context-equiv-congruence-on-ctx (implies (vl-context-equiv ctx ctx-equiv) (equal (vl-expr-selfsize x ss ctx warnings) (vl-expr-selfsize x ss ctx-equiv warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-expr-selfsize-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-expr-selfsize x ss ctx warnings) (vl-expr-selfsize x ss ctx warnings-equiv))) :rule-classes :congruence)
Theorem:
(defthm vl-exprlist-selfsize-vl-exprlist-equiv-congruence-on-x (implies (vl-exprlist-equiv x x-equiv) (equal (vl-exprlist-selfsize x ss ctx warnings) (vl-exprlist-selfsize x-equiv ss ctx warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-exprlist-selfsize-vl-scopestack-equiv-congruence-on-ss (implies (vl-scopestack-equiv ss ss-equiv) (equal (vl-exprlist-selfsize x ss ctx warnings) (vl-exprlist-selfsize x ss-equiv ctx warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-exprlist-selfsize-vl-context-equiv-congruence-on-ctx (implies (vl-context-equiv ctx ctx-equiv) (equal (vl-exprlist-selfsize x ss ctx warnings) (vl-exprlist-selfsize x ss ctx-equiv warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-exprlist-selfsize-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-exprlist-selfsize x ss ctx warnings) (vl-exprlist-selfsize x ss ctx warnings-equiv))) :rule-classes :congruence)
Theorem:
(defthm warning-irrelevance-of-vl-expr-selfsize (let ((ret1 (vl-expr-selfsize x ss ctx warnings)) (ret2 (vl-expr-selfsize x ss nil nil))) (implies (syntaxp (not (and (equal ctx ''nil) (equal warnings ''nil)))) (equal (mv-nth 1 ret1) (mv-nth 1 ret2)))))
Theorem:
(defthm warning-irrelevance-of-vl-exprlist-selfsize (let ((ret1 (vl-exprlist-selfsize x ss ctx warnings)) (ret2 (vl-exprlist-selfsize x ss nil nil))) (implies (syntaxp (not (and (equal ctx ''nil) (equal warnings ''nil)))) (equal (mv-nth 1 ret1) (mv-nth 1 ret2)))))