Count of 1 bits in a 4vec (X-monotonic).
Function:
(defun 4vec-onehot (x) (declare (xargs :guard (4vec-p x))) (let ((__function__ '4vec-onehot)) (declare (ignorable __function__)) (if (and (2vec-p x) (<= 0 (2vec->val x))) (b* ((x (2vec->val x))) (2vec (bool->bit (eql (logcount x) 1)))) (4vec-x))))
Theorem:
(defthm 3vec-p!-of-4vec-onehot (b* ((count (4vec-onehot x))) (3vec-p! count)) :rule-classes :rewrite)
Theorem:
(defthm 4vec-onehot-of-2vecx-fix-x (equal (4vec-onehot (2vecx-fix x)) (4vec-onehot x)))
Theorem:
(defthm 4vec-onehot-2vecx-equiv-congruence-on-x (implies (2vecx-equiv x x-equiv) (equal (4vec-onehot x) (4vec-onehot x-equiv))) :rule-classes :congruence)