Cause an error if a recursive function
has an unknown measure (i.e. one with
(ensure-function-known-measure fn description error-erp error-val ctx state) → (mv erp val state)
Function:
(defun ensure-function-known-measure (fn description error-erp error-val ctx state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (msgp description) (and (logic-function-namep fn (w state)) (recursivep fn nil (w state)))))) (b* (((when (eq (car (measure fn (w state))) :?)) (er-soft+ ctx error-erp error-val "~@0 must have a known measure, i.e. not one of the form (:? ...)." description))) (value nil)))
Theorem:
(defthm return-type-of-ensure-function-known-measure.erp (b* (((mv ?erp ?val ?state) (ensure-function-known-measure fn description error-erp error-val ctx state))) (implies erp (equal erp error-erp))) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-ensure-function-known-measure.val (b* (((mv ?erp ?val ?state) (ensure-function-known-measure fn 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)