(svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc) → (mv err env nextvar1)
Function:
(defun svex-varmasks/env->aig-env-rec (vars masks boolmasks env nextvar acc) (declare (xargs :guard (and (svarlist-p vars) (svex-mask-alist-p masks) (svar-boolmasks-p boolmasks) (svex-env-p env) (natp nextvar)))) (let ((__function__ 'svex-varmasks/env->aig-env-rec)) (declare (ignorable __function__)) (b* (((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)) (4vec (4vec-fix (svex-env-lookup (svar-fix (car vars)) env))) (env-part (4vmask-to-a4vec-env mask boolmask 4vec nextvar)) (nextvar (+ (lnfix nextvar) (4vmask-to-a4vec-varcount mask boolmask)))) (svex-varmasks/env->aig-env-rec (cdr vars) masks boolmasks env nextvar (append env-part acc)))))
Theorem:
(defthm return-type-of-svex-varmasks/env->aig-env-rec.err (b* (((mv ?err ?env ?nextvar1) (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc))) (implies (svex-mask-alist-p masks) (iff err (not (svex-maskbits-ok vars masks))))) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-svex-varmasks/env->aig-env-rec.nextvar1 (b* (((mv ?err ?env ?nextvar1) (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc))) (implies (and (svex-mask-alist-p masks) (svar-boolmasks-p boolmasks)) (equal nextvar1 (+ (nfix nextvar) (svex-maskbits-for-vars vars masks boolmasks))))) :rule-classes :rewrite)
Theorem:
(defthm key-exists-in-svex-varmasks/env->aig-env-rec (implies (and (svex-mask-alist-p masks) (svar-boolmasks-p boolmasks)) (iff (hons-assoc-equal v (mv-nth 1 (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc))) (or (hons-assoc-equal v acc) (and (natp v) (<= (nfix nextvar) v) (< v (+ (nfix nextvar) (svex-maskbits-for-vars vars masks boolmasks))))))))
Theorem:
(defthm svex-varmasks/env->aig-env-accumulator-elim (implies (syntaxp (not (equal acc ''nil))) (equal (mv-nth 1 (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc)) (append (mv-nth 1 (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar nil)) acc))))
Theorem:
(defthm 4vmask-to-a4vec-vars-subset-of-keys (subsetp-equal (nat-bool-a4vec-vars (4vmask-to-a4vec mask boolmask nextvar)) (alist-keys (4vmask-to-a4vec-env mask boolmask val nextvar))))
Theorem:
(defthm member-nat-bool-a4vec-vars-of-lookup-when-upper-bounded (implies (and (nat-bool-a4env-p a4acc) (nat-bool-a4env-upper-boundp nextvar a4acc) (<= (nfix nextvar) k)) (not (member k (nat-bool-a4vec-vars (cdr (hons-assoc-equal v a4acc)))))))
Theorem:
(defthm 4vmask-to-a4vec-env-vars-not-intersect-when-upper-bounded (implies (and (nat-bool-a4env-p a4acc) (double-rewrite (nat-bool-a4env-upper-boundp nextvar a4acc))) (not (intersectp (nat-bool-a4vec-vars (cdr (hons-assoc-equal v a4acc))) (alist-keys (4vmask-to-a4vec-env mask boolmask val nextvar))))))
Theorem:
(defthm svex-env-boolmasks-ok-necc (implies (svex-env-boolmasks-ok env boolmasks) (4vec-boolmaskp (svex-env-lookup v env) (svar-boolmasks-lookup v boolmasks))))
Theorem:
(defthm svex-env-boolmasks-ok-witnessing-witness-rule-correct (implies (not ((lambda (v boolmasks env) (not (4vec-boolmaskp (svex-env-lookup v env) (svar-boolmasks-lookup v boolmasks)))) (svex-env-boolmasks-ok-witness env boolmasks) boolmasks env)) (svex-env-boolmasks-ok env boolmasks)) :rule-classes nil)
Theorem:
(defthm svex-env-boolmasks-ok-instancing-instance-rule-correct (implies (not (4vec-boolmaskp (svex-env-lookup v env) (svar-boolmasks-lookup v boolmasks))) (not (svex-env-boolmasks-ok env boolmasks))) :rule-classes nil)
Theorem:
(defthm eval-svex-varmasks->a4env-rec-with-env (b* (((mv err a4env ?nextvar1) (svex-varmasks->a4env-rec vars masks boolmasks nextvar nil)) ((mv ?err1 env ?nextvar1) (svex-varmasks/env->aig-env-rec vars (svex-mask-alist-extract-vars masks) boolmasks goalenv nextvar nil))) (implies (and (not err) (svex-mask-alist-p masks) (svar-boolmasks-p boolmasks) (svex-env-boolmasks-ok goalenv boolmasks)) (svex-envs-mask-equiv-on-vars vars masks (svex-a4vec-env-eval a4env env) goalenv))))
Theorem:
(defthm svex-varmasks/env->aig-env-rec-of-svarlist-fix-vars (equal (svex-varmasks/env->aig-env-rec (svarlist-fix vars) masks boolmasks env nextvar acc) (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc)))
Theorem:
(defthm svex-varmasks/env->aig-env-rec-svarlist-equiv-congruence-on-vars (implies (svarlist-equiv vars vars-equiv) (equal (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc) (svex-varmasks/env->aig-env-rec vars-equiv masks boolmasks env nextvar acc))) :rule-classes :congruence)
Theorem:
(defthm svex-varmasks/env->aig-env-rec-of-svex-mask-alist-fix-masks (equal (svex-varmasks/env->aig-env-rec vars (svex-mask-alist-fix masks) boolmasks env nextvar acc) (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc)))
Theorem:
(defthm svex-varmasks/env->aig-env-rec-svex-mask-alist-equiv-congruence-on-masks (implies (svex-mask-alist-equiv masks masks-equiv) (equal (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc) (svex-varmasks/env->aig-env-rec vars masks-equiv boolmasks env nextvar acc))) :rule-classes :congruence)
Theorem:
(defthm svex-varmasks/env->aig-env-rec-of-svar-boolmasks-fix-boolmasks (equal (svex-varmasks/env->aig-env-rec vars masks (svar-boolmasks-fix boolmasks) env nextvar acc) (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc)))
Theorem:
(defthm svex-varmasks/env->aig-env-rec-svar-boolmasks-equiv-congruence-on-boolmasks (implies (svar-boolmasks-equiv boolmasks boolmasks-equiv) (equal (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc) (svex-varmasks/env->aig-env-rec vars masks boolmasks-equiv env nextvar acc))) :rule-classes :congruence)
Theorem:
(defthm svex-varmasks/env->aig-env-rec-of-svex-env-fix-env (equal (svex-varmasks/env->aig-env-rec vars masks boolmasks (svex-env-fix env) nextvar acc) (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc)))
Theorem:
(defthm svex-varmasks/env->aig-env-rec-svex-env-equiv-congruence-on-env (implies (svex-env-equiv env env-equiv) (equal (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc) (svex-varmasks/env->aig-env-rec vars masks boolmasks env-equiv nextvar acc))) :rule-classes :congruence)
Theorem:
(defthm svex-varmasks/env->aig-env-rec-of-nfix-nextvar (equal (svex-varmasks/env->aig-env-rec vars masks boolmasks env (nfix nextvar) acc) (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc)))
Theorem:
(defthm svex-varmasks/env->aig-env-rec-nat-equiv-congruence-on-nextvar (implies (nat-equiv nextvar nextvar-equiv) (equal (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar acc) (svex-varmasks/env->aig-env-rec vars masks boolmasks env nextvar-equiv acc))) :rule-classes :congruence)