• 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
        • Yul
          • Transformations
          • Language
            • Abstract-syntax
            • Dynamic-semantics
            • Concrete-syntax
            • Static-soundness
              • Static-soundess-of-execution
              • Theorems-about-cstate-to-vars-and-execution
              • Static-soundness-theorems-about-add-funs
              • Static-soundness-theorems-about-modes
              • Static-soundness-theorems-about-init-local
              • Check-var-list
              • Funinfo-safep
              • Static-soundness-theorems-about-find-fun
              • Funenv-to-funtable
              • Theorems-about-checking-expression-lists-in-reverse
                • Static-soundness-of-variable-writing
                • Funscope-to-funtable
                • Funenv-safep
                • Funscope-safep
                • Cstate-to-vars
                • Funinfo-to-funtype
                • Static-soundness-of-variable-addition
                • Static-soundness-of-variable-reading
                • Static-soundness-of-literal-execution
                • Exec-top-block-static-soundness
                • Static-soundness-of-path-execution
              • Static-semantics
              • Errors
            • Yul-json
          • 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
    • Static-soundness

    Theorems-about-checking-expression-lists-in-reverse

    Theorems about check-safe-expression-list and rev.

    Lists of expressions are used as function arguments. The static semantics checks them in order, while the dynamic semantics executes them in reverse (see exec-funcall. Since execution may have side effect, order is important. However, it is appropriate, and simpler, for the static semantics to check expressions in order without reversing them: the result is the same.

    However, this creates a ``gap'' that needs to be bridged in the static soundness proof. We do that with the theorems below. The first serves to prove the second. The third is a good simplification rule. The fourth is awkward, but it is currently needed to discharge a hypothesis in the main proof; without this, the third theorem rewrites away some relevant term.

    Definitions and Theorems

    Theorem: reserrp-of-check-safe-expression-list-of-append

    (defthm
     reserrp-of-check-safe-expression-list-of-append
     (equal
         (reserrp (check-safe-expression-list (append es es1)
                                              varset funtab))
         (or (reserrp (check-safe-expression-list es varset funtab))
             (reserrp (check-safe-expression-list es1 varset funtab)))))

    Theorem: reserrp-of-check-safe-expression-list-of-rev

    (defthm
        reserrp-of-check-safe-expression-list-of-rev
        (equal (reserrp (check-safe-expression-list (rev es)
                                                    varset funtab))
               (reserrp (check-safe-expression-list es varset funtab))))

    Theorem: check-safe-expression-list-to-len

    (defthm
      check-safe-expression-list-to-len
      (implies
           (not (reserrp (check-safe-expression-list es varset funtab)))
           (equal (check-safe-expression-list es varset funtab)
                  (len es))))

    Theorem: check-safe-expression-list-not-error-when-rev

    (defthm
     check-safe-expression-list-not-error-when-rev
     (implies
         (not (reserrp (check-safe-expression-list (rev es)
                                                   varset funtab)))
         (not (reserrp (check-safe-expression-list es varset funtab)))))