(sparseint$-plus-offset x x.height y-offset y y.height cin) → (mv sum height)
Function:
(defun sparseint$-plus-offset (x x.height y-offset y y.height cin) (declare (xargs :guard (and (sparseint$-p x) (natp x.height) (natp y-offset) (sparseint$-p y) (natp y.height) (bitp cin)))) (declare (xargs :guard (and (sparseint$-height-correctp x) (equal x.height (sparseint$-height x)) (sparseint$-height-correctp y) (equal y.height (sparseint$-height y))))) (let ((__function__ 'sparseint$-plus-offset)) (declare (ignorable __function__)) (b* ((x.height (mbe :logic (sparseint$-height x) :exec x.height)) (y.height (mbe :logic (sparseint$-height y) :exec y.height)) (y-offset (lnfix y-offset))) (sparseint$-case x :leaf (sparseint$-case y :leaf (mv (sparseint$-leaf (sum-with-cin cin x.val (logtail y-offset y.val))) 0) :concat (sparseint$-plus-int y-offset y y.height x.val cin)) :concat (sparseint$-case y :leaf (sparseint$-plus-int 0 x x.height (logtail y-offset y.val) cin) :concat (b* ((y.msbs.height (mbe :logic (sparseint$-height y.msbs) :exec (- y.height (if y.lsbs-taller 2 1)))) ((when (<= y.width y-offset)) (sparseint$-plus-offset x x.height (- y-offset y.width) y.msbs y.msbs.height cin)) (x.lsbs.height (mbe :logic (sparseint$-height x.lsbs) :exec (- x.height (if x.msbs-taller 2 1)))) ((mv lsbs-sum lsbs-sum.height lsbs-cout) (sparseint$-plus-width x.width x.lsbs x.lsbs.height y-offset y y.height cin)) (x.msbs.height (mbe :logic (sparseint$-height x.msbs) :exec (- x.height (if x.lsbs-taller 2 1)))) ((mv msbs-sum msbs-sum.height) (sparseint$-plus-offset x.msbs x.msbs.height (+ x.width y-offset) y y.height lsbs-cout))) (sparseint$-concatenate-rebalance x.width lsbs-sum lsbs-sum.height msbs-sum msbs-sum.height)))))))
Theorem:
(defthm sparseint$-p-of-sparseint$-plus-offset.sum (b* (((mv ?sum ?height) (sparseint$-plus-offset x x.height y-offset y y.height cin))) (sparseint$-p sum)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-sparseint$-plus-offset.height (b* (((mv ?sum ?height) (sparseint$-plus-offset x x.height y-offset y y.height cin))) (equal height (sparseint$-height sum))) :rule-classes :rewrite)
Theorem:
(defthm sparseint$-height-correctp-of-sparseint$-plus-offset (b* (((mv ?sum ?height) (sparseint$-plus-offset x x.height y-offset y y.height cin))) (implies (and (sparseint$-height-correctp x) (sparseint$-height-correctp y)) (sparseint$-height-correctp sum))))
Theorem:
(defthm sparseint$-val-of-sparseint$-plus-offset (b* (((mv ?sum ?height) (sparseint$-plus-offset x x.height y-offset y y.height cin))) (equal (sparseint$-val sum) (sum-with-cin cin (sparseint$-val x) (logtail y-offset (sparseint$-val y))))))
Theorem:
(defthm sparseint$-plus-offset-of-sparseint$-fix-x (equal (sparseint$-plus-offset (sparseint$-fix x) x.height y-offset y y.height cin) (sparseint$-plus-offset x x.height y-offset y y.height cin)))
Theorem:
(defthm sparseint$-plus-offset-sparseint$-equiv-congruence-on-x (implies (sparseint$-equiv x x-equiv) (equal (sparseint$-plus-offset x x.height y-offset y y.height cin) (sparseint$-plus-offset x-equiv x.height y-offset y y.height cin))) :rule-classes :congruence)
Theorem:
(defthm sparseint$-plus-offset-of-nfix-x.height (equal (sparseint$-plus-offset x (nfix x.height) y-offset y y.height cin) (sparseint$-plus-offset x x.height y-offset y y.height cin)))
Theorem:
(defthm sparseint$-plus-offset-nat-equiv-congruence-on-x.height (implies (nat-equiv x.height x.height-equiv) (equal (sparseint$-plus-offset x x.height y-offset y y.height cin) (sparseint$-plus-offset x x.height-equiv y-offset y y.height cin))) :rule-classes :congruence)
Theorem:
(defthm sparseint$-plus-offset-of-nfix-y-offset (equal (sparseint$-plus-offset x x.height (nfix y-offset) y y.height cin) (sparseint$-plus-offset x x.height y-offset y y.height cin)))
Theorem:
(defthm sparseint$-plus-offset-nat-equiv-congruence-on-y-offset (implies (nat-equiv y-offset y-offset-equiv) (equal (sparseint$-plus-offset x x.height y-offset y y.height cin) (sparseint$-plus-offset x x.height y-offset-equiv y y.height cin))) :rule-classes :congruence)
Theorem:
(defthm sparseint$-plus-offset-of-sparseint$-fix-y (equal (sparseint$-plus-offset x x.height y-offset (sparseint$-fix y) y.height cin) (sparseint$-plus-offset x x.height y-offset y y.height cin)))
Theorem:
(defthm sparseint$-plus-offset-sparseint$-equiv-congruence-on-y (implies (sparseint$-equiv y y-equiv) (equal (sparseint$-plus-offset x x.height y-offset y y.height cin) (sparseint$-plus-offset x x.height y-offset y-equiv y.height cin))) :rule-classes :congruence)
Theorem:
(defthm sparseint$-plus-offset-of-nfix-y.height (equal (sparseint$-plus-offset x x.height y-offset y (nfix y.height) cin) (sparseint$-plus-offset x x.height y-offset y y.height cin)))
Theorem:
(defthm sparseint$-plus-offset-nat-equiv-congruence-on-y.height (implies (nat-equiv y.height y.height-equiv) (equal (sparseint$-plus-offset x x.height y-offset y y.height cin) (sparseint$-plus-offset x x.height y-offset y y.height-equiv cin))) :rule-classes :congruence)
Theorem:
(defthm sparseint$-plus-offset-of-bfix-cin (equal (sparseint$-plus-offset x x.height y-offset y y.height (bfix cin)) (sparseint$-plus-offset x x.height y-offset y y.height cin)))
Theorem:
(defthm sparseint$-plus-offset-bit-equiv-congruence-on-cin (implies (bit-equiv cin cin-equiv) (equal (sparseint$-plus-offset x x.height y-offset y y.height cin) (sparseint$-plus-offset x x.height y-offset y y.height cin-equiv))) :rule-classes :congruence)