Lift add-var-value to lists.
(add-vars-values vars vals cstate) → new-cstate
It is an error if there are extra values or extra variables. Their number must be the same. We make this a run-time check because it is part of the conditions to be checked by the defensive dynamic semantics.
Function:
(defun add-vars-values (vars vals cstate) (declare (xargs :guard (and (identifier-listp vars) (value-listp vals) (cstatep cstate)))) (let ((__function__ 'add-vars-values)) (declare (ignorable __function__)) (b* (((when (endp vars)) (if (endp vals) (cstate-fix cstate) (reserrf (list :extra-values (value-list-fix vals))))) ((when (endp vals)) (reserrf (list :extra-variables (identifier-list-fix vars)))) ((okf cstate) (add-var-value (car vars) (car vals) cstate))) (add-vars-values (cdr vars) (cdr vals) cstate))))
Theorem:
(defthm cstate-resultp-of-add-vars-values (b* ((new-cstate (add-vars-values vars vals cstate))) (cstate-resultp new-cstate)) :rule-classes :rewrite)
Theorem:
(defthm error-info-wfp-of-add-vars-values (b* ((?new-cstate (add-vars-values vars vals cstate))) (implies (reserrp new-cstate) (error-info-wfp new-cstate))))
Theorem:
(defthm add-vars-values-of-identifier-list-fix-vars (equal (add-vars-values (identifier-list-fix vars) vals cstate) (add-vars-values vars vals cstate)))
Theorem:
(defthm add-vars-values-identifier-list-equiv-congruence-on-vars (implies (identifier-list-equiv vars vars-equiv) (equal (add-vars-values vars vals cstate) (add-vars-values vars-equiv vals cstate))) :rule-classes :congruence)
Theorem:
(defthm add-vars-values-of-value-list-fix-vals (equal (add-vars-values vars (value-list-fix vals) cstate) (add-vars-values vars vals cstate)))
Theorem:
(defthm add-vars-values-value-list-equiv-congruence-on-vals (implies (value-list-equiv vals vals-equiv) (equal (add-vars-values vars vals cstate) (add-vars-values vars vals-equiv cstate))) :rule-classes :congruence)
Theorem:
(defthm add-vars-values-of-cstate-fix-cstate (equal (add-vars-values vars vals (cstate-fix cstate)) (add-vars-values vars vals cstate)))
Theorem:
(defthm add-vars-values-cstate-equiv-congruence-on-cstate (implies (cstate-equiv cstate cstate-equiv) (equal (add-vars-values vars vals cstate) (add-vars-values vars vals cstate-equiv))) :rule-classes :congruence)