Ceiling of the log2 of a, or X if any non-2-valued bits. Must be truncated to its width (nonnegative).
Function:
(defun 4vec-clog2 (a) (declare (xargs :guard (4vec-p a))) (let ((__function__ '4vec-clog2)) (declare (ignorable __function__)) (if (and (2vec-p a) (<= 0 (2vec->val a))) (2vec (integer-length (- (2vec->val a) 1))) (4vec-x))))
Theorem:
(defthm 4vec-p-of-4vec-clog2 (b* ((res (4vec-clog2 a))) (4vec-p res)) :rule-classes :rewrite)
Theorem:
(defthm 4vec-clog2-of-2vecnatx-fix-a (equal (4vec-clog2 (2vecnatx-fix a)) (4vec-clog2 a)))
Theorem:
(defthm 4vec-clog2-2vecnatx-equiv-congruence-on-a (implies (2vecnatx-equiv a a-equiv) (equal (4vec-clog2 a) (4vec-clog2 a-equiv))) :rule-classes :congruence)