Restrict an svex-env to only particular variables. Variables that are present in keys but not env will be bound to X.
(svex-env-extract keys env) → sub-env
Function:
(defun svex-env-extract (keys env) (declare (xargs :guard (and (svarlist-p keys) (svex-env-p env)))) (let ((__function__ 'svex-env-extract)) (declare (ignorable __function__)) (mbe :logic (if (atom keys) nil (cons (cons (svar-fix (car keys)) (svex-env-fastlookup (car keys) env)) (svex-env-extract (cdr keys) env))) :exec (with-fast-alist env (svex-env-extract-aux keys env)))))
Theorem:
(defthm svex-env-p-of-svex-env-extract (b* ((sub-env (svex-env-extract keys env))) (svex-env-p sub-env)) :rule-classes :rewrite)
Theorem:
(defthm svex-env-lookup-of-svex-env-extract (equal (svex-env-lookup v (svex-env-extract vars env)) (if (member (svar-fix v) (svarlist-fix vars)) (svex-env-lookup v env) (4vec-x))))
Theorem:
(defthm svex-eval-extract-var-superset (implies (subsetp (svex-vars x) (svarlist-fix vars)) (equal (svex-eval x (svex-env-extract vars env)) (svex-eval x env))))
Theorem:
(defthm svexlist-eval-extract-var-superset (implies (subsetp (svexlist-vars x) (svarlist-fix vars)) (equal (svexlist-eval x (svex-env-extract vars env)) (svexlist-eval x env))))
Theorem:
(defthm svex-alist-eval-of-extract-var-supserset (implies (subsetp (svexlist-vars (svex-alist-vals x)) (svarlist-fix vars)) (equal (svex-alist-eval x (svex-env-extract vars env)) (svex-alist-eval x env))))
Theorem:
(defthm alist-keys-of-svex-env-extract (equal (alist-keys (svex-env-extract vars env)) (svarlist-fix vars)))
Theorem:
(defthm svex-env-extract-when-alist-keys-equal (implies (and (equal (alist-keys (svex-env-fix x)) keys) (no-duplicatesp keys)) (equal (svex-env-extract keys x) (svex-env-fix x))))
Theorem:
(defthm svex-env-extract-of-superset (implies (subsetp (svarlist-fix keys) (svarlist-fix keys2)) (equal (svex-env-extract keys (svex-env-extract keys2 x)) (svex-env-extract keys x))))
Theorem:
(defthm svex-env-boundp-of-svex-env-extract (b* ((?sub-env (svex-env-extract keys env))) (iff (svex-env-boundp k sub-env) (member-equal (svar-fix k) (svarlist-fix keys)))))
Theorem:
(defthm svex-env-extract-of-svarlist-fix-keys (equal (svex-env-extract (svarlist-fix keys) env) (svex-env-extract keys env)))
Theorem:
(defthm svex-env-extract-svarlist-equiv-congruence-on-keys (implies (svarlist-equiv keys keys-equiv) (equal (svex-env-extract keys env) (svex-env-extract keys-equiv env))) :rule-classes :congruence)
Theorem:
(defthm svex-env-extract-of-svex-env-fix-env (equal (svex-env-extract keys (svex-env-fix env)) (svex-env-extract keys env)))
Theorem:
(defthm svex-env-extract-svex-env-equiv-congruence-on-env (implies (svex-env-equiv env env-equiv) (equal (svex-env-extract keys env) (svex-env-extract keys env-equiv))) :rule-classes :congruence)