Print a (non-integer) rational in a particular print base, with radix.
(radix-print-rat x base acc) → new-acc
Function:
(defun radix-print-rat (x base acc) (declare (type ratio x) (type (unsigned-byte 5) base)) (declare (xargs :guard (and (rationalp x) (print-base-p base)))) (declare (xargs :split-types t :guard (not (integerp x)))) (let ((acl2::__function__ 'radix-print-rat)) (declare (ignorable acl2::__function__)) (case base (10 (basic-print-rat x base (list* #\r #\0 #\1 #\# acc))) (16 (basic-print-rat x base (list* #\x #\# acc))) (8 (basic-print-rat x base (list* #\o #\# acc))) (otherwise (basic-print-rat x base (list* #\b #\# acc))))))
Theorem:
(defthm character-listp-of-radix-print-rat (implies (character-listp acc) (b* ((new-acc (radix-print-rat x base acc))) (character-listp new-acc))) :rule-classes :rewrite)