Convert a string to the corresponding true list of natural numbers below 256.
(string=>nats string) → nats
Function:
(defun string=>nats (string) (declare (xargs :guard (stringp string))) (let ((__function__ 'string=>nats)) (declare (ignorable __function__)) (chars=>nats (explode string))))
Theorem:
(defthm return-type-of-string=>nats (b* ((nats (string=>nats string))) (unsigned-byte-listp 8 nats)) :rule-classes :rewrite)
Theorem:
(defthm nat-listp-of-string=>nats (b* ((nats (string=>nats string))) (nat-listp nats)) :rule-classes :rewrite)
Theorem:
(defthm len-of-string=>nats (implies (stringp string) (equal (len (string=>nats string)) (length string))))
Theorem:
(defthm nth-of-string=>nats (equal (nth n (string=>nats string)) (if (< (nfix n) (len (explode string))) (char-code (char string n)) nil)))
Theorem:
(defthm consp-of-string=>nats (iff (consp (string=>nats string)) (consp (explode string))))
Theorem:
(defthm string=>nats-of-implode (implies (character-listp chars) (equal (string=>nats (implode chars)) (chars=>nats chars))))
Theorem:
(defthm string=>nats-of-str-fix-string (equal (string=>nats (str-fix string)) (string=>nats string)))
Theorem:
(defthm string=>nats-streqv-congruence-on-string (implies (streqv string string-equiv) (equal (string=>nats string) (string=>nats string-equiv))) :rule-classes :congruence)