Function scope for a list of function definitions.
(funscope-for-fundefs fundefs) → funscope
We go through the list and form a function scope for the functions. It is an error if there are two functions with the same name.
Function:
(defun funscope-for-fundefs (fundefs) (declare (xargs :guard (fundef-listp fundefs))) (let ((__function__ 'funscope-for-fundefs)) (declare (ignorable __function__)) (b* (((when (endp fundefs)) nil) ((okf scope) (funscope-for-fundefs (cdr fundefs))) (fundef (car fundefs)) (fun (fundef->name fundef)) (fun+info (omap::assoc fun scope)) ((when (consp fun+info)) (reserrf (list :duplicate-function fun)))) (omap::update fun (funinfo-for-fundef fundef) scope))))
Theorem:
(defthm funscope-resultp-of-funscope-for-fundefs (b* ((funscope (funscope-for-fundefs fundefs))) (funscope-resultp funscope)) :rule-classes :rewrite)
Theorem:
(defthm error-info-wfp-of-funscope-for-fundefs (b* ((?funscope (funscope-for-fundefs fundefs))) (implies (reserrp funscope) (error-info-wfp funscope))))
Theorem:
(defthm funscope-for-fundefs-of-fundef-list-fix-fundefs (equal (funscope-for-fundefs (fundef-list-fix fundefs)) (funscope-for-fundefs fundefs)))
Theorem:
(defthm funscope-for-fundefs-fundef-list-equiv-congruence-on-fundefs (implies (fundef-list-equiv fundefs fundefs-equiv) (equal (funscope-for-fundefs fundefs) (funscope-for-fundefs fundefs-equiv))) :rule-classes :congruence)