Fixtype of Java pointers.
See pointerp for details.
Function:
(defun pointer-fix (x) (declare (xargs :guard (pointerp x))) (mbe :logic (if (pointerp x) x (new-pointer-raw nil)) :exec x))
Theorem:
(defthm pointerp-of-pointer-fix (b* ((fixed-x (pointer-fix x))) (pointerp fixed-x)) :rule-classes :rewrite)
Theorem:
(defthm pointer-fix-when-pointerp (implies (pointerp x) (equal (pointer-fix x) x)))
Function:
(defun pointer-equiv$inline (acl2::x acl2::y) (declare (xargs :guard (and (pointerp acl2::x) (pointerp acl2::y)))) (equal (pointer-fix acl2::x) (pointer-fix acl2::y)))
Theorem:
(defthm pointer-equiv-is-an-equivalence (and (booleanp (pointer-equiv x y)) (pointer-equiv x x) (implies (pointer-equiv x y) (pointer-equiv y x)) (implies (and (pointer-equiv x y) (pointer-equiv y z)) (pointer-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm pointer-equiv-implies-equal-pointer-fix-1 (implies (pointer-equiv acl2::x x-equiv) (equal (pointer-fix acl2::x) (pointer-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm pointer-fix-under-pointer-equiv (pointer-equiv (pointer-fix acl2::x) acl2::x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-pointer-fix-1-forward-to-pointer-equiv (implies (equal (pointer-fix acl2::x) acl2::y) (pointer-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-pointer-fix-2-forward-to-pointer-equiv (implies (equal acl2::x (pointer-fix acl2::y)) (pointer-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm pointer-equiv-of-pointer-fix-1-forward (implies (pointer-equiv (pointer-fix acl2::x) acl2::y) (pointer-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)
Theorem:
(defthm pointer-equiv-of-pointer-fix-2-forward (implies (pointer-equiv acl2::x (pointer-fix acl2::y)) (pointer-equiv acl2::x acl2::y)) :rule-classes :forward-chaining)