Take the conservative union of two environments.
It is assumed that the each scope block in the environment agrees on which variables have been declared. They may only disagree on the value of variables
For each scope block, the value of variables which are agreed upon by the two environment are retained. The values of all other variables are marked "unknown".
Function:
(defun union-env (x y) (declare (xargs :guard (and (envp x) (envp y)))) (let ((__function__ 'union-env)) (declare (ignorable __function__)) (if (endp x) nil (cons (union-env-block (first x) (first y)) (union-env (rest x) (rest y))))))
Theorem:
(defthm envp-of-union-env (b* ((env (union-env x y))) (envp env)) :rule-classes :rewrite)