Integer subtraction of two 4vecs.
This is a fairly conservative definition in the style of the
Verilog semantics: if either input has any X or Z bits, the result is all X
bits. We return all Xes even in cases where you might think that some bits are
``obviously'' going to be driven in a certain way. For instance, when we
subtract
When there are no X or Z bits anywhere, we just compute the (signed) difference of the two (signed) inputs.
Function:
(defun 4vec-minus (x y) (declare (xargs :guard (and (4vec-p x) (4vec-p y)))) (let ((__function__ '4vec-minus)) (declare (ignorable __function__)) (if (and (2vec-p x) (2vec-p y)) (2vec (binary-- (the integer (2vec->val x)) (the integer (2vec->val y)))) (4vec-x))))
Theorem:
(defthm 4vec-p-of-4vec-minus (b* ((diff (4vec-minus x y))) (4vec-p diff)) :rule-classes :rewrite)
Theorem:
(defthm 4vec-minus-of-2vecx-fix-x (equal (4vec-minus (2vecx-fix x) y) (4vec-minus x y)))
Theorem:
(defthm 4vec-minus-2vecx-equiv-congruence-on-x (implies (2vecx-equiv x x-equiv) (equal (4vec-minus x y) (4vec-minus x-equiv y))) :rule-classes :congruence)
Theorem:
(defthm 4vec-minus-of-2vecx-fix-y (equal (4vec-minus x (2vecx-fix y)) (4vec-minus x y)))
Theorem:
(defthm 4vec-minus-2vecx-equiv-congruence-on-y (implies (2vecx-equiv y y-equiv) (equal (4vec-minus x y) (4vec-minus x y-equiv))) :rule-classes :congruence)