Extend a function environment with a function definition.
(fun-env-extend fundef fenv) → result
If the environment already has a function with the same name, this operation returns an error.
Function:
(defun fun-env-extend (fundef fenv) (declare (xargs :guard (and (fundefp fundef) (fun-envp fenv)))) (let ((__function__ 'fun-env-extend)) (declare (ignorable __function__)) (b* ((fenv (fun-env-fix fenv)) ((fundef fundef) fundef) (name (fundef->name fundef)) ((when (fun-env-lookup name fenv)) (reserrf (list :duplicate-function-definition name))) (info (fun-info-from-fundef fundef))) (omap::update name info fenv))))
Theorem:
(defthm fun-env-resultp-of-fun-env-extend (b* ((result (fun-env-extend fundef fenv))) (fun-env-resultp result)) :rule-classes :rewrite)
Theorem:
(defthm fun-env-extend-of-fundef-fix-fundef (equal (fun-env-extend (fundef-fix fundef) fenv) (fun-env-extend fundef fenv)))
Theorem:
(defthm fun-env-extend-fundef-equiv-congruence-on-fundef (implies (fundef-equiv fundef fundef-equiv) (equal (fun-env-extend fundef fenv) (fun-env-extend fundef-equiv fenv))) :rule-classes :congruence)
Theorem:
(defthm fun-env-extend-of-fun-env-fix-fenv (equal (fun-env-extend fundef (fun-env-fix fenv)) (fun-env-extend fundef fenv)))
Theorem:
(defthm fun-env-extend-fun-env-equiv-congruence-on-fenv (implies (fun-env-equiv fenv fenv-equiv) (equal (fun-env-extend fundef fenv) (fun-env-extend fundef fenv-equiv))) :rule-classes :congruence)