Cause an error if a term is not ground (i.e. it has free variables).
(ensure-term-ground term description error-erp error-val ctx state) → (mv erp val state)
Function:
(defun ensure-term-ground (term description error-erp error-val ctx state) (declare (xargs :stobjs (state))) (declare (xargs :guard (and (pseudo-termp term) (msgp description)))) (b* (((unless (null (all-vars term))) (er-soft+ ctx error-erp error-val "~@0 must contain no free variables, but it contains the ~@1." description (let ((vars (all-vars term))) (if (= (len vars) 1) (msg "variable ~x0" (car vars)) (msg "variables ~&0" vars)))))) (value nil)))
Theorem:
(defthm return-type-of-ensure-term-ground.erp (b* (((mv ?erp ?val ?state) (ensure-term-ground term description error-erp error-val ctx state))) (implies erp (equal erp error-erp))) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-ensure-term-ground.val (b* (((mv ?erp ?val ?state) (ensure-term-ground term 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)