Function:
(defun s4vec-onehot0 (x) (declare (xargs :guard (s4vec-p x))) (let ((__function__ 's4vec-onehot0)) (declare (ignorable __function__)) (b* (((unless (s4vec-2vec-p x)) (s4vec-x)) (xint (s4vec->upper x)) ((when (sparseint-< xint 0)) (s4vec-x)) (xval (s4vec-sparseint-val (s4vec->upper x)))) (s2vec (int-to-sparseint (bool->bit (<= (logcount xval) 1)))))))
Theorem:
(defthm s4vec-p-of-s4vec-onehot0 (b* ((res (s4vec-onehot0 x))) (s4vec-p res)) :rule-classes :rewrite)
Theorem:
(defthm s4vec-onehot0-correct (b* ((?res (s4vec-onehot0 x))) (equal (s4vec->4vec res) (4vec-onehot0 (s4vec->4vec x)))))
Theorem:
(defthm s4vec-onehot0-of-s4vec-fix-x (equal (s4vec-onehot0 (s4vec-fix x)) (s4vec-onehot0 x)))
Theorem:
(defthm s4vec-onehot0-s4vec-equiv-congruence-on-x (implies (s4vec-equiv x x-equiv) (equal (s4vec-onehot0 x) (s4vec-onehot0 x-equiv))) :rule-classes :congruence)