Determine the radix for a
(vl-base-to-radix base) → radix
Function:
(defun vl-base-to-radix (base) (declare (xargs :guard (character-listp base))) (let ((__function__ 'vl-base-to-radix)) (declare (ignorable __function__)) (cond ((or (member #\h base) (member #\H base)) 16) ((or (member #\d base) (member #\D base)) 10) ((or (member #\o base) (member #\O base)) 8) ((or (member #\b base) (member #\B base)) 2) (t (progn$ (raise "programming error") 2)))))
Theorem:
(defthm natp-of-vl-base-to-radix (b* ((radix (vl-base-to-radix base))) (natp radix)) :rule-classes :type-prescription)
Theorem:
(defthm vl-base-to-radix-upper (<= (vl-base-to-radix base) 16) :rule-classes :linear)
Theorem:
(defthm vl-base-to-radix-lower (<= 2 (vl-base-to-radix base)) :rule-classes :linear)