Cause an error if a lambda expression does not have a given arity.
(ensure-lambda-arity lambd n description error-erp error-val ctx state) → (mv erp val state)
Function:
(defun ensure-lambda-arity (lambd n description error-erp error-val ctx state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (pseudo-lambdap lambd) (natp n) (msgp description)))) (b* (((unless (= (arity lambd (w state)) n)) (er-soft+ ctx error-erp error-val "~@0 must take ~x1 ~@2." description n (if (= n 1) "argument" "arguments")))) (value nil)))
Theorem:
(defthm return-type-of-ensure-lambda-arity.erp (b* (((mv ?erp ?val ?state) (ensure-lambda-arity lambd n description error-erp error-val ctx state))) (implies erp (equal erp error-erp))) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-ensure-lambda-arity.val (b* (((mv ?erp ?val ?state) (ensure-lambda-arity lambd 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)