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