Fixing function for command structures.
Function:
(defun command-fix$inline (x) (declare (xargs :guard (commandp x))) (let ((__function__ 'command-fix)) (declare (ignorable __function__)) (mbe :logic (case (command-kind x) (:increment (b* ((map (identifier-fix (std::da-nth 0 (cdr x)))) (key (operand-fix (std::da-nth 1 (cdr x)))) (value (operand-fix (std::da-nth 2 (cdr x))))) (cons :increment (list map key value)))) (:decrement (b* ((map (identifier-fix (std::da-nth 0 (cdr x)))) (key (operand-fix (std::da-nth 1 (cdr x)))) (value (operand-fix (std::da-nth 2 (cdr x))))) (cons :decrement (list map key value)))) (:instruction (b* ((get (instruction-fix (std::da-nth 0 (cdr x))))) (cons :instruction (list get))))) :exec x)))
Theorem:
(defthm commandp-of-command-fix (b* ((new-x (command-fix$inline x))) (commandp new-x)) :rule-classes :rewrite)
Theorem:
(defthm command-fix-when-commandp (implies (commandp x) (equal (command-fix x) x)))
Function:
(defun command-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (commandp acl2::x) (commandp acl2::y)))) (equal (command-fix acl2::x) (command-fix acl2::y)))
Theorem:
(defthm command-equiv-is-an-equivalence (and (booleanp (command-equiv x y)) (command-equiv x x) (implies (command-equiv x y) (command-equiv y x)) (implies (and (command-equiv x y) (command-equiv y z)) (command-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm command-equiv-implies-equal-command-fix-1 (implies (command-equiv acl2::x x-equiv) (equal (command-fix acl2::x) (command-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm command-fix-under-command-equiv (command-equiv (command-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-command-fix-1-forward-to-command-equiv (implies (equal (command-fix acl2::x) acl2::y) (command-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-command-fix-2-forward-to-command-equiv (implies (equal acl2::x (command-fix acl2::y)) (command-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm command-equiv-of-command-fix-1-forward (implies (command-equiv (command-fix acl2::x) acl2::y) (command-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm command-equiv-of-command-fix-2-forward (implies (command-equiv acl2::x (command-fix acl2::y)) (command-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm command-kind$inline-of-command-fix-x (equal (command-kind$inline (command-fix x)) (command-kind$inline x)))
Theorem:
(defthm command-kind$inline-command-equiv-congruence-on-x (implies (command-equiv x x-equiv) (equal (command-kind$inline x) (command-kind$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-command-fix (consp (command-fix x)) :rule-classes :type-prescription)