Cause an error if a function has no arguments.
(ensure-function-has-args fn description error-erp error-val ctx state) → (mv erp val state)
Function:
(defun ensure-function-has-args (fn description error-erp error-val ctx state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (msgp description) (function-namep fn (w state))))) (b* (((unless (/= (arity fn (w state)) 0)) (er-soft+ ctx error-erp error-val "~@0 must take at least one argument." description))) (value nil)))
Theorem:
(defthm return-type-of-ensure-function-has-args.erp (b* (((mv ?erp ?val ?state) (ensure-function-has-args fn description error-erp error-val ctx state))) (implies erp (equal erp error-erp))) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-ensure-function-has-args.val (b* (((mv ?erp ?val ?state) (ensure-function-has-args 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)