(vl-datatype-resolve-selects type tail indices part) → (mv err seltrace finaltype)
Function:
(defun vl-datatype-resolve-selects (type tail indices part) (declare (xargs :guard (and (vl-datatype-p type) (vl-hidexpr-p tail) (vl-exprlist-p indices) (vl-partselect-p part)))) (declare (xargs :guard (vl-datatype-resolved-p type))) (let ((__function__ 'vl-datatype-resolve-selects)) (declare (ignorable __function__)) (b* (((mv err seltrace) (vl-follow-data-selects tail type nil)) ((when err) (mv err nil nil)) (type (vl-datatype-fix type)) (seltype (if (consp seltrace) (b* (((vl-selstep selstep) (car seltrace))) selstep.type) type)) ((mv err rev-idxtrace) (vl-follow-array-indices indices seltype)) ((when err) (mv err nil nil)) (seltrace (revappend rev-idxtrace seltrace)) (seltype (if (consp seltrace) (b* (((vl-selstep selstep) (car seltrace))) selstep.type) type)) ((when (vl-partselect-case part :none)) (mv nil seltrace seltype)) ((mv err ?caveat single-type &) (vl-datatype-remove-dim seltype)) ((when err) (mv err nil nil)) ((mv err width) (vl-partselect-width part)) ((when err) (mv err nil nil)) (new-dim (vl-range->dimension (make-vl-range :msb (vl-make-index (1- width)) :lsb (vl-make-index 0)))) (packedp (vl-datatype-packedp seltype)) (psel-type (if packedp (vl-datatype-update-pdims (cons new-dim (vl-datatype->pdims single-type)) single-type) (vl-datatype-update-udims (cons new-dim (vl-datatype->udims single-type)) single-type)))) (mv nil seltrace psel-type))))
Theorem:
(defthm return-type-of-vl-datatype-resolve-selects.err (b* (((mv ?err ?seltrace ?finaltype) (vl-datatype-resolve-selects type tail indices part))) (iff (vl-msg-p err) err)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-vl-datatype-resolve-selects.seltrace (b* (((mv ?err ?seltrace ?finaltype) (vl-datatype-resolve-selects type tail indices part))) (implies (not err) (vl-seltrace-p seltrace))) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-vl-datatype-resolve-selects.finaltype (b* (((mv ?err ?seltrace ?finaltype) (vl-datatype-resolve-selects type tail indices part))) (implies (not err) (vl-datatype-p finaltype))) :rule-classes :rewrite)
Theorem:
(defthm vl-seltrace-usertypes-ok-of-vl-datatype-resolve-selects (b* (((mv ?err ?seltrace ?finaltype) (vl-datatype-resolve-selects type tail indices part))) (implies (and (not err) (vl-datatype-resolved-p type)) (vl-seltrace-usertypes-ok seltrace))))
Theorem:
(defthm vl-datatype-resolved-p-of-vl-datatype-resolve-selects (b* (((mv ?err ?seltrace ?finaltype) (vl-datatype-resolve-selects type tail indices part))) (implies (and (not err) (vl-datatype-resolved-p type)) (vl-datatype-resolved-p finaltype))))
Theorem:
(defthm vl-seltrace-count-of-vl-datatype-resolve-selects (b* (((mv ?err ?seltrace ?finaltype) (vl-datatype-resolve-selects type tail indices part))) (implies (not err) (< (vl-exprlist-count (vl-seltrace->indices seltrace)) (+ (vl-exprlist-count indices) (vl-hidexpr-count tail))))) :rule-classes :linear)
Theorem:
(defthm vl-datatype-resolve-selects-of-vl-datatype-fix-type (equal (vl-datatype-resolve-selects (vl-datatype-fix type) tail indices part) (vl-datatype-resolve-selects type tail indices part)))
Theorem:
(defthm vl-datatype-resolve-selects-vl-datatype-equiv-congruence-on-type (implies (vl-datatype-equiv type type-equiv) (equal (vl-datatype-resolve-selects type tail indices part) (vl-datatype-resolve-selects type-equiv tail indices part))) :rule-classes :congruence)
Theorem:
(defthm vl-datatype-resolve-selects-of-vl-hidexpr-fix-tail (equal (vl-datatype-resolve-selects type (vl-hidexpr-fix tail) indices part) (vl-datatype-resolve-selects type tail indices part)))
Theorem:
(defthm vl-datatype-resolve-selects-vl-hidexpr-equiv-congruence-on-tail (implies (vl-hidexpr-equiv tail tail-equiv) (equal (vl-datatype-resolve-selects type tail indices part) (vl-datatype-resolve-selects type tail-equiv indices part))) :rule-classes :congruence)
Theorem:
(defthm vl-datatype-resolve-selects-of-vl-exprlist-fix-indices (equal (vl-datatype-resolve-selects type tail (vl-exprlist-fix indices) part) (vl-datatype-resolve-selects type tail indices part)))
Theorem:
(defthm vl-datatype-resolve-selects-vl-exprlist-equiv-congruence-on-indices (implies (vl-exprlist-equiv indices indices-equiv) (equal (vl-datatype-resolve-selects type tail indices part) (vl-datatype-resolve-selects type tail indices-equiv part))) :rule-classes :congruence)
Theorem:
(defthm vl-datatype-resolve-selects-of-vl-partselect-fix-part (equal (vl-datatype-resolve-selects type tail indices (vl-partselect-fix part)) (vl-datatype-resolve-selects type tail indices part)))
Theorem:
(defthm vl-datatype-resolve-selects-vl-partselect-equiv-congruence-on-part (implies (vl-partselect-equiv part part-equiv) (equal (vl-datatype-resolve-selects type tail indices part) (vl-datatype-resolve-selects type tail indices part-equiv))) :rule-classes :congruence)