Equivalent of svexlist-eval intended to work well under GL symbolic execution.
(svexlist-eval-gl x env symbolic-params) → *
This function is provably equivalent to svexlist-eval, but is
tailored to perform well under symbolic execution. For symbolic execution, we
assume that the inputs to this function other than
The
Performance of symbolic execution (and SAT solving, when in AIG mode) is related to the size of the AIGs produced by the svex to AIG transformation (step 4, above). Two ways to decrease that size are (1) to turn certain variables into constant Xes, if it is known that they're irrelevant, and (2) to assume certain bits of some variables are Boolean-valued, which means it can be represented by just one AIG variable rather than two.
Another performance consideration is that the transformation to AIGs is itself sometimes significant. Especially for theorems proved by case-splitting, it is important not to need to repeat this transformation for each case. The function that does the transformation is memoized, but it is important in this case that it always be called with the same arguments.
The
The
Function:
(defun svexlist-eval-gl (x env symbolic-params) (declare (xargs :guard (and (svexlist-p x) (svex-env-p env) (alistp symbolic-params)))) (let ((__function__ 'svexlist-eval-gl)) (declare (ignorable __function__)) (b* ((env (make-fast-alist (svex-env-fix env))) (svars (svexlist-vars-for-symbolic-eval x env symbolic-params)) (x (svexlist-x-out-unused-vars x svars (symbolic-params-x-out-cond symbolic-params))) (x (maybe-svexlist-rewrite-fixpoint x (cdr (assoc :simplify symbolic-params)))) (boolmasks (make-fast-alist (hons-copy (ec-call (svar-boolmasks-fix (cdr (assoc :boolmasks symbolic-params))))))) ((unless (svex-env-check-boolmasks boolmasks env)) (b* ((?ign (cw "ERROR: some bits assumed to be Boolean were not~%")) (?ign (gl::gl-error 'boolcheck-failed))) (gl::gl-hide (svexlist-eval x env)))) ((mv err a4vecs) (time$ (svexlist->a4vecs-for-varlist x svars boolmasks) :msg "; svex->aigs: ~st sec, ~sa bytes.~%")) ((when err) (b* ((?ign (cw "ERROR gathering AIG bits for variables: ~@0~%" err)) (?ign (gl::gl-error 'a4env-failed))) (gl::gl-hide (svexlist-eval x env)))) ((mv ?err aig-env) (time$ (svexlist->a4vec-aig-env-for-varlist x svars boolmasks env) :msg "; env -> aig env: ~st sec, ~sa bytes.~%")) (?ign (fast-alist-free env)) (aig-env (make-fast-alist aig-env)) (ans (a4veclist-eval a4vecs aig-env))) (fast-alist-free aig-env) ans)))
Theorem:
(defthm svexlist-eval-gl-is-svexlist-eval (equal (svexlist-eval-gl x env symbolic-params) (svexlist-eval x env)))
Theorem:
(defthm svexlist-eval-for-symbolic-redef (equal (svexlist-eval-for-symbolic x env symbolic-params) (svexlist-eval-gl x env symbolic-params)))
Theorem:
(defthm svexlist-eval-gl-of-svexlist-fix-x (equal (svexlist-eval-gl (svexlist-fix x) env symbolic-params) (svexlist-eval-gl x env symbolic-params)))
Theorem:
(defthm svexlist-eval-gl-svexlist-equiv-congruence-on-x (implies (svexlist-equiv x x-equiv) (equal (svexlist-eval-gl x env symbolic-params) (svexlist-eval-gl x-equiv env symbolic-params))) :rule-classes :congruence)
Theorem:
(defthm svexlist-eval-gl-of-svex-env-fix-env (equal (svexlist-eval-gl x (svex-env-fix env) symbolic-params) (svexlist-eval-gl x env symbolic-params)))
Theorem:
(defthm svexlist-eval-gl-svex-env-equiv-congruence-on-env (implies (svex-env-equiv env env-equiv) (equal (svexlist-eval-gl x env symbolic-params) (svexlist-eval-gl x env-equiv symbolic-params))) :rule-classes :congruence)