Fixing function for transaction structures.
(transaction-fix x) → new-x
Function:
(defun transaction-fix$inline (x) (declare (xargs :guard (transactionp x))) (let ((__function__ 'transaction-fix)) (declare (ignorable __function__)) (mbe :logic (case (transaction-kind x) (:bond (b* ((validator (address-fix (std::da-nth 0 (cdr x)))) (stake (pos-fix (std::da-nth 1 (cdr x))))) (cons :bond (list validator stake)))) (:unbond (b* ((validator (address-fix (std::da-nth 0 (cdr x))))) (cons :unbond (list validator)))) (:other (b* ((unwrap (identity (std::da-nth 0 (cdr x))))) (cons :other (list unwrap))))) :exec x)))
Theorem:
(defthm transactionp-of-transaction-fix (b* ((new-x (transaction-fix$inline x))) (transactionp new-x)) :rule-classes :rewrite)
Theorem:
(defthm transaction-fix-when-transactionp (implies (transactionp x) (equal (transaction-fix x) x)))
Function:
(defun transaction-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (transactionp acl2::x) (transactionp acl2::y)))) (equal (transaction-fix acl2::x) (transaction-fix acl2::y)))
Theorem:
(defthm transaction-equiv-is-an-equivalence (and (booleanp (transaction-equiv x y)) (transaction-equiv x x) (implies (transaction-equiv x y) (transaction-equiv y x)) (implies (and (transaction-equiv x y) (transaction-equiv y z)) (transaction-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm transaction-equiv-implies-equal-transaction-fix-1 (implies (transaction-equiv acl2::x x-equiv) (equal (transaction-fix acl2::x) (transaction-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm transaction-fix-under-transaction-equiv (transaction-equiv (transaction-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-transaction-fix-1-forward-to-transaction-equiv (implies (equal (transaction-fix acl2::x) acl2::y) (transaction-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-transaction-fix-2-forward-to-transaction-equiv (implies (equal acl2::x (transaction-fix acl2::y)) (transaction-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm transaction-equiv-of-transaction-fix-1-forward (implies (transaction-equiv (transaction-fix acl2::x) acl2::y) (transaction-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm transaction-equiv-of-transaction-fix-2-forward (implies (transaction-equiv acl2::x (transaction-fix acl2::y)) (transaction-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm transaction-kind$inline-of-transaction-fix-x (equal (transaction-kind$inline (transaction-fix x)) (transaction-kind$inline x)))
Theorem:
(defthm transaction-kind$inline-transaction-equiv-congruence-on-x (implies (transaction-equiv x x-equiv) (equal (transaction-kind$inline x) (transaction-kind$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-transaction-fix (consp (transaction-fix x)) :rule-classes :type-prescription)