• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • 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
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
        • Ethereum
          • Mmp-trees
          • Semaphore
          • Database
          • Cryptography
          • Rlp
          • Transactions
          • Hex-prefix
          • Basics
            • Byte-arrays
              • Bytes
              • Words
              • Nibbles
              • Scalars
              • Nibble-arrays
            • Addresses
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Basics

    Byte-arrays

    Byte arrays.

    [YP:3] mentions the set \mathbb{B} of byte arrays, and [YP:(178)] defines it as consisting of all finite sequences of bytes. We use the library type byte-list to model \mathbb{B}.

    [YP:3] also introduces the notation \mathbb{B}_k to denote the set of byte arrays of length k. We use the library types byte-list20, byte-list32, and byte-list64 to model \mathbb{B}_k for k\in\{20,32,64\}. Arrays of 20 bytes may represent addresses [YP:4.1]. Arrays of 32 bytes may represent Keccak-256 hashes. Arrays of 64 bytes may represent Keccak-512 hashes.

    Definitions and Theorems

    Theorem: nat-listp-when-byte-listp

    (defthm nat-listp-when-byte-listp
      (implies (byte-listp bytes)
               (nat-listp bytes)))

    Theorem: car-of-byte-list-fix

    (defthm car-of-byte-list-fix
      (implies (consp x)
               (equal (car (byte-list-fix x))
                      (byte-fix (car x)))))

    Theorem: cdr-of-byte-list-fix

    (defthm cdr-of-byte-list-fix
      (equal (cdr (byte-list-fix x))
             (byte-list-fix (cdr x))))

    Theorem: byte-list-fix-rewrite-unsigned-byte-list-fix

    (defthm byte-list-fix-rewrite-unsigned-byte-list-fix
      (equal (byte-list-fix x)
             (unsigned-byte-list-fix 8 x)))