(svex-varmasks->a4env-rec vars masks boolmasks nextvar acc) → (mv err a4env nextvar1)
Function:
(defun svex-varmasks->a4env-rec (vars masks boolmasks nextvar acc) (declare (xargs :guard (and (svarlist-p vars) (svex-mask-alist-p masks) (svar-boolmasks-p boolmasks) (natp nextvar) (nat-bool-a4env-p! acc)))) (let ((__function__ 'svex-varmasks->a4env-rec)) (declare (ignorable __function__)) (b* ((acc (svex-a4vec-env-fix acc)) ((when (atom vars)) (mv nil acc (lnfix nextvar))) (mask (svex-mask-lookup (svex-var (car vars)) masks)) ((when (sparseint-< mask 0)) (mv (msg "Negative mask: ~x0~%" (svar-fix (car vars))) acc (lnfix nextvar))) (boolmask (svar-boolmasks-lookup (car vars) boolmasks)) (a4vec (4vmask-to-a4vec mask boolmask nextvar)) (nextvar (+ (lnfix nextvar) (4vmask-to-a4vec-varcount mask boolmask)))) (svex-varmasks->a4env-rec (cdr vars) masks boolmasks nextvar (cons (cons (svar-fix (car vars)) a4vec) acc)))))
Theorem:
(defthm return-type-of-svex-varmasks->a4env-rec.err (b* (((mv ?err ?a4env ?nextvar1) (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc))) (iff err (not (svex-maskbits-ok vars masks)))) :rule-classes :rewrite)
Theorem:
(defthm nat-bool-a4env-p!-of-svex-varmasks->a4env-rec.a4env (implies (nat-bool-a4env-p! acc) (b* (((mv ?err ?a4env ?nextvar1) (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc))) (nat-bool-a4env-p! a4env))) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-svex-varmasks->a4env-rec.nextvar1 (b* (((mv ?err ?a4env ?nextvar1) (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc))) (equal nextvar1 (+ (nfix nextvar) (svex-maskbits-for-vars vars masks boolmasks)))) :rule-classes :rewrite)
Theorem:
(defthm svex-varmasks->a4env-rec-accumulator-elim (implies (syntaxp (not (equal acc ''nil))) (b* (((mv err1 a4env1 nextvar1) (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc)) ((mv err2 a4env2 nextvar2) (svex-varmasks->a4env-rec vars masks boolmasks nextvar nil))) (and (equal err1 err2) (equal a4env1 (append a4env2 (svex-a4vec-env-fix acc))) (equal nextvar1 nextvar2)))))
Theorem:
(defthm member-vars-of-svex-varmasks->a4env-rec (iff (member v (nat-bool-a4env-vars (mv-nth 1 (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc)))) (or (member v (nat-bool-a4env-vars acc)) (and (natp v) (<= (nfix nextvar) v) (< v (+ (nfix nextvar) (svex-maskbits-for-vars vars masks boolmasks)))))))
Theorem:
(defthm svex-varmasks->a4env-rec-lower-bounds (implies (and (nat-bool-a4env-lower-boundp bound acc) (<= (nfix bound) (nfix nextvar))) (nat-bool-a4env-lower-boundp bound (mv-nth 1 (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc)))))
Theorem:
(defthm svex-varmasks->a4env-rec-upper-bounds (implies (and (nat-bool-a4env-upper-boundp bound acc) (<= (+ (nfix nextvar) (svex-maskbits-for-vars vars masks boolmasks)) (nfix bound))) (nat-bool-a4env-upper-boundp bound (mv-nth 1 (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc)))))
Theorem:
(defthm key-exists-in-svex-varmasks->a4env-rec (b* (((mv ?err ?a4env ?nextvar1) (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc))) (implies (not err) (iff (hons-assoc-equal v a4env) (or (member v (svarlist-fix vars)) (hons-assoc-equal v (svex-a4vec-env-fix acc)))))))
Theorem:
(defthm alist-keys-of-svex-varmasks->a4env-rec (b* (((mv ?err ?a4env ?nextvar1) (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc))) (implies (not err) (equal (alist-keys a4env) (append (rev (svarlist-fix vars)) (alist-keys (svex-a4vec-env-fix acc)))))))
Theorem:
(defthm svex-varmasks->a4env-rec-of-svarlist-fix-vars (equal (svex-varmasks->a4env-rec (svarlist-fix vars) masks boolmasks nextvar acc) (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc)))
Theorem:
(defthm svex-varmasks->a4env-rec-svarlist-equiv-congruence-on-vars (implies (svarlist-equiv vars vars-equiv) (equal (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc) (svex-varmasks->a4env-rec vars-equiv masks boolmasks nextvar acc))) :rule-classes :congruence)
Theorem:
(defthm svex-varmasks->a4env-rec-of-svex-mask-alist-fix-masks (equal (svex-varmasks->a4env-rec vars (svex-mask-alist-fix masks) boolmasks nextvar acc) (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc)))
Theorem:
(defthm svex-varmasks->a4env-rec-svex-mask-alist-equiv-congruence-on-masks (implies (svex-mask-alist-equiv masks masks-equiv) (equal (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc) (svex-varmasks->a4env-rec vars masks-equiv boolmasks nextvar acc))) :rule-classes :congruence)
Theorem:
(defthm svex-varmasks->a4env-rec-of-svar-boolmasks-fix-boolmasks (equal (svex-varmasks->a4env-rec vars masks (svar-boolmasks-fix boolmasks) nextvar acc) (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc)))
Theorem:
(defthm svex-varmasks->a4env-rec-svar-boolmasks-equiv-congruence-on-boolmasks (implies (svar-boolmasks-equiv boolmasks boolmasks-equiv) (equal (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc) (svex-varmasks->a4env-rec vars masks boolmasks-equiv nextvar acc))) :rule-classes :congruence)
Theorem:
(defthm svex-varmasks->a4env-rec-of-nfix-nextvar (equal (svex-varmasks->a4env-rec vars masks boolmasks (nfix nextvar) acc) (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc)))
Theorem:
(defthm svex-varmasks->a4env-rec-nat-equiv-congruence-on-nextvar (implies (nat-equiv nextvar nextvar-equiv) (equal (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc) (svex-varmasks->a4env-rec vars masks boolmasks nextvar-equiv acc))) :rule-classes :congruence)
Theorem:
(defthm svex-varmasks->a4env-rec-of-svex-a4vec-env-fix-acc (equal (svex-varmasks->a4env-rec vars masks boolmasks nextvar (svex-a4vec-env-fix acc)) (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc)))
Theorem:
(defthm svex-varmasks->a4env-rec-svex-a4vec-env-equiv-congruence-on-acc (implies (svex-a4vec-env-equiv acc acc-equiv) (equal (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc) (svex-varmasks->a4env-rec vars masks boolmasks nextvar acc-equiv))) :rule-classes :congruence)