Fixing function for parstate structures.
Function:
(defun parstate-fix$inline (x) (declare (xargs :guard (parstatep x))) (let ((__function__ 'parstate-fix)) (declare (ignorable __function__)) (mbe :logic (b* ((bytes (acl2::byte-list-fix (cdr (std::da-nth 0 x)))) (position (position-fix (cdr (std::da-nth 1 x)))) (chars-read (char+position-list-fix (cdr (std::da-nth 2 x)))) (chars-unread (char+position-list-fix (cdr (std::da-nth 3 x)))) (tokens-read (token+span-list-fix (cdr (std::da-nth 4 x)))) (tokens-read-len (nfix (cdr (std::da-nth 5 x)))) (tokens-unread (token+span-list-fix (cdr (std::da-nth 6 x)))) (checkpoints (acl2::nat-list-fix (cdr (std::da-nth 7 x)))) (gcc (acl2::bool-fix (cdr (std::da-nth 8 x)))) (size (nfix (cdr (std::da-nth 9 x))))) (let ((tokens-read-len (len tokens-read)) (size (+ (len bytes) (len chars-unread) (len tokens-unread)))) (list (cons 'bytes bytes) (cons 'position position) (cons 'chars-read chars-read) (cons 'chars-unread chars-unread) (cons 'tokens-read tokens-read) (cons 'tokens-read-len tokens-read-len) (cons 'tokens-unread tokens-unread) (cons 'checkpoints checkpoints) (cons 'gcc gcc) (cons 'size size)))) :exec x)))
Theorem:
(defthm parstatep-of-parstate-fix (b* ((new-x (parstate-fix$inline x))) (parstatep new-x)) :rule-classes :rewrite)
Theorem:
(defthm parstate-fix-when-parstatep (implies (parstatep x) (equal (parstate-fix x) x)))
Function:
(defun parstate-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (parstatep acl2::x) (parstatep acl2::y)))) (equal (parstate-fix acl2::x) (parstate-fix acl2::y)))
Theorem:
(defthm parstate-equiv-is-an-equivalence (and (booleanp (parstate-equiv x y)) (parstate-equiv x x) (implies (parstate-equiv x y) (parstate-equiv y x)) (implies (and (parstate-equiv x y) (parstate-equiv y z)) (parstate-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm parstate-equiv-implies-equal-parstate-fix-1 (implies (parstate-equiv acl2::x x-equiv) (equal (parstate-fix acl2::x) (parstate-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm parstate-fix-under-parstate-equiv (parstate-equiv (parstate-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-parstate-fix-1-forward-to-parstate-equiv (implies (equal (parstate-fix acl2::x) acl2::y) (parstate-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-parstate-fix-2-forward-to-parstate-equiv (implies (equal acl2::x (parstate-fix acl2::y)) (parstate-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm parstate-equiv-of-parstate-fix-1-forward (implies (parstate-equiv (parstate-fix acl2::x) acl2::y) (parstate-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm parstate-equiv-of-parstate-fix-2-forward (implies (parstate-equiv acl2::x (parstate-fix acl2::y)) (parstate-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)