Approximation of Verilog-style ``case equality'' of 4vecs that is X-monotonic when one argument is constant
This is a substitute for 4vec-=== that is X-monotonic, but is hoped to be good enough for most purposes.
One of the common ways of using the
We return, following the boolean-convention,
Function:
(defun 4vec-===* (left right) (declare (xargs :guard (and (4vec-p left) (4vec-p right)))) (let ((__function__ '4vec-===*)) (declare (ignorable __function__)) (b* (((4vec left)) ((4vec right)) (uppers-diff (logxor left.upper right.upper)) (lowers-diff (logxor left.lower right.lower)) (diff (logior uppers-diff lowers-diff)) (left-non-x (logorc1 left.upper left.lower)) (true (equal -1 (logandc1 diff left-non-x))) ((when true) -1) (right-non-x (logorc1 right.upper right.lower)) (not-false (equal 0 (logand left-non-x (logorc2 diff right-non-x)))) ((when not-false) (4vec-x))) 0)))
Theorem:
(defthm 4vec-p-of-4vec-===* (b* ((equal (4vec-===* left right))) (4vec-p equal)) :rule-classes :rewrite)
Theorem:
(defthm 4vec-===*-of-4vec-fix-left (equal (4vec-===* (4vec-fix left) right) (4vec-===* left right)))
Theorem:
(defthm 4vec-===*-4vec-equiv-congruence-on-left (implies (4vec-equiv left left-equiv) (equal (4vec-===* left right) (4vec-===* left-equiv right))) :rule-classes :congruence)
Theorem:
(defthm 4vec-===*-of-4vec-fix-right (equal (4vec-===* left (4vec-fix right)) (4vec-===* left right)))
Theorem:
(defthm 4vec-===*-4vec-equiv-congruence-on-right (implies (4vec-equiv right right-equiv) (equal (4vec-===* left right) (4vec-===* left right-equiv))) :rule-classes :congruence)