• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
      • Riscv
      • Des
      • Ethereum
        • Mmp-trees
        • Semaphore
        • Database
        • Cryptography
        • Rlp
        • Transactions
        • Hex-prefix
        • Basics
          • Byte-arrays
            • Bytes
            • Words
            • Nibbles
            • Scalars
            • Nibble-arrays
          • Addresses
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • 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)))