• 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
        • Yul
        • Zcash
        • ACL2-programming-language
          • Primitive-functions
          • Translated-terms
          • Values
          • Evaluation
          • Program-equivalence
          • Functions
          • Packages
          • Programs
          • Interpreter
          • Evaluation-states
            • Eval-state
              • Eval-state-fix
                • Eval-state-case
                • Eval-state-p
                • Eval-state-equiv
                • Eval-state-init
                • Eval-state-trans
                • Eval-state-final
                • Eval-state-kind
                • Eval-state-error
              • Frame
              • Binding
              • Stack
          • 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
    • Eval-state

    Eval-state-fix

    Fixing function for eval-state structures.

    Signature
    (eval-state-fix x) → new-x
    Arguments
    x — Guard (eval-state-p x).
    Returns
    new-x — Type (eval-state-p new-x).

    Definitions and Theorems

    Function: eval-state-fix$inline

    (defun eval-state-fix$inline (x)
     (declare (xargs :guard (eval-state-p x)))
     (let ((__function__ 'eval-state-fix))
      (declare (ignorable __function__))
      (mbe
       :logic
       (case (eval-state-kind x)
         (:init
              (b* ((function (symbol-value-fix (std::da-nth 0 (cdr x))))
                   (arguments (value-list-fix (std::da-nth 1 (cdr x)))))
                (cons :init (list function arguments))))
         (:trans (b* ((stack (stack-fix (std::da-nth 0 (cdr x)))))
                   (cons :trans (list stack))))
         (:final (b* ((result (value-fix (std::da-nth 0 (cdr x)))))
                   (cons :final (list result))))
         (:error (cons :error (list))))
       :exec x)))

    Theorem: eval-state-p-of-eval-state-fix

    (defthm eval-state-p-of-eval-state-fix
      (b* ((new-x (eval-state-fix$inline x)))
        (eval-state-p new-x))
      :rule-classes :rewrite)

    Theorem: eval-state-fix-when-eval-state-p

    (defthm eval-state-fix-when-eval-state-p
      (implies (eval-state-p x)
               (equal (eval-state-fix x) x)))

    Function: eval-state-equiv$inline

    (defun eval-state-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (eval-state-p acl2::x)
                                  (eval-state-p acl2::y))))
      (equal (eval-state-fix acl2::x)
             (eval-state-fix acl2::y)))

    Theorem: eval-state-equiv-is-an-equivalence

    (defthm eval-state-equiv-is-an-equivalence
      (and (booleanp (eval-state-equiv x y))
           (eval-state-equiv x x)
           (implies (eval-state-equiv x y)
                    (eval-state-equiv y x))
           (implies (and (eval-state-equiv x y)
                         (eval-state-equiv y z))
                    (eval-state-equiv x z)))
      :rule-classes (:equivalence))

    Theorem: eval-state-equiv-implies-equal-eval-state-fix-1

    (defthm eval-state-equiv-implies-equal-eval-state-fix-1
      (implies (eval-state-equiv acl2::x x-equiv)
               (equal (eval-state-fix acl2::x)
                      (eval-state-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: eval-state-fix-under-eval-state-equiv

    (defthm eval-state-fix-under-eval-state-equiv
      (eval-state-equiv (eval-state-fix acl2::x)
                        acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-eval-state-fix-1-forward-to-eval-state-equiv

    (defthm equal-of-eval-state-fix-1-forward-to-eval-state-equiv
      (implies (equal (eval-state-fix acl2::x) acl2::y)
               (eval-state-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: equal-of-eval-state-fix-2-forward-to-eval-state-equiv

    (defthm equal-of-eval-state-fix-2-forward-to-eval-state-equiv
      (implies (equal acl2::x (eval-state-fix acl2::y))
               (eval-state-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: eval-state-equiv-of-eval-state-fix-1-forward

    (defthm eval-state-equiv-of-eval-state-fix-1-forward
      (implies (eval-state-equiv (eval-state-fix acl2::x)
                                 acl2::y)
               (eval-state-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: eval-state-equiv-of-eval-state-fix-2-forward

    (defthm eval-state-equiv-of-eval-state-fix-2-forward
      (implies (eval-state-equiv acl2::x (eval-state-fix acl2::y))
               (eval-state-equiv acl2::x acl2::y))
      :rule-classes :forward-chaining)

    Theorem: eval-state-kind$inline-of-eval-state-fix-x

    (defthm eval-state-kind$inline-of-eval-state-fix-x
      (equal (eval-state-kind$inline (eval-state-fix x))
             (eval-state-kind$inline x)))

    Theorem: eval-state-kind$inline-eval-state-equiv-congruence-on-x

    (defthm eval-state-kind$inline-eval-state-equiv-congruence-on-x
      (implies (eval-state-equiv x x-equiv)
               (equal (eval-state-kind$inline x)
                      (eval-state-kind$inline x-equiv)))
      :rule-classes :congruence)

    Theorem: consp-of-eval-state-fix

    (defthm consp-of-eval-state-fix
      (consp (eval-state-fix x))
      :rule-classes :type-prescription)