Fixing function for instruction structures.
(instruction-fix x) → new-x
Function:
(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:
(defthm instructionp-of-instruction-fix (b* ((new-x (instruction-fix$inline x))) (instructionp new-x)) :rule-classes :rewrite)
Theorem:
(defthm instruction-fix-when-instructionp (implies (instructionp x) (equal (instruction-fix x) x)))
Function:
(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:
(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:
(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:
(defthm instruction-fix-under-instruction-equiv (instruction-equiv (instruction-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(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:
(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:
(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:
(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:
(defthm instruction-kind$inline-of-instruction-fix-x (equal (instruction-kind$inline (instruction-fix x)) (instruction-kind$inline x)))
Theorem:
(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:
(defthm consp-of-instruction-fix (consp (instruction-fix x)) :rule-classes :type-prescription)