(vl-parse-keyval-pattern-array fields range orig-x ctx warnings) → (mv successp alist new-warnings)
Function:
(defun vl-parse-keyval-pattern-array (fields range orig-x ctx warnings) (declare (xargs :guard (and (vl-exprlist-p fields) (and (vl-range-p range) (vl-range-resolved-p range)) (vl-expr-p orig-x) (vl-context-p ctx) (vl-warninglist-p warnings)))) (let ((__function__ 'vl-parse-keyval-pattern-array)) (declare (ignorable __function__)) (b* ((warnings (vl-warninglist-fix warnings)) (ctx (vl-context-fix ctx)) (orig-x (vl-expr-fix orig-x)) ((when (atom fields)) (mv t nil warnings)) (pair (vl-expr-fix (car fields))) ((unless (and (not (vl-atom-p pair)) (eq (vl-nonatom->op pair) :vl-keyvalue))) (mv nil nil (warn :type :vl-assignpattern-elim-fail :msg "~a0: Expected key-value pairs in assignment ~ pattern ~a1 (bad: ~a2)" :args (list ctx orig-x pair)))) (pair.args (vl-nonatom->args pair)) (idx (first pair.args)) (defaultp (and (vl-atom-p idx) (equal (vl-atom->guts idx) (vl-keyguts :vl-default)))) ((unless (or defaultp (vl-expr-resolved-p idx))) (mv nil nil (warn :type :vl-assignpattern-elim-fail :msg "~a0: Expected keys in array keyval pattern ~ to be integers (except for default): ~a1 ~ (bad: ~a2)" :args (list ctx orig-x pair)))) (key (if defaultp :default (vl-resolved->val idx))) ((unless (or defaultp (and (<= key (vl-resolved->val (vl-range->msb range))) (<= (vl-resolved->val (vl-range->lsb range)) key)) (and (<= (vl-resolved->val (vl-range->msb range)) key) (<= key (vl-resolved->val (vl-range->lsb range)))))) (mv nil nil (warn :type :vl-assignpattern-elim-fail :msg "~a0: Assign pattern key out of range for ~ array type: ~a1 (bad: ~a2)" :args (list ctx orig-x pair)))) ((mv rest-ok rest warnings) (vl-parse-keyval-pattern-array (cdr fields) range orig-x ctx warnings))) (mv rest-ok (cons (cons key (second pair.args)) rest) warnings))))
Theorem:
(defthm booleanp-of-vl-parse-keyval-pattern-array.successp (b* (((mv ?successp ?alist ?new-warnings) (vl-parse-keyval-pattern-array fields range orig-x ctx warnings))) (booleanp successp)) :rule-classes :type-prescription)
Theorem:
(defthm vl-expr-val-alist-p-of-vl-parse-keyval-pattern-array.alist (b* (((mv ?successp ?alist ?new-warnings) (vl-parse-keyval-pattern-array fields range orig-x ctx warnings))) (vl-expr-val-alist-p alist)) :rule-classes :rewrite)
Theorem:
(defthm vl-warninglist-p-of-vl-parse-keyval-pattern-array.new-warnings (b* (((mv ?successp ?alist ?new-warnings) (vl-parse-keyval-pattern-array fields range orig-x ctx warnings))) (vl-warninglist-p new-warnings)) :rule-classes :rewrite)
Theorem:
(defthm vl-exprlist-max-count-of-vl-parse-keyval-pattern-array (< (vl-exprlist-max-count (alist-vals (mv-nth 1 (vl-parse-keyval-pattern-array fields range orig-x ctx warnings)))) (vl-exprlist-count fields)) :rule-classes :linear)
Theorem:
(defthm vl-parse-keyval-pattern-array-of-vl-exprlist-fix-fields (equal (vl-parse-keyval-pattern-array (vl-exprlist-fix fields) range orig-x ctx warnings) (vl-parse-keyval-pattern-array fields range orig-x ctx warnings)))
Theorem:
(defthm vl-parse-keyval-pattern-array-vl-exprlist-equiv-congruence-on-fields (implies (vl-exprlist-equiv fields fields-equiv) (equal (vl-parse-keyval-pattern-array fields range orig-x ctx warnings) (vl-parse-keyval-pattern-array fields-equiv range orig-x ctx warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-parse-keyval-pattern-array-of-vl-expr-fix-orig-x (equal (vl-parse-keyval-pattern-array fields range (vl-expr-fix orig-x) ctx warnings) (vl-parse-keyval-pattern-array fields range orig-x ctx warnings)))
Theorem:
(defthm vl-parse-keyval-pattern-array-vl-expr-equiv-congruence-on-orig-x (implies (vl-expr-equiv orig-x orig-x-equiv) (equal (vl-parse-keyval-pattern-array fields range orig-x ctx warnings) (vl-parse-keyval-pattern-array fields range orig-x-equiv ctx warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-parse-keyval-pattern-array-of-vl-context-fix-ctx (equal (vl-parse-keyval-pattern-array fields range orig-x (vl-context-fix ctx) warnings) (vl-parse-keyval-pattern-array fields range orig-x ctx warnings)))
Theorem:
(defthm vl-parse-keyval-pattern-array-vl-context-equiv-congruence-on-ctx (implies (vl-context-equiv ctx ctx-equiv) (equal (vl-parse-keyval-pattern-array fields range orig-x ctx warnings) (vl-parse-keyval-pattern-array fields range orig-x ctx-equiv warnings))) :rule-classes :congruence)
Theorem:
(defthm vl-parse-keyval-pattern-array-of-vl-warninglist-fix-warnings (equal (vl-parse-keyval-pattern-array fields range orig-x ctx (vl-warninglist-fix warnings)) (vl-parse-keyval-pattern-array fields range orig-x ctx warnings)))
Theorem:
(defthm vl-parse-keyval-pattern-array-vl-warninglist-equiv-congruence-on-warnings (implies (vl-warninglist-equiv warnings warnings-equiv) (equal (vl-parse-keyval-pattern-array fields range orig-x ctx warnings) (vl-parse-keyval-pattern-array fields range orig-x ctx warnings-equiv))) :rule-classes :congruence)