• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • C
        • Soft
        • Bv
        • Imp-language
        • Ethereum
          • Mmp-trees
            • Mmp-encode-n/c
            • Mmp-encode-c-max
            • Mmp-encode
            • Mmp-write
            • Mmp-decode
            • Mmp-encode-u-map
            • Nibblelist-bytelist-map-sup-len-key
            • Mmp-encode-c-forall
            • Mmp-read
            • Mmp-encoding-p
            • Bytelist-to-nibblelist-keys
              • Bytelist-to-nibblelist-keys-aux
              • Mmp-encode-c-exists
              • Bytelist-bytelist-map
              • Nibblelist-bytelist-map
            • Semaphore
            • Database
            • Cryptography
            • Rlp
            • Transactions
            • Hex-prefix
            • Basics
            • Addresses
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Bytelist-to-nibblelist-keys

    Bytelist-to-nibblelist-keys-aux

    Turn a sequence of bytes into a sequence of nibbles.

    Signature
    (bytelist-to-nibblelist-keys-aux bytes) → nibbles
    Arguments
    bytes — Guard (byte-listp bytes).
    Returns
    nibbles — Type (nibble-listp nibbles).

    This corresponds to [YP:(191)], but here the conversion is expressed via recursion instead of indexing.

    Definitions and Theorems

    Function: bytelist-to-nibblelist-keys-aux

    (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: nibble-listp-of-bytelist-to-nibblelist-keys-aux

    (defthm nibble-listp-of-bytelist-to-nibblelist-keys-aux
      (b* ((nibbles (bytelist-to-nibblelist-keys-aux bytes)))
        (nibble-listp nibbles))
      :rule-classes :rewrite)

    Theorem: bytelist-to-nibblelist-keys-aux-of-byte-list-fix-bytes

    (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: bytelist-to-nibblelist-keys-aux-byte-list-equiv-congruence-on-bytes

    (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)