Fixing function for maybe-type structures.
(maybe-type-fix x) → new-x
Function:
(defun maybe-type-fix$inline (x) (declare (xargs :guard (maybe-typep x))) (let ((__function__ 'maybe-type-fix)) (declare (ignorable __function__)) (mbe :logic (cond ((not x) nil) (t (b* ((fty::val (type-fix x))) fty::val))) :exec x)))
Theorem:
(defthm maybe-typep-of-maybe-type-fix (b* ((new-x (maybe-type-fix$inline x))) (maybe-typep new-x)) :rule-classes :rewrite)
Theorem:
(defthm maybe-type-fix-when-maybe-typep (implies (maybe-typep x) (equal (maybe-type-fix x) x)))
Function:
(defun maybe-type-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (maybe-typep acl2::x) (maybe-typep acl2::y)))) (equal (maybe-type-fix acl2::x) (maybe-type-fix acl2::y)))
Theorem:
(defthm maybe-type-equiv-is-an-equivalence (and (booleanp (maybe-type-equiv x y)) (maybe-type-equiv x x) (implies (maybe-type-equiv x y) (maybe-type-equiv y x)) (implies (and (maybe-type-equiv x y) (maybe-type-equiv y z)) (maybe-type-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm maybe-type-equiv-implies-equal-maybe-type-fix-1 (implies (maybe-type-equiv acl2::x x-equiv) (equal (maybe-type-fix acl2::x) (maybe-type-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm maybe-type-fix-under-maybe-type-equiv (maybe-type-equiv (maybe-type-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-maybe-type-fix-1-forward-to-maybe-type-equiv (implies (equal (maybe-type-fix acl2::x) acl2::y) (maybe-type-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-maybe-type-fix-2-forward-to-maybe-type-equiv (implies (equal acl2::x (maybe-type-fix acl2::y)) (maybe-type-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm maybe-type-equiv-of-maybe-type-fix-1-forward (implies (maybe-type-equiv (maybe-type-fix acl2::x) acl2::y) (maybe-type-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm maybe-type-equiv-of-maybe-type-fix-2-forward (implies (maybe-type-equiv acl2::x (maybe-type-fix acl2::y)) (maybe-type-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)