Atomic if-then-else of 4vecs, with a 3vec test; doesn't unfloat then/else values.
See 4vec-?. This is identical except that we assume
Function:
(defun 3vec-? (test then else) (declare (xargs :guard (and (4vec-p test) (4vec-p then) (4vec-p else)))) (let ((__function__ '3vec-?)) (declare (ignorable __function__)) (b* (((4vec test)) ((when (eql test.upper 0)) (4vec-fix else)) ((when (not (eql test.lower 0))) (4vec-fix then)) ((4vec then)) ((4vec else))) (4vec (logior then.upper else.upper then.lower else.lower) (logand then.upper else.upper then.lower else.lower)))))
Theorem:
(defthm 4vec-p-of-3vec-? (b* ((choice (3vec-? test then else))) (4vec-p choice)) :rule-classes :rewrite)
Theorem:
(defthm 3vec-?-of-4vec-fix-test (equal (3vec-? (4vec-fix test) then else) (3vec-? test then else)))
Theorem:
(defthm 3vec-?-4vec-equiv-congruence-on-test (implies (4vec-equiv test test-equiv) (equal (3vec-? test then else) (3vec-? test-equiv then else))) :rule-classes :congruence)
Theorem:
(defthm 3vec-?-of-4vec-fix-then (equal (3vec-? test (4vec-fix then) else) (3vec-? test then else)))
Theorem:
(defthm 3vec-?-4vec-equiv-congruence-on-then (implies (4vec-equiv then then-equiv) (equal (3vec-? test then else) (3vec-? test then-equiv else))) :rule-classes :congruence)
Theorem:
(defthm 3vec-?-of-4vec-fix-else (equal (3vec-? test then (4vec-fix else)) (3vec-? test then else)))
Theorem:
(defthm 3vec-?-4vec-equiv-congruence-on-else (implies (4vec-equiv else else-equiv) (equal (3vec-? test then else) (3vec-? test then else-equiv))) :rule-classes :congruence)