Fixing function for range structures.
Function:
(defun range-fix$inline (x) (declare (xargs :guard (range-p x))) (let ((__function__ 'range-fix)) (declare (ignorable __function__)) (mbe :logic (b* ((lsb (nfix (std::prod-car x))) (width (acl2::maybe-posp-fix (std::prod-cdr x)))) (std::prod-cons lsb width)) :exec x)))
Theorem:
(defthm range-p-of-range-fix (b* ((new-x (range-fix$inline x))) (range-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm range-fix-when-range-p (implies (range-p x) (equal (range-fix x) x)))
Function:
(defun range-equiv$inline (x y) (declare (xargs :guard (and (range-p x) (range-p y)))) (equal (range-fix x) (range-fix y)))
Theorem:
(defthm range-equiv-is-an-equivalence (and (booleanp (range-equiv x y)) (range-equiv x x) (implies (range-equiv x y) (range-equiv y x)) (implies (and (range-equiv x y) (range-equiv y z)) (range-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm range-equiv-implies-equal-range-fix-1 (implies (range-equiv x x-equiv) (equal (range-fix x) (range-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm range-fix-under-range-equiv (range-equiv (range-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-range-fix-1-forward-to-range-equiv (implies (equal (range-fix x) y) (range-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-range-fix-2-forward-to-range-equiv (implies (equal x (range-fix y)) (range-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm range-equiv-of-range-fix-1-forward (implies (range-equiv (range-fix x) y) (range-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm range-equiv-of-range-fix-2-forward (implies (range-equiv x (range-fix y)) (range-equiv x y)) :rule-classes :forward-chaining)