Subtract one sparseint from another.
(sparseint$-binary-minus x y) → minus
Function:
(defun sparseint$-binary-minus (x y) (declare (xargs :guard (and (sparseint$-p x) (sparseint$-p y)))) (declare (xargs :guard (and (sparseint$-height-correctp x) (sparseint$-height-correctp y)))) (let ((__function__ 'sparseint$-binary-minus)) (declare (ignorable __function__)) (b* ((x.height (sparseint$-height x)) (y.height (sparseint$-height y)) (y.neg (sparseint$-bitnot y)) ((mv minus ?height) (sparseint$-plus-offset x x.height 0 y.neg y.height 1))) minus)))
Theorem:
(defthm sparseint$-p-of-sparseint$-binary-minus (b* ((minus (sparseint$-binary-minus x y))) (sparseint$-p minus)) :rule-classes :rewrite)
Theorem:
(defthm sparseint$-height-correctp-of-sparseint$-binary-minus (b* ((?minus (sparseint$-binary-minus x y))) (implies (and (sparseint$-height-correctp x) (sparseint$-height-correctp y)) (sparseint$-height-correctp minus))))
Theorem:
(defthm sparseint$-val-of-sparseint$-binary-minus (b* ((?minus (sparseint$-binary-minus x y))) (equal (sparseint$-val minus) (- (sparseint$-val x) (sparseint$-val y)))))
Theorem:
(defthm sparseint$-binary-minus-of-sparseint$-fix-x (equal (sparseint$-binary-minus (sparseint$-fix x) y) (sparseint$-binary-minus x y)))
Theorem:
(defthm sparseint$-binary-minus-sparseint$-equiv-congruence-on-x (implies (sparseint$-equiv x x-equiv) (equal (sparseint$-binary-minus x y) (sparseint$-binary-minus x-equiv y))) :rule-classes :congruence)
Theorem:
(defthm sparseint$-binary-minus-of-sparseint$-fix-y (equal (sparseint$-binary-minus x (sparseint$-fix y)) (sparseint$-binary-minus x y)))
Theorem:
(defthm sparseint$-binary-minus-sparseint$-equiv-congruence-on-y (implies (sparseint$-equiv y y-equiv) (equal (sparseint$-binary-minus x y) (sparseint$-binary-minus x y-equiv))) :rule-classes :congruence)