(sparseint$-truncate width x) → new-x
Function:
(defun sparseint$-truncate (width x) (declare (xargs :guard (and (posp width) (sparseint$-p x)))) (let ((__function__ 'sparseint$-truncate)) (declare (ignorable __function__)) (sparseint$-case x :leaf (sparseint$-fix x) :concat (if (< x.width (lposfix width)) (sparseint$-fix x) (sparseint$-truncate width x.lsbs)))))
Theorem:
(defthm sparseint$-p-of-sparseint$-truncate (b* ((new-x (sparseint$-truncate width x))) (sparseint$-p new-x)) :rule-classes :rewrite)
Theorem:
(defthm loghead-of-sparseint$-truncate (b* ((?new-x (sparseint$-truncate width x))) (implies (equal width1 (pos-fix width)) (equal (loghead width1 (sparseint$-val new-x)) (loghead width1 (sparseint$-val x))))))
Theorem:
(defthm logapp-of-sparseint$-truncate (b* ((?new-x (sparseint$-truncate width x))) (implies (equal width1 (pos-fix width)) (equal (logapp width1 (sparseint$-val new-x) y) (logapp width1 (sparseint$-val x) y)))))
Theorem:
(defthm sparseint$-height-correctp-of-sparseint$-truncate (b* ((?new-x (sparseint$-truncate width x))) (implies (sparseint$-height-correctp x) (sparseint$-height-correctp new-x))))
Theorem:
(defthm height-of-sparseint$-truncate (b* ((?new-x (sparseint$-truncate width x))) (<= (sparseint$-height new-x) (sparseint$-height x))) :rule-classes :linear)
Theorem:
(defthm sparseint$-truncate-of-pos-fix-width (equal (sparseint$-truncate (pos-fix width) x) (sparseint$-truncate width x)))
Theorem:
(defthm sparseint$-truncate-pos-equiv-congruence-on-width (implies (pos-equiv width width-equiv) (equal (sparseint$-truncate width x) (sparseint$-truncate width-equiv x))) :rule-classes :congruence)
Theorem:
(defthm sparseint$-truncate-of-sparseint$-fix-x (equal (sparseint$-truncate width (sparseint$-fix x)) (sparseint$-truncate width x)))
Theorem:
(defthm sparseint$-truncate-sparseint$-equiv-congruence-on-x (implies (sparseint$-equiv x x-equiv) (equal (sparseint$-truncate width x) (sparseint$-truncate width x-equiv))) :rule-classes :congruence)