Cause an error if a function or lambda expression has input or output stobjs.
(ensure-function/lambda-no-stobjs stobjs-in stobjs-out 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 stobjs-in and stobjs-out lists)
to handle functions and lambda expressions uniformly.
The
Function:
(defun ensure-function/lambda-no-stobjs (stobjs-in stobjs-out description error-erp error-val ctx state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (symbol-listp stobjs-in) (symbol-listp stobjs-out) (msgp description)))) (b* (((unless (and (all-nils stobjs-in) (all-nils stobjs-out))) (er-soft+ ctx error-erp error-val "~@0 must have no input or output stobjs." description))) (value nil)))
Theorem:
(defthm return-type-of-ensure-function/lambda-no-stobjs.erp (b* (((mv ?erp ?val ?state) (ensure-function/lambda-no-stobjs stobjs-in stobjs-out description error-erp error-val ctx state))) (implies erp (equal erp error-erp))) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-ensure-function/lambda-no-stobjs.val (b* (((mv ?erp ?val ?state) (ensure-function/lambda-no-stobjs stobjs-in stobjs-out 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)