Check if a list of top-level constructs is statically well-formed.
(check-toplevel-list tops ctxt) → (mv err? obligs)
Function:
(defun check-toplevel-list (tops ctxt) (declare (xargs :guard (and (toplevel-listp tops) (contextp ctxt)))) (declare (xargs :guard (and (null (context->types ctxt)) (null (context->functions ctxt)) (omap::emptyp (context->variables ctxt)) (null (context->obligation-vars ctxt)) (null (context->obligation-hyps ctxt))))) (let ((__function__ 'check-toplevel-list)) (declare (ignorable __function__)) (b* (((when (endp tops)) (mv nil nil)) ((mv err? obligs ctxt) (check-toplevel (car tops) ctxt)) ((when err?) (mv err? nil)) ((mv err? more-obligs) (check-toplevel-list (cdr tops) ctxt)) ((when err?) (mv err? nil))) (mv nil (append obligs more-obligs)))))
Theorem:
(defthm proof-obligation-listp-of-check-toplevel-list.obligs (b* (((mv ?err? ?obligs) (check-toplevel-list tops ctxt))) (proof-obligation-listp obligs)) :rule-classes :rewrite)
Theorem:
(defthm check-toplevel-list-of-toplevel-list-fix-tops (equal (check-toplevel-list (toplevel-list-fix tops) ctxt) (check-toplevel-list tops ctxt)))
Theorem:
(defthm check-toplevel-list-toplevel-list-equiv-congruence-on-tops (implies (toplevel-list-equiv tops tops-equiv) (equal (check-toplevel-list tops ctxt) (check-toplevel-list tops-equiv ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-toplevel-list-of-context-fix-ctxt (equal (check-toplevel-list tops (context-fix ctxt)) (check-toplevel-list tops ctxt)))
Theorem:
(defthm check-toplevel-list-context-equiv-congruence-on-ctxt (implies (context-equiv ctxt ctxt-equiv) (equal (check-toplevel-list tops ctxt) (check-toplevel-list tops ctxt-equiv))) :rule-classes :congruence)