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