Cause an error if a function or lambda expression is a function in program mode or a lambda expression that calls some program-mode function.
(ensure-function/lambda-logic-mode fn/lambda description error-erp error-val ctx state) → (mv erp val state)
This error-checking function is useful
after calling ensure-function/macro/lambda
(which returns the pseudo-termfnp)
to handle functions and lambda expressions uniformly.
The
Function:
(defun ensure-function/lambda-logic-mode (fn/lambda description error-erp error-val ctx state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (pseudo-termfnp fn/lambda) (msgp description)))) (let ((__function__ 'ensure-function/lambda-logic-mode)) (declare (ignorable __function__)) (if (symbolp fn/lambda) (ensure-function-is-logic-mode$ fn/lambda description error-erp error-val) (ensure-lambda-logic-mode$ fn/lambda description error-erp error-val))))
Theorem:
(defthm return-type-of-ensure-function/lambda-logic-mode.erp (b* (((mv ?erp ?val ?state) (ensure-function/lambda-logic-mode fn/lambda description error-erp error-val ctx state))) (implies erp (equal erp error-erp))) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-ensure-function/lambda-logic-mode.val (b* (((mv ?erp ?val ?state) (ensure-function/lambda-logic-mode fn/lambda description error-erp error-val ctx state))) (and (implies erp (equal val error-val)) (implies (and (not erp) error-erp) (not val)))) :rule-classes :rewrite)