Fixing function for position structures.
Function:
(defun position-fix$inline (x) (declare (xargs :guard (positionp x))) (let ((__function__ 'position-fix)) (declare (ignorable __function__)) (mbe :logic (b* ((line (acl2::pos-fix (cdr (std::da-nth 0 x)))) (column (nfix (cdr (std::da-nth 1 x))))) (list (cons 'line line) (cons 'column column))) :exec x)))
Theorem:
(defthm positionp-of-position-fix (b* ((new-x (position-fix$inline x))) (positionp new-x)) :rule-classes :rewrite)
Theorem:
(defthm position-fix-when-positionp (implies (positionp x) (equal (position-fix x) x)))
Function:
(defun position-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (positionp acl2::x) (positionp acl2::y)))) (equal (position-fix acl2::x) (position-fix acl2::y)))
Theorem:
(defthm position-equiv-is-an-equivalence (and (booleanp (position-equiv x y)) (position-equiv x x) (implies (position-equiv x y) (position-equiv y x)) (implies (and (position-equiv x y) (position-equiv y z)) (position-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm position-equiv-implies-equal-position-fix-1 (implies (position-equiv acl2::x x-equiv) (equal (position-fix acl2::x) (position-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm position-fix-under-position-equiv (position-equiv (position-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-position-fix-1-forward-to-position-equiv (implies (equal (position-fix acl2::x) acl2::y) (position-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-position-fix-2-forward-to-position-equiv (implies (equal acl2::x (position-fix acl2::y)) (position-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm position-equiv-of-position-fix-1-forward (implies (position-equiv (position-fix acl2::x) acl2::y) (position-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm position-equiv-of-position-fix-2-forward (implies (position-equiv acl2::x (position-fix acl2::y)) (position-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)