Initialize the function environment for a translation unit.
(init-fun-env tunit) → result
We go though the external declarations that form the translation unit and we build the function environment for the function definitions, starting from the empty environment.
Function:
(defun init-fun-env-aux (declons fenv) (declare (xargs :guard (and (ext-declon-listp declons) (fun-envp fenv)))) (let ((__function__ 'init-fun-env-aux)) (declare (ignorable __function__)) (b* (((when (endp declons)) (fun-env-fix fenv)) (declon (car declons))) (ext-declon-case declon :obj-declon (init-fun-env-aux (cdr declons) fenv) :fun-declon (init-fun-env-aux (cdr declons) fenv) :tag-declon (init-fun-env-aux (cdr declons) fenv) :fundef (b* (((okf fenv) (fun-env-extend declon.get fenv))) (init-fun-env-aux (cdr declons) fenv))))))
Theorem:
(defthm fun-env-resultp-of-init-fun-env-aux (b* ((result (init-fun-env-aux declons fenv))) (fun-env-resultp result)) :rule-classes :rewrite)
Theorem:
(defthm init-fun-env-aux-of-ext-declon-list-fix-declons (equal (init-fun-env-aux (ext-declon-list-fix declons) fenv) (init-fun-env-aux declons fenv)))
Theorem:
(defthm init-fun-env-aux-ext-declon-list-equiv-congruence-on-declons (implies (ext-declon-list-equiv declons declons-equiv) (equal (init-fun-env-aux declons fenv) (init-fun-env-aux declons-equiv fenv))) :rule-classes :congruence)
Theorem:
(defthm init-fun-env-aux-of-fun-env-fix-fenv (equal (init-fun-env-aux declons (fun-env-fix fenv)) (init-fun-env-aux declons fenv)))
Theorem:
(defthm init-fun-env-aux-fun-env-equiv-congruence-on-fenv (implies (fun-env-equiv fenv fenv-equiv) (equal (init-fun-env-aux declons fenv) (init-fun-env-aux declons fenv-equiv))) :rule-classes :congruence)
Function:
(defun init-fun-env (tunit) (declare (xargs :guard (transunitp tunit))) (let ((__function__ 'init-fun-env)) (declare (ignorable __function__)) (init-fun-env-aux (transunit->declons tunit) nil)))
Theorem:
(defthm fun-env-resultp-of-init-fun-env (b* ((result (init-fun-env tunit))) (fun-env-resultp result)) :rule-classes :rewrite)
Theorem:
(defthm init-fun-env-of-transunit-fix-tunit (equal (init-fun-env (transunit-fix tunit)) (init-fun-env tunit)))
Theorem:
(defthm init-fun-env-transunit-equiv-congruence-on-tunit (implies (transunit-equiv tunit tunit-equiv) (equal (init-fun-env tunit) (init-fun-env tunit-equiv))) :rule-classes :congruence)