• 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
      • Riscv
        • Semantics
        • Features
        • States
        • Decoding
          • Decode
          • Decoding-of-encoding
          • Get-fields-rtype
          • Get-fields-stype
          • Get-fields-itype
          • Get-fields-btype
          • Encoding-of-decoding
          • Get-imm-jtype
          • Get-imm-btype
          • Get-imm-utype
          • Get-fields-utype
          • Get-imm-stype
          • Get-imm-itype
          • Get-fields-jtype
          • Decoding-as-inverse
            • Encoding-validp
            • Decodei
            • Decodei-is-decode
            • Get-rs2
            • Get-rs1
            • Get-rd
            • Get-opcode
            • Get-funct7
            • Get-funct3
          • Instructions
          • Encoding
          • Reads-over-writes
          • Rv32im
          • Rv64im
          • Execution
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Taspi
        • Bitcoin
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Community
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Decoding-as-inverse

    Decodei-is-decode

    Equivalence of declarative and executable decoding.

    If the encoding enc is valid, it is equal to (encode (encoding-valid-witness enc feat) feat) by the definition of encoding-validp. If we substitute that into (decode enc feat) and use decode-of-encode, that simplifies to (encoding-valid-witness enc feat), which is the same as (decodei enc feat) by definition of the latter.

    If instead the encoding enc is invalid, by definition (decodei enc feat) is nil. If (decode enc feat) were not nil, it would be a witness for encoding-validp, using encode-of-decode to show that the encoding of the witness is enc, but we had assumed that the encoding was not valid. Thus also (decode enc feat) must be nil, the same as (decodei enc feat).

    Definitions and Theorems

    Theorem: decodei-is-decode

    (defthm decodei-is-decode
      (equal (decodei enc feat)
             (decode enc feat)))