Add functions to the function environment.
(add-funs fundefs funenv) → new-funenv
We create a function scope for the given list of function definitions and we push that onto the function environment. We ensure that the new functions have different names from the functions already in the environment. This ACL2 function is used for all the function definitions in a block; see exec-block.
Function:
(defun add-funs (fundefs funenv) (declare (xargs :guard (and (fundef-listp fundefs) (funenvp funenv)))) (let ((__function__ 'add-funs)) (declare (ignorable __function__)) (b* (((okf funscope) (funscope-for-fundefs fundefs)) ((okf &) (ensure-funscope-disjoint funscope funenv))) (cons funscope (funenv-fix funenv)))))
Theorem:
(defthm funenv-resultp-of-add-funs (b* ((new-funenv (add-funs fundefs funenv))) (funenv-resultp new-funenv)) :rule-classes :rewrite)
Theorem:
(defthm add-funs-of-no-fundefs (equal (add-funs nil funenv) (cons nil (funenv-fix funenv))))
Theorem:
(defthm error-info-wfp-of-add-funs (b* ((?new-funenv (add-funs fundefs funenv))) (implies (reserrp new-funenv) (error-info-wfp new-funenv))))
Theorem:
(defthm add-funs-of-fundef-list-fix-fundefs (equal (add-funs (fundef-list-fix fundefs) funenv) (add-funs fundefs funenv)))
Theorem:
(defthm add-funs-fundef-list-equiv-congruence-on-fundefs (implies (fundef-list-equiv fundefs fundefs-equiv) (equal (add-funs fundefs funenv) (add-funs fundefs-equiv funenv))) :rule-classes :congruence)
Theorem:
(defthm add-funs-of-funenv-fix-funenv (equal (add-funs fundefs (funenv-fix funenv)) (add-funs fundefs funenv)))
Theorem:
(defthm add-funs-funenv-equiv-congruence-on-funenv (implies (funenv-equiv funenv funenv-equiv) (equal (add-funs fundefs funenv) (add-funs fundefs funenv-equiv))) :rule-classes :congruence)