Add a condition obligation hypothesis to a context.
(context-add-condition cond ctxt) → new-ctxt
The hypothesis is added at the end, because its well-formedness may depend on the preceding hypotheses.
Function:
(defun context-add-condition (cond ctxt) (declare (xargs :guard (and (expressionp cond) (contextp ctxt)))) (let ((__function__ 'context-add-condition)) (declare (ignorable __function__)) (change-context ctxt :obligation-hyps (append (context->obligation-hyps ctxt) (list (obligation-hyp-condition cond))))))
Theorem:
(defthm contextp-of-context-add-condition (b* ((new-ctxt (context-add-condition cond ctxt))) (contextp new-ctxt)) :rule-classes :rewrite)
Theorem:
(defthm context->types-of-context-add-condition (b* ((?new-ctxt (context-add-condition cond ctxt))) (equal (context->types new-ctxt) (context->types ctxt))))
Theorem:
(defthm context-add-condition-of-expression-fix-cond (equal (context-add-condition (expression-fix cond) ctxt) (context-add-condition cond ctxt)))
Theorem:
(defthm context-add-condition-expression-equiv-congruence-on-cond (implies (expression-equiv cond cond-equiv) (equal (context-add-condition cond ctxt) (context-add-condition cond-equiv ctxt))) :rule-classes :congruence)
Theorem:
(defthm context-add-condition-of-context-fix-ctxt (equal (context-add-condition cond (context-fix ctxt)) (context-add-condition cond ctxt)))
Theorem:
(defthm context-add-condition-context-equiv-congruence-on-ctxt (implies (context-equiv ctxt ctxt-equiv) (equal (context-add-condition cond ctxt) (context-add-condition cond ctxt-equiv))) :rule-classes :congruence)