Check array indices against the corresponding array bounds.
(vl-follow-hidexpr-dimscheck name indices dims &key strictp direct-okp) → err
Function:
(defun vl-follow-hidexpr-dimscheck-fn (name indices dims strictp direct-okp) (declare (xargs :guard (and (stringp name) (vl-exprlist-p indices) (vl-dimensionlist-p dims) (booleanp strictp) (booleanp direct-okp)))) (let ((__function__ 'vl-follow-hidexpr-dimscheck)) (declare (ignorable __function__)) (b* ((name (string-fix name)) ((when (atom dims)) (if (atom indices) nil (vmsg "indexing into non-array ~s0" name))) ((when (atom indices)) (if direct-okp nil (vmsg "no indices given for array ~s0" name))) ((when (same-lengthp indices dims)) (vl-follow-hidexpr-dimscheck-aux name indices dims :strictp strictp)) (found (len indices)) (need (len dims)) ((when (< found need)) (vmsg "too many indices for array ~s0" name))) (vmsg "not enough indices for array ~s0" name))))
Theorem:
(defthm return-type-of-vl-follow-hidexpr-dimscheck (b* ((err (vl-follow-hidexpr-dimscheck-fn name indices dims strictp direct-okp))) (iff (vl-msg-p err) err)) :rule-classes :rewrite)
Theorem:
(defthm vl-follow-hidexpr-dimscheck-fn-of-str-fix-name (equal (vl-follow-hidexpr-dimscheck-fn (str-fix name) indices dims strictp direct-okp) (vl-follow-hidexpr-dimscheck-fn name indices dims strictp direct-okp)))
Theorem:
(defthm vl-follow-hidexpr-dimscheck-fn-streqv-congruence-on-name (implies (streqv name name-equiv) (equal (vl-follow-hidexpr-dimscheck-fn name indices dims strictp direct-okp) (vl-follow-hidexpr-dimscheck-fn name-equiv indices dims strictp direct-okp))) :rule-classes :congruence)
Theorem:
(defthm vl-follow-hidexpr-dimscheck-fn-of-vl-exprlist-fix-indices (equal (vl-follow-hidexpr-dimscheck-fn name (vl-exprlist-fix indices) dims strictp direct-okp) (vl-follow-hidexpr-dimscheck-fn name indices dims strictp direct-okp)))
Theorem:
(defthm vl-follow-hidexpr-dimscheck-fn-vl-exprlist-equiv-congruence-on-indices (implies (vl-exprlist-equiv indices indices-equiv) (equal (vl-follow-hidexpr-dimscheck-fn name indices dims strictp direct-okp) (vl-follow-hidexpr-dimscheck-fn name indices-equiv dims strictp direct-okp))) :rule-classes :congruence)
Theorem:
(defthm vl-follow-hidexpr-dimscheck-fn-of-vl-dimensionlist-fix-dims (equal (vl-follow-hidexpr-dimscheck-fn name indices (vl-dimensionlist-fix dims) strictp direct-okp) (vl-follow-hidexpr-dimscheck-fn name indices dims strictp direct-okp)))
Theorem:
(defthm vl-follow-hidexpr-dimscheck-fn-vl-dimensionlist-equiv-congruence-on-dims (implies (vl-dimensionlist-equiv dims dims-equiv) (equal (vl-follow-hidexpr-dimscheck-fn name indices dims strictp direct-okp) (vl-follow-hidexpr-dimscheck-fn name indices dims-equiv strictp direct-okp))) :rule-classes :congruence)
Theorem:
(defthm vl-follow-hidexpr-dimscheck-fn-of-bool-fix-strictp (equal (vl-follow-hidexpr-dimscheck-fn name indices dims (acl2::bool-fix strictp) direct-okp) (vl-follow-hidexpr-dimscheck-fn name indices dims strictp direct-okp)))
Theorem:
(defthm vl-follow-hidexpr-dimscheck-fn-iff-congruence-on-strictp (implies (iff strictp strictp-equiv) (equal (vl-follow-hidexpr-dimscheck-fn name indices dims strictp direct-okp) (vl-follow-hidexpr-dimscheck-fn name indices dims strictp-equiv direct-okp))) :rule-classes :congruence)
Theorem:
(defthm vl-follow-hidexpr-dimscheck-fn-of-bool-fix-direct-okp (equal (vl-follow-hidexpr-dimscheck-fn name indices dims strictp (acl2::bool-fix direct-okp)) (vl-follow-hidexpr-dimscheck-fn name indices dims strictp direct-okp)))
Theorem:
(defthm vl-follow-hidexpr-dimscheck-fn-iff-congruence-on-direct-okp (implies (iff direct-okp direct-okp-equiv) (equal (vl-follow-hidexpr-dimscheck-fn name indices dims strictp direct-okp) (vl-follow-hidexpr-dimscheck-fn name indices dims strictp direct-okp-equiv))) :rule-classes :congruence)