Cause an error if a function or lambda expression is a non-closed lambda expression.
(ensure-function/lambda-closed 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-closed (fn/lambda description error-erp error-val ctx state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (pseudo-termfnp fn/lambda) (msgp description)))) (b* (((unless (or (symbolp fn/lambda) (lambda-closedp fn/lambda))) (er-soft+ ctx error-erp error-val "~@0 must be closed." description))) (value nil)))
Theorem:
(defthm return-type-of-ensure-function/lambda-closed.erp (b* (((mv ?erp ?val ?state) (ensure-function/lambda-closed 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-closed.val (b* (((mv ?erp ?val ?state) (ensure-function/lambda-closed 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)