Coerces a hex-digit-char-p character into a number.
(hex-digit-char-value x) → val
For instance,
Function:
(defun hex-digit-char-value$inline (x) (declare (xargs :guard (hex-digit-char-p x))) (declare (xargs :split-types t)) (let ((acl2::__function__ 'hex-digit-char-value)) (declare (ignorable acl2::__function__)) (mbe :logic (b* (((unless (hex-digit-char-p x)) 0) (code (char-code x)) ((when (<= (char-code #\a) code)) (- code (- (char-code #\a) 10))) ((when (<= (char-code #\A) code)) (- code (- (char-code #\A) 10)))) (- code (char-code #\0))) :exec (b* (((the (unsigned-byte 8) code) (char-code (the character x))) ((when (<= 97 code)) (the (unsigned-byte 8) (- code 87))) ((when (<= 65 code)) (the (unsigned-byte 8) (- code 55)))) (the (unsigned-byte 8) (- code 48))))))
Theorem:
(defthm natp-of-hex-digit-char-value (b* ((val (hex-digit-char-value$inline x))) (natp val)) :rule-classes :type-prescription)
Theorem:
(defthm ichareqv-implies-equal-hex-digit-char-value-1 (implies (ichareqv x x-equiv) (equal (hex-digit-char-value x) (hex-digit-char-value x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm hex-digit-char-value-upper-bound (< (hex-digit-char-value x) 16) :rule-classes ((:rewrite) (:linear)))
Theorem:
(defthm unsigned-byte-p-of-hex-digit-char-value (unsigned-byte-p 4 (hex-digit-char-value x)))
Theorem:
(defthm equal-of-hex-digit-char-value-and-hex-digit-char-value (implies (and (hex-digit-char-p x) (hex-digit-char-p y)) (equal (equal (hex-digit-char-value x) (hex-digit-char-value y)) (ichareqv x y))))
Theorem:
(defthm hex-digit-char-value-of-digit-to-char (implies (and (natp n) (< n 16)) (equal (hex-digit-char-value (digit-to-char n)) n)))