Fixing function for address structures.
Function:
(defun address-fix$inline (x) (declare (xargs :guard (address-p x))) (let ((__function__ 'address-fix)) (declare (ignorable __function__)) (mbe :logic (b* ((path (path-fix (if (or (atom x) (not (eq (car x) :address))) x (nth 1 x)))) (index (acl2::maybe-natp-fix (if (or (atom x) (not (eq (car x) :address))) nil (nth 2 x)))) (scope (addr-scope-fix (if (or (atom x) (not (eq (car x) :address))) 0 (nth 3 x))))) (if (and (eql scope 0) (eq index nil)) path (list :address path index scope))) :exec x)))
Theorem:
(defthm address-p-of-address-fix (b* ((new-x (address-fix$inline x))) (address-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm address-fix-when-address-p (implies (address-p x) (equal (address-fix x) x)))
Function:
(defun address-equiv$inline (x y) (declare (xargs :guard (and (address-p x) (address-p y)))) (equal (address-fix x) (address-fix y)))
Theorem:
(defthm address-equiv-is-an-equivalence (and (booleanp (address-equiv x y)) (address-equiv x x) (implies (address-equiv x y) (address-equiv y x)) (implies (and (address-equiv x y) (address-equiv y z)) (address-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm address-equiv-implies-equal-address-fix-1 (implies (address-equiv x x-equiv) (equal (address-fix x) (address-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm address-fix-under-address-equiv (address-equiv (address-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-address-fix-1-forward-to-address-equiv (implies (equal (address-fix x) y) (address-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-address-fix-2-forward-to-address-equiv (implies (equal x (address-fix y)) (address-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm address-equiv-of-address-fix-1-forward (implies (address-equiv (address-fix x) y) (address-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm address-equiv-of-address-fix-2-forward (implies (address-equiv x (address-fix y)) (address-equiv x y)) :rule-classes :forward-chaining)