Ensure that a function scope is disjoint from a function environment.
(ensure-funscope-disjoint funscope funenv) → _
That is, ensure that the function names in the scope are disjoint from all the function names in the environment's scopes. This is used to ensure that there is no function shadowing: see add-funs.
Function:
(defun ensure-funscope-disjoint (funscope funenv) (declare (xargs :guard (and (funscopep funscope) (funenvp funenv)))) (let ((__function__ 'ensure-funscope-disjoint)) (declare (ignorable __function__)) (b* (((when (endp funenv)) nil) (overlap (intersect (omap::keys (funscope-fix funscope)) (omap::keys (funscope-fix (car funenv))))) ((unless (emptyp overlap)) (reserrf (list :duplicate-functions overlap)))) (ensure-funscope-disjoint funscope (cdr funenv)))))
Theorem:
(defthm reserr-optionp-of-ensure-funscope-disjoint (b* ((_ (ensure-funscope-disjoint funscope funenv))) (reserr-optionp _)) :rule-classes :rewrite)
Theorem:
(defthm ensure-funscope-disjoint-of-empty-funscope-not-error (not (reserrp (ensure-funscope-disjoint nil funenv))))
Theorem:
(defthm error-info-wfp-of-ensure-funscope-disjoint (b* ((?_ (ensure-funscope-disjoint funscope funenv))) (implies (reserrp _) (error-info-wfp _))))
Theorem:
(defthm ensure-funscope-disjoint-of-funscope-fix-funscope (equal (ensure-funscope-disjoint (funscope-fix funscope) funenv) (ensure-funscope-disjoint funscope funenv)))
Theorem:
(defthm ensure-funscope-disjoint-funscope-equiv-congruence-on-funscope (implies (funscope-equiv funscope funscope-equiv) (equal (ensure-funscope-disjoint funscope funenv) (ensure-funscope-disjoint funscope-equiv funenv))) :rule-classes :congruence)
Theorem:
(defthm ensure-funscope-disjoint-of-funenv-fix-funenv (equal (ensure-funscope-disjoint funscope (funenv-fix funenv)) (ensure-funscope-disjoint funscope funenv)))
Theorem:
(defthm ensure-funscope-disjoint-funenv-equiv-congruence-on-funenv (implies (funenv-equiv funenv funenv-equiv) (equal (ensure-funscope-disjoint funscope funenv) (ensure-funscope-disjoint funscope funenv-equiv))) :rule-classes :congruence)