Check that a variable is unique.
(var-unique-vars var allvars) → new-allvars
Check that it does not occur in the set of all variables found so far, and add it to that set if successful.
This is very similar to add-var, but it has a different purpose.
Function:
(defun var-unique-vars (var allvars) (declare (xargs :guard (and (identifierp var) (identifier-setp allvars)))) (let ((__function__ 'var-unique-vars)) (declare (ignorable __function__)) (if (in (identifier-fix var) (identifier-set-fix allvars)) (reserrf (list :non-unique-var (identifier-fix var))) (insert (identifier-fix var) (identifier-set-fix allvars)))))
Theorem:
(defthm identifier-set-resultp-of-var-unique-vars (b* ((new-allvars (var-unique-vars var allvars))) (identifier-set-resultp new-allvars)) :rule-classes :rewrite)
Theorem:
(defthm var-unique-vars-to-set-insert (b* ((allvars1 (var-unique-vars var allvars))) (implies (not (reserrp allvars1)) (equal allvars1 (insert (identifier-fix var) (identifier-set-fix allvars))))))
Theorem:
(defthm var-unique-vars-of-identifier-fix-var (equal (var-unique-vars (identifier-fix var) allvars) (var-unique-vars var allvars)))
Theorem:
(defthm var-unique-vars-identifier-equiv-congruence-on-var (implies (identifier-equiv var var-equiv) (equal (var-unique-vars var allvars) (var-unique-vars var-equiv allvars))) :rule-classes :congruence)
Theorem:
(defthm var-unique-vars-of-identifier-set-fix-allvars (equal (var-unique-vars var (identifier-set-fix allvars)) (var-unique-vars var allvars)))
Theorem:
(defthm var-unique-vars-identifier-set-equiv-congruence-on-allvars (implies (identifier-set-equiv allvars allvars-equiv) (equal (var-unique-vars var allvars) (var-unique-vars var allvars-equiv))) :rule-classes :congruence)