Cause an error if a value is not a boolean.
(ensure-value-is-boolean x description error-erp error-val ctx state) → (mv erp val state)
Function:
(defun ensure-value-is-boolean (x description error-erp error-val ctx state) (declare (xargs :stobjs (state))) (declare (xargs :guard (msgp description))) (b* (((unless (booleanp x)) (er-soft+ ctx error-erp error-val "~@0 must be T or NIL, but it is ~x1 instead." description x))) (value nil)))
Theorem:
(defthm return-type-of-ensure-value-is-boolean.erp (b* (((mv ?erp ?val ?state) (ensure-value-is-boolean x description error-erp error-val ctx state))) (implies erp (equal erp error-erp))) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-ensure-value-is-boolean.val (b* (((mv ?erp ?val ?state) (ensure-value-is-boolean x 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)