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) (:single-quote (cons :single-quote (list))) (:double-quote (cons :double-quote (list))) (:backslash (cons :backslash (list))) (:letter-n (cons :letter-n (list))) (:letter-r (cons :letter-r (list))) (:letter-t (cons :letter-t (list))) (:line-feed (cons :line-feed (list))) (:carriage-return (cons :carriage-return (list))) (:x (b* ((get (hex-pair-fix (std::da-nth 0 (cdr x))))) (cons :x (list get)))) (:u (b* ((get (hex-quad-fix (std::da-nth 0 (cdr x))))) (cons :u (list get))))) :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)