Cause an error if a value is not
(ensure-boolean-or-auto-and-return-boolean x r description error-erp error-val ctx state) → (mv erp val state)
If
Function:
(defun ensure-boolean-or-auto-and-return-boolean (x r description error-erp error-val ctx state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (booleanp r) (msgp description)))) (b* (((unless (t/nil/auto-p x)) (er-soft+ ctx error-erp error-val "~@0 must be T, NIL, or :AUTO." description))) (value (if (booleanp x) x r))))
Theorem:
(defthm return-type-of-ensure-boolean-or-auto-and-return-boolean.erp (b* (((mv ?erp ?val ?state) (ensure-boolean-or-auto-and-return-boolean x r description error-erp error-val ctx state))) (implies erp (equal erp error-erp))) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-ensure-boolean-or-auto-and-return-boolean.val (b* (((mv ?erp ?val ?state) (ensure-boolean-or-auto-and-return-boolean x r description error-erp error-val ctx state))) (and (implies erp (equal val error-val)) (implies (and (not erp) error-erp (booleanp r)) (booleanp val)))) :rule-classes :rewrite)