Fixing function for sandwich structures.
(sandwich-fix x) → new-x
Function:
(defun sandwich-fix$inline (x) (declare (xargs :guard (sandwich-p x))) (let ((acl2::__function__ 'sandwich-fix)) (declare (ignorable acl2::__function__)) (mbe :logic (b* ((bread (ifix (cdr (std::da-nth 0 x)))) (fillings (symbol-fix (cdr (std::da-nth 1 x))))) (list (cons 'bread bread) (cons 'fillings fillings))) :exec x)))
Theorem:
(defthm sandwich-p-of-sandwich-fix (b* ((new-x (sandwich-fix$inline x))) (sandwich-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm sandwich-fix-when-sandwich-p (implies (sandwich-p x) (equal (sandwich-fix x) x)))
Function:
(defun sandwich-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (sandwich-p acl2::x) (sandwich-p acl2::y)))) (equal (sandwich-fix acl2::x) (sandwich-fix acl2::y)))
Theorem:
(defthm sandwich-equiv-is-an-equivalence (and (booleanp (sandwich-equiv x y)) (sandwich-equiv x x) (implies (sandwich-equiv x y) (sandwich-equiv y x)) (implies (and (sandwich-equiv x y) (sandwich-equiv y z)) (sandwich-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm sandwich-equiv-implies-equal-sandwich-fix-1 (implies (sandwich-equiv acl2::x x-equiv) (equal (sandwich-fix acl2::x) (sandwich-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm sandwich-fix-under-sandwich-equiv (sandwich-equiv (sandwich-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-sandwich-fix-1-forward-to-sandwich-equiv (implies (equal (sandwich-fix acl2::x) acl2::y) (sandwich-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-sandwich-fix-2-forward-to-sandwich-equiv (implies (equal acl2::x (sandwich-fix acl2::y)) (sandwich-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm sandwich-equiv-of-sandwich-fix-1-forward (implies (sandwich-equiv (sandwich-fix acl2::x) acl2::y) (sandwich-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm sandwich-equiv-of-sandwich-fix-2-forward (implies (sandwich-equiv acl2::x (sandwich-fix acl2::y)) (sandwich-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)