• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Error-checking
        • Apt
        • Abnf
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Prime-field-constraint-systems
        • Soft
        • Bv
        • Imp-language
        • Event-macros
        • Bitcoin
        • Ethereum
          • Mmp-trees
          • Semaphore
          • Database
          • Cryptography
          • Rlp
          • Transactions
            • Make-signed-transaction
            • Transaction
            • Maybe-byte-list20
            • Rlp-decode-transaction
            • Rlp-encode-transaction
            • Rlp-transaction-encoding-p
            • Hex-prefix
            • Basics
            • Addresses
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Java
          • C
          • Syntheto
          • Number-theory
          • Cryptography
          • Lists-light
          • File-io-light
          • Json
          • Built-ins
          • Solidity
          • Axe
          • Std-extensions
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Execloader
        • Axe
      • Testing-utilities
      • Math
    • Transactions

    Rlp-transaction-encoding-p

    Check if a byte array is an RLP encoding of a transaction.

    This is a declarative, non-executable definition, which essentially characterizes the image of rlp-encode-transaction (over transaction that can be encoded, i.e. such that rlp-encode-transaction returns a nil error flag).

    By definition, the witness function is right inverse of the encoding function, over the valid encodings.

    Definitions and Theorems

    Theorem: rlp-transaction-encoding-p-suff

    (defthm
        rlp-transaction-encoding-p-suff
        (implies
             (and (transactionp transaction)
                  (b* (((mv error? encoding1)
                        (rlp-encode-transaction transaction)))
                      (and (not error?)
                           (equal encoding1 (byte-list-fix encoding)))))
             (rlp-transaction-encoding-p encoding)))

    Theorem: booleanp-of-rlp-transaction-encoding-p

    (defthm booleanp-of-rlp-transaction-encoding-p
            (b* ((yes/no (rlp-transaction-encoding-p encoding)))
                (booleanp yes/no))
            :rule-classes :rewrite)

    Theorem: rlp-transaction-encoding-p-of-byte-list-fix-encoding

    (defthm rlp-transaction-encoding-p-of-byte-list-fix-encoding
            (equal (rlp-transaction-encoding-p (byte-list-fix encoding))
                   (rlp-transaction-encoding-p encoding)))

    Theorem: rlp-transaction-encoding-p-byte-list-equiv-congruence-on-encoding

    (defthm
       rlp-transaction-encoding-p-byte-list-equiv-congruence-on-encoding
       (implies (byte-list-equiv encoding encoding-equiv)
                (equal (rlp-transaction-encoding-p encoding)
                       (rlp-transaction-encoding-p encoding-equiv)))
       :rule-classes :congruence)

    Theorem: rlp-transactionp-of-rlp-transaction-encoding-witness

    (defthm
       rlp-transactionp-of-rlp-transaction-encoding-witness
       (implies
            (rlp-transaction-encoding-p encoding)
            (transactionp (rlp-transaction-encoding-witness encoding))))

    Theorem: rlp-encode-transaction-of-rlp-transaction-encoding-witness

    (defthm
      rlp-encode-transaction-of-rlp-transaction-encoding-witness
      (implies (rlp-transaction-encoding-p encoding)
               (b* (((mv error? encoding1)
                     (rlp-encode-transaction
                          (rlp-transaction-encoding-witness encoding))))
                   (and (not error?)
                        (equal encoding1 (byte-list-fix encoding))))))

    Theorem: rlp-transaction-encoding-p-of-rlp-transaction-encode-when-no-error

    (defthm
      rlp-transaction-encoding-p-of-rlp-transaction-encode-when-no-error
      (implies (not (mv-nth 0 (rlp-encode-transaction transaction)))
               (rlp-transaction-encoding-p
                    (mv-nth 1
                            (rlp-encode-transaction transaction)))))