Usually faster alternative to svex-vars.
(svex-collect-vars x) → vars
We compute a list of variables which occur in the svex
Theorem:
(defthm svex-collect-vars-correct (set-equiv (svex-collect-vars x) (svex-vars x)))
This function is usually more efficient than svex-vars. It walks over the svex, gathering variables into an accumulator and keeping track of which subtrees have already been explored using a seen table. This avoids computing exact variable information for each subexpression.
The implementation of this function is ugly and you would not want to reason
about it; instead we typically prefer to reason about svex-vars and
appeal to
Function:
(defun svex-collect-vars (x) (declare (xargs :guard (svex-p x))) (let ((__function__ 'svex-collect-vars)) (declare (ignorable __function__)) (b* (((mv seen vars) (svex-collect-vars1 x nil nil))) (fast-alist-free seen) vars)))
Theorem:
(defthm svarlist-p-of-svex-collect-vars (b* ((vars (svex-collect-vars x))) (svarlist-p vars)) :rule-classes :rewrite)
Theorem:
(defthm svex-collect-vars-of-svex-fix-x (equal (svex-collect-vars (svex-fix x)) (svex-collect-vars x)))
Theorem:
(defthm svex-collect-vars-svex-equiv-congruence-on-x (implies (svex-equiv x x-equiv) (equal (svex-collect-vars x) (svex-collect-vars x-equiv))) :rule-classes :congruence)
Theorem:
(defthm svex-collect-vars-correct (set-equiv (svex-collect-vars x) (svex-vars x)))