Fixing function for sparseints
(sparseint-fix x) → new-x
Function:
(defun sparseint-fix$inline (x) (declare (xargs :guard (sparseint-p x))) (let ((__function__ 'sparseint-fix)) (declare (ignorable __function__)) (mbe :logic (b* ((x (sparseint$-fix x)) ((when (sparseint$-height-correctp x)) x) ((sparseint$-concat x))) (sparseint$-concatenate x.width (sparseint-fix x.lsbs) (sparseint-fix x.msbs))) :exec x)))
Theorem:
(defthm sparseint-p-of-sparseint-fix (b* ((new-x (sparseint-fix$inline x))) (sparseint-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm sparseint-fix-when-sparseint-p (implies (sparseint-p x) (equal (sparseint-fix x) x)))
Function:
(defun sparseint-equiv$inline (x y) (declare (xargs :guard (and (sparseint-p x) (sparseint-p y)))) (equal (sparseint-fix x) (sparseint-fix y)))
Theorem:
(defthm sparseint-equiv-is-an-equivalence (and (booleanp (sparseint-equiv x y)) (sparseint-equiv x x) (implies (sparseint-equiv x y) (sparseint-equiv y x)) (implies (and (sparseint-equiv x y) (sparseint-equiv y z)) (sparseint-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm sparseint-equiv-implies-equal-sparseint-fix-1 (implies (sparseint-equiv x x-equiv) (equal (sparseint-fix x) (sparseint-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm sparseint-fix-under-sparseint-equiv (sparseint-equiv (sparseint-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-sparseint-fix-1-forward-to-sparseint-equiv (implies (equal (sparseint-fix x) y) (sparseint-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-sparseint-fix-2-forward-to-sparseint-equiv (implies (equal x (sparseint-fix y)) (sparseint-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm sparseint-equiv-of-sparseint-fix-1-forward (implies (sparseint-equiv (sparseint-fix x) y) (sparseint-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm sparseint-equiv-of-sparseint-fix-2-forward (implies (sparseint-equiv x (sparseint-fix y)) (sparseint-equiv x y)) :rule-classes :forward-chaining)