Add some variables to a context.
(context-add-variables var-ctxt ctxt) → new-ctxt
The variables to be added are supplied as a variable context that is used to update the context's variable context. The update may override previous pairs: this is expected; it happens with let bindings.
Function:
(defun context-add-variables (var-ctxt ctxt) (declare (xargs :guard (and (variable-contextp var-ctxt) (contextp ctxt)))) (let ((__function__ 'context-add-variables)) (declare (ignorable __function__)) (b* ((old-var-ctxt (context->variables ctxt)) (new-var-ctxt (omap::update* (variable-context-fix var-ctxt) old-var-ctxt))) (change-context ctxt :variables new-var-ctxt))))
Theorem:
(defthm contextp-of-context-add-variables (b* ((new-ctxt (context-add-variables var-ctxt ctxt))) (contextp new-ctxt)) :rule-classes :rewrite)
Theorem:
(defthm context->types-of-context-add-variables (b* ((?new-ctxt (context-add-variables var-ctxt ctxt))) (equal (context->types new-ctxt) (context->types ctxt))))
Theorem:
(defthm context-add-variables-of-variable-context-fix-var-ctxt (equal (context-add-variables (variable-context-fix var-ctxt) ctxt) (context-add-variables var-ctxt ctxt)))
Theorem:
(defthm context-add-variables-variable-context-equiv-congruence-on-var-ctxt (implies (variable-context-equiv var-ctxt var-ctxt-equiv) (equal (context-add-variables var-ctxt ctxt) (context-add-variables var-ctxt-equiv ctxt))) :rule-classes :congruence)
Theorem:
(defthm context-add-variables-of-context-fix-ctxt (equal (context-add-variables var-ctxt (context-fix ctxt)) (context-add-variables var-ctxt ctxt)))
Theorem:
(defthm context-add-variables-context-equiv-congruence-on-ctxt (implies (context-equiv ctxt ctxt-equiv) (equal (context-add-variables var-ctxt ctxt) (context-add-variables var-ctxt ctxt-equiv))) :rule-classes :congruence)