Apply binary
(add-values val1 val2) → resval
We only support arithmetic values for now (no pointer arithmetic).
Function:
(defun add-values (val1 val2) (declare (xargs :guard (and (valuep val1) (valuep val2)))) (let ((__function__ 'add-values)) (declare (ignorable __function__)) (if (and (value-arithmeticp val1) (value-arithmeticp val2)) (add-arithmetic-values val1 val2) (error (list :add-mistype :required :arithmetic :arithmetic :supplied (value-fix val1) (value-fix val2))))))
Theorem:
(defthm value-resultp-of-add-values (b* ((resval (add-values val1 val2))) (value-resultp resval)) :rule-classes :rewrite)
Theorem:
(defthm add-values-of-value-fix-val1 (equal (add-values (value-fix val1) val2) (add-values val1 val2)))
Theorem:
(defthm add-values-value-equiv-congruence-on-val1 (implies (value-equiv val1 val1-equiv) (equal (add-values val1 val2) (add-values val1-equiv val2))) :rule-classes :congruence)
Theorem:
(defthm add-values-of-value-fix-val2 (equal (add-values val1 (value-fix val2)) (add-values val1 val2)))
Theorem:
(defthm add-values-value-equiv-congruence-on-val2 (implies (value-equiv val2 val2-equiv) (equal (add-values val1 val2) (add-values val1 val2-equiv))) :rule-classes :congruence)