• 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
            • Step-from-trans
            • Call-primitive-function
            • Step-from-init
            • Put-leftmost-nonconst
            • Exec-outcome
              • Exec-outcome-case
              • Exec-outcome-fix
                • Exec-outcome-equiv
                • Exec-outcome-p
                • Exec-outcome-terminating
                • Exec-outcome-nonterminating
                • Exec-outcome-kind
                • Exec-outcome-error
              • Stepn
              • Step
              • Terminatingp
              • Get-leftmost-nonconst
              • Exec-call
              • Step*
            • Program-equivalence
            • Functions
            • Packages
            • Programs
            • Interpreter
            • Evaluation-states
          • 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
    • Exec-outcome

    Exec-outcome-fix

    Fixing function for exec-outcome structures.

    Signature
    (exec-outcome-fix x) → new-x
    Arguments
    x — Guard (exec-outcome-p x).
    Returns
    new-x — Type (exec-outcome-p new-x).

    Definitions and Theorems

    Function: exec-outcome-fix$inline

    (defun exec-outcome-fix$inline (x)
     (declare (xargs :guard (exec-outcome-p x)))
     (let ((__function__ 'exec-outcome-fix))
      (declare (ignorable __function__))
      (mbe
       :logic
       (case (exec-outcome-kind x)
        (:terminating (b* ((result (value-fix (std::da-nth 0 (cdr x)))))
                        (cons :terminating (list result))))
        (:error (cons :error (list)))
        (:nonterminating (cons :nonterminating (list))))
       :exec x)))

    Theorem: exec-outcome-p-of-exec-outcome-fix

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

    Theorem: exec-outcome-fix-when-exec-outcome-p

    (defthm exec-outcome-fix-when-exec-outcome-p
      (implies (exec-outcome-p x)
               (equal (exec-outcome-fix x) x)))

    Function: exec-outcome-equiv$inline

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

    Theorem: exec-outcome-equiv-is-an-equivalence

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

    Theorem: exec-outcome-equiv-implies-equal-exec-outcome-fix-1

    (defthm exec-outcome-equiv-implies-equal-exec-outcome-fix-1
      (implies (exec-outcome-equiv acl2::x x-equiv)
               (equal (exec-outcome-fix acl2::x)
                      (exec-outcome-fix x-equiv)))
      :rule-classes (:congruence))

    Theorem: exec-outcome-fix-under-exec-outcome-equiv

    (defthm exec-outcome-fix-under-exec-outcome-equiv
      (exec-outcome-equiv (exec-outcome-fix acl2::x)
                          acl2::x)
      :rule-classes (:rewrite :rewrite-quoted-constant))

    Theorem: equal-of-exec-outcome-fix-1-forward-to-exec-outcome-equiv

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

    Theorem: equal-of-exec-outcome-fix-2-forward-to-exec-outcome-equiv

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

    Theorem: exec-outcome-equiv-of-exec-outcome-fix-1-forward

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

    Theorem: exec-outcome-equiv-of-exec-outcome-fix-2-forward

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

    Theorem: exec-outcome-kind$inline-of-exec-outcome-fix-x

    (defthm exec-outcome-kind$inline-of-exec-outcome-fix-x
      (equal (exec-outcome-kind$inline (exec-outcome-fix x))
             (exec-outcome-kind$inline x)))

    Theorem: exec-outcome-kind$inline-exec-outcome-equiv-congruence-on-x

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

    Theorem: consp-of-exec-outcome-fix

    (defthm consp-of-exec-outcome-fix
      (consp (exec-outcome-fix x))
      :rule-classes :type-prescription)