Fixing function for escape structures.
Function:
(defun escape-fix$inline (x) (declare (xargs :guard (escapep x))) (let ((__function__ 'escape-fix)) (declare (ignorable __function__)) (mbe :logic (case (escape-kind x) (:simple (b* ((unwrap (simple-escape-fix (std::da-nth 0 (cdr x))))) (cons :simple (list unwrap)))) (:oct (b* ((unwrap (oct-escape-fix (std::da-nth 0 (cdr x))))) (cons :oct (list unwrap)))) (:hex (b* ((unwrap (str::hex-digit-char-list-fix (std::da-nth 0 (cdr x))))) (cons :hex (list unwrap)))) (:univ (b* ((unwrap (univ-char-name-fix (std::da-nth 0 (cdr x))))) (cons :univ (list unwrap))))) :exec x)))
Theorem:
(defthm escapep-of-escape-fix (b* ((new-x (escape-fix$inline x))) (escapep new-x)) :rule-classes :rewrite)
Theorem:
(defthm escape-fix-when-escapep (implies (escapep x) (equal (escape-fix x) x)))
Function:
(defun escape-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (escapep acl2::x) (escapep acl2::y)))) (equal (escape-fix acl2::x) (escape-fix acl2::y)))
Theorem:
(defthm escape-equiv-is-an-equivalence (and (booleanp (escape-equiv x y)) (escape-equiv x x) (implies (escape-equiv x y) (escape-equiv y x)) (implies (and (escape-equiv x y) (escape-equiv y z)) (escape-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm escape-equiv-implies-equal-escape-fix-1 (implies (escape-equiv acl2::x x-equiv) (equal (escape-fix acl2::x) (escape-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm escape-fix-under-escape-equiv (escape-equiv (escape-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-escape-fix-1-forward-to-escape-equiv (implies (equal (escape-fix acl2::x) acl2::y) (escape-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-escape-fix-2-forward-to-escape-equiv (implies (equal acl2::x (escape-fix acl2::y)) (escape-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm escape-equiv-of-escape-fix-1-forward (implies (escape-equiv (escape-fix acl2::x) acl2::y) (escape-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm escape-equiv-of-escape-fix-2-forward (implies (escape-equiv acl2::x (escape-fix acl2::y)) (escape-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm escape-kind$inline-of-escape-fix-x (equal (escape-kind$inline (escape-fix x)) (escape-kind$inline x)))
Theorem:
(defthm escape-kind$inline-escape-equiv-congruence-on-x (implies (escape-equiv x x-equiv) (equal (escape-kind$inline x) (escape-kind$inline x-equiv))) :rule-classes :congruence)
Theorem:
(defthm consp-of-escape-fix (consp (escape-fix x)) :rule-classes :type-prescription)