Turn (i) a finite map from byte arrays to byte arrays into (ii) a finite map from nibble arrays to byte arrays.
(bytelist-to-nibblelist-keys map) → map1
This corresponds to
Function:
(defun bytelist-to-nibblelist-keys-aux (bytes) (declare (xargs :guard (byte-listp bytes))) (b* (((when (endp bytes)) nil) (byte (byte-fix (car bytes))) (nibble-hi (floor byte 16)) (nibble-lo (mod byte 16)) (nibbles (bytelist-to-nibblelist-keys-aux (cdr bytes)))) (list* nibble-hi nibble-lo nibbles)))
Theorem:
(defthm nibble-listp-of-bytelist-to-nibblelist-keys-aux (b* ((nibbles (bytelist-to-nibblelist-keys-aux bytes))) (nibble-listp nibbles)) :rule-classes :rewrite)
Theorem:
(defthm bytelist-to-nibblelist-keys-aux-of-byte-list-fix-bytes (equal (bytelist-to-nibblelist-keys-aux (byte-list-fix bytes)) (bytelist-to-nibblelist-keys-aux bytes)))
Theorem:
(defthm bytelist-to-nibblelist-keys-aux-byte-list-equiv-congruence-on-bytes (implies (byte-list-equiv bytes bytes-equiv) (equal (bytelist-to-nibblelist-keys-aux bytes) (bytelist-to-nibblelist-keys-aux bytes-equiv))) :rule-classes :congruence)
Function:
(defun bytelist-to-nibblelist-keys (map) (declare (xargs :guard (bytelist-bytelist-mapp map))) (b* (((unless (mbt (bytelist-bytelist-mapp map))) nil) ((when (omap::emptyp map)) nil) ((mv key val) (omap::head map)) (key (byte-list-fix key)) (val (byte-list-fix val)) (key1 (bytelist-to-nibblelist-keys-aux key)) (map1 (bytelist-to-nibblelist-keys (omap::tail map)))) (omap::update key1 val map1)))
Theorem:
(defthm nibblelist-bytelist-mapp-of-bytelist-to-nibblelist-keys (b* ((map1 (bytelist-to-nibblelist-keys map))) (nibblelist-bytelist-mapp map1)) :rule-classes :rewrite)
Theorem:
(defthm bytelist-to-nibblelist-keys-of-bytelist-bytelist-mfix-map (equal (bytelist-to-nibblelist-keys (bytelist-bytelist-mfix map)) (bytelist-to-nibblelist-keys map)))
Theorem:
(defthm bytelist-to-nibblelist-keys-bytelist-bytelist-mequiv-congruence-on-map (implies (bytelist-bytelist-mequiv map map-equiv) (equal (bytelist-to-nibblelist-keys map) (bytelist-to-nibblelist-keys map-equiv))) :rule-classes :congruence)