Check if a type sum alternative is statically well-formed.
(check-alternative alternative ctxt) → (mv err? obligs)
We check the underlying product type. The guard assumptions on the context are motivated in the same way as in check-type-product.
Function:
(defun check-alternative (alternative ctxt) (declare (xargs :guard (and (alternativep alternative) (contextp ctxt)))) (declare (xargs :guard (and (null (context->functions ctxt)) (omap::emptyp (context->variables ctxt)) (null (context->obligation-vars ctxt)) (null (context->obligation-hyps ctxt))))) (let ((__function__ 'check-alternative)) (declare (ignorable __function__)) (check-type-product (alternative->product alternative) ctxt)))
Theorem:
(defthm proof-obligation-listp-of-check-alternative.obligs (b* (((mv ?err? ?obligs) (check-alternative alternative ctxt))) (proof-obligation-listp obligs)) :rule-classes :rewrite)
Theorem:
(defthm check-alternative-of-alternative-fix-alternative (equal (check-alternative (alternative-fix alternative) ctxt) (check-alternative alternative ctxt)))
Theorem:
(defthm check-alternative-alternative-equiv-congruence-on-alternative (implies (alternative-equiv alternative alternative-equiv) (equal (check-alternative alternative ctxt) (check-alternative alternative-equiv ctxt))) :rule-classes :congruence)
Theorem:
(defthm check-alternative-of-context-fix-ctxt (equal (check-alternative alternative (context-fix ctxt)) (check-alternative alternative ctxt)))
Theorem:
(defthm check-alternative-context-equiv-congruence-on-ctxt (implies (context-equiv ctxt ctxt-equiv) (equal (check-alternative alternative ctxt) (check-alternative alternative ctxt-equiv))) :rule-classes :congruence)