Cause an error if a value is not a tuple of a given length.
(ensure-tuple x n description error-erp error-val ctx state) → (mv erp val state)
Function:
(defun ensure-tuple (x n description error-erp error-val ctx state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (natp n) (msgp description)))) (b* (((unless (tuplep n x)) (er-soft+ ctx error-erp error-val "~@0 must be a NIL-terminated list of ~x1 elements." description n))) (value nil)))
Theorem:
(defthm return-type-of-ensure-tuple.erp (b* (((mv ?erp ?val ?state) (ensure-tuple x n description error-erp error-val ctx state))) (implies erp (equal erp error-erp))) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-ensure-tuple.val (b* (((mv ?erp ?val ?state) (ensure-tuple x n 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)