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