How many characters are required to represent an integer?
(int-size x print-base) → size
Function:
(defun int-size (x print-base) (declare (xargs :guard (and (integerp x) (print-base-p print-base)))) (let ((acl2::__function__ 'int-size)) (declare (ignorable acl2::__function__)) (if (< x 0) (+ 1 (nat-size (- x) print-base)) (nat-size x print-base))))
Theorem:
(defthm posp-of-int-size (b* ((size (int-size x print-base))) (posp size)) :rule-classes :type-prescription)