• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Pfcs
      • Wp-gen
      • Dimacs-reader
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Riscv
      • 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
        • Aleobft
        • Aleovm
          • Circuits
          • Language
            • Grammar
            • Early-version
              • Abstract-syntax
                • Binary-op
                • Literal
                • Instruction
                  • Instructionp
                  • Instruction-fix
                    • Instruction-case
                    • Instruction-ternary
                    • Instruction-equiv
                    • Instruction-equal
                    • Instruction-commit
                    • Instruction-binary
                    • Instruction-unary
                    • Instruction-hash
                    • Instruction-cast
                    • Instruction-call
                    • Instruction-assert
                    • Instruction-kind
                  • Hash-op
                  • Literal-type
                  • Operand
                  • Unary-op
                  • Identifier
                  • Commit-op
                  • Mapping
                  • Function
                  • Programdef
                  • Finalize-type
                  • Closure
                  • Register-type
                  • Finalizer
                  • Value-type
                  • Record-type
                  • Command
                  • Plaintext-type
                  • Finalization-option
                  • Visibility
                  • Register
                  • Reference
                  • Programid
                  • Locator
                  • Finalization
                  • Entry-type
                  • Regaccess
                  • Program
                  • Interface-type
                  • Ident+ptype
                  • Ident+etype
                  • Function-output
                  • Finalize-output
                  • Finalize-input
                  • Closure-output
                  • Closure-input
                  • Assert-op
                  • Function-input
                  • Equal-op
                  • Finalize-command
                  • Ternary-op
                  • Import
                  • Ident+ptype-list
                  • Operand-list
                  • Ident+etype-list
                  • Programdef-list
                  • Instruction-list
                  • Import-list
                  • Identifier-list
                  • Function-output-list
                  • Function-input-list
                  • Finalize-output-list
                  • Finalize-input-list
                  • Command-list
                  • Closure-output-list
                  • Closure-input-list
                • Parser
                • Concrete-syntax
              • Concrete-syntax
          • Leo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Community
      • Proof-automation
      • ACL2
      • Macro-libraries
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Instruction

    Instruction-fix

    Fixing function for instruction structures.

    Signature
    (instruction-fix x) → new-x
    Arguments
    x — Guard (instructionp x).
    Returns
    new-x — Type (instructionp new-x).

    Definitions and Theorems

    Function: instruction-fix$inline

    (defun instruction-fix$inline (x)
     (declare (xargs :guard (instructionp x)))
     (let ((__function__ 'instruction-fix))
      (declare (ignorable __function__))
      (mbe
         :logic
         (case (instruction-kind x)
           (:unary (b* ((op (unary-op-fix (std::da-nth 0 (cdr x))))
                        (arg (operand-fix (std::da-nth 1 (cdr x))))
                        (into (register-fix (std::da-nth 2 (cdr x)))))
                     (cons :unary (list op arg into))))
           (:binary (b* ((op (binary-op-fix (std::da-nth 0 (cdr x))))
                         (arg1 (operand-fix (std::da-nth 1 (cdr x))))
                         (arg2 (operand-fix (std::da-nth 2 (cdr x))))
                         (into (register-fix (std::da-nth 3 (cdr x)))))
                      (cons :binary (list op arg1 arg2 into))))
           (:ternary (b* ((op (ternary-op-fix (std::da-nth 0 (cdr x))))
                          (arg1 (operand-fix (std::da-nth 1 (cdr x))))
                          (arg2 (operand-fix (std::da-nth 2 (cdr x))))
                          (arg3 (operand-fix (std::da-nth 3 (cdr x))))
                          (into (register-fix (std::da-nth 4 (cdr x)))))
                       (cons :ternary (list op arg1 arg2 arg3 into))))
           (:equal (b* ((op (equal-op-fix (std::da-nth 0 (cdr x))))
                        (arg1 (operand-fix (std::da-nth 1 (cdr x))))
                        (arg2 (operand-fix (std::da-nth 2 (cdr x))))
                        (into (register-fix (std::da-nth 3 (cdr x)))))
                     (cons :equal (list op arg1 arg2 into))))
           (:assert (b* ((op (assert-op-fix (std::da-nth 0 (cdr x))))
                         (arg1 (operand-fix (std::da-nth 1 (cdr x))))
                         (arg2 (operand-fix (std::da-nth 2 (cdr x)))))
                      (cons :assert (list op arg1 arg2))))
           (:commit (b* ((op (commit-op-fix (std::da-nth 0 (cdr x))))
                         (arg1 (operand-fix (std::da-nth 1 (cdr x))))
                         (arg2 (operand-fix (std::da-nth 2 (cdr x))))
                         (into (register-fix (std::da-nth 3 (cdr x)))))
                      (cons :commit (list op arg1 arg2 into))))
           (:hash (b* ((op (hash-op-fix (std::da-nth 0 (cdr x))))
                       (arg (operand-fix (std::da-nth 1 (cdr x))))
                       (into (register-fix (std::da-nth 2 (cdr x)))))
                    (cons :hash (list op arg into))))
           (:cast (b* ((args (operand-list-fix (std::da-nth 0 (cdr x))))
                       (into (register-fix (std::da-nth 1 (cdr x))))
                       (as (register-type-fix (std::da-nth 2 (cdr x)))))
                    (cons :cast (list args into as))))
           (:call (b* ((ref (reference-fix (std::da-nth 0 (cdr x))))
                       (args (operand-list-fix (std::da-nth 1 (cdr x))))
                       (into (register-fix (std::da-nth 2 (cdr x)))))
                    (cons :call (list ref args into)))))
         :exec x)))

    Theorem: instructionp-of-instruction-fix

    (defthm instructionp-of-instruction-fix
      (b* ((new-x (instruction-fix$inline x)))
        (instructionp new-x))
      :rule-classes :rewrite)

    Theorem: instruction-fix-when-instructionp

    (defthm instruction-fix-when-instructionp
      (implies (instructionp x)
               (equal (instruction-fix x) x)))

    Function: instruction-equiv$inline

    (defun instruction-equiv$inline (acl2::x acl2::y)
      (declare (xargs :guard (and (instructionp acl2::x)
                                  (instructionp acl2::y))))
      (equal (instruction-fix acl2::x)
             (instruction-fix acl2::y)))

    Theorem: instruction-equiv-is-an-equivalence

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

    Theorem: instruction-equiv-implies-equal-instruction-fix-1

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

    Theorem: instruction-fix-under-instruction-equiv

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

    Theorem: equal-of-instruction-fix-1-forward-to-instruction-equiv

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

    Theorem: equal-of-instruction-fix-2-forward-to-instruction-equiv

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

    Theorem: instruction-equiv-of-instruction-fix-1-forward

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

    Theorem: instruction-equiv-of-instruction-fix-2-forward

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

    Theorem: instruction-kind$inline-of-instruction-fix-x

    (defthm instruction-kind$inline-of-instruction-fix-x
      (equal (instruction-kind$inline (instruction-fix x))
             (instruction-kind$inline x)))

    Theorem: instruction-kind$inline-instruction-equiv-congruence-on-x

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

    Theorem: consp-of-instruction-fix

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