(sparseint$-rightshift-rec shift x x.height) → (mv rightshift height)
Function:
(defun sparseint$-rightshift-rec (shift x x.height) (declare (xargs :guard (and (natp shift) (sparseint$-p x)))) (declare (xargs :guard (and (sparseint$-height-correctp x) (equal x.height (sparseint$-height x))))) (let ((__function__ 'sparseint$-rightshift-rec)) (declare (ignorable __function__)) (sparseint$-case x :leaf (mv (sparseint$-leaf (logtail shift x.val)) 0) :concat (b* ((shift (lnfix shift)) (x.height (mbe :logic (sparseint$-height x) :exec x.height)) ((when (eql shift 0)) (mv (sparseint$-fix x) x.height)) (x.msbs.height (mbe :logic (sparseint$-height x.msbs) :exec (- x.height (if x.lsbs-taller 2 1)))) ((when (<= x.width shift)) (sparseint$-rightshift-rec (- shift x.width) x.msbs x.msbs.height)) (x.lsbs.height (mbe :logic (sparseint$-height x.lsbs) :exec (- x.height (if x.msbs-taller 2 1)))) ((mv lsbs-shift lsbs-shift-height) (sparseint$-rightshift-rec shift x.lsbs x.lsbs.height))) (sparseint$-concatenate-rebalance (- x.width shift) lsbs-shift lsbs-shift-height x.msbs x.msbs.height)))))
Theorem:
(defthm sparseint$-p-of-sparseint$-rightshift-rec.rightshift (b* (((mv ?rightshift ?height) (sparseint$-rightshift-rec shift x x.height))) (sparseint$-p rightshift)) :rule-classes :rewrite)
Theorem:
(defthm return-type-of-sparseint$-rightshift-rec.height (b* (((mv ?rightshift ?height) (sparseint$-rightshift-rec shift x x.height))) (equal height (sparseint$-height rightshift))) :rule-classes :rewrite)
Theorem:
(defthm sparseint$-height-correctp-of-sparseint$-rightshift-rec (b* (((mv ?rightshift ?height) (sparseint$-rightshift-rec shift x x.height))) (implies (sparseint$-height-correctp x) (sparseint$-height-correctp rightshift))))
Theorem:
(defthm sparseint$-rightshift-rec-correct (b* (((mv ?rightshift ?height) (sparseint$-rightshift-rec shift x x.height))) (equal (sparseint$-val rightshift) (logtail shift (sparseint$-val x)))))
Theorem:
(defthm height-of-sparseint$-rightshift-rec (b* (((mv ?rightshift ?height) (sparseint$-rightshift-rec shift x x.height))) (implies (sparseint$-height-correctp x) (<= (sparseint$-height rightshift) (sparseint$-height x)))) :rule-classes :linear)
Theorem:
(defthm sparseint$-rightshift-rec-of-nfix-shift (equal (sparseint$-rightshift-rec (nfix shift) x x.height) (sparseint$-rightshift-rec shift x x.height)))
Theorem:
(defthm sparseint$-rightshift-rec-nat-equiv-congruence-on-shift (implies (nat-equiv shift shift-equiv) (equal (sparseint$-rightshift-rec shift x x.height) (sparseint$-rightshift-rec shift-equiv x x.height))) :rule-classes :congruence)
Theorem:
(defthm sparseint$-rightshift-rec-of-sparseint$-fix-x (equal (sparseint$-rightshift-rec shift (sparseint$-fix x) x.height) (sparseint$-rightshift-rec shift x x.height)))
Theorem:
(defthm sparseint$-rightshift-rec-sparseint$-equiv-congruence-on-x (implies (sparseint$-equiv x x-equiv) (equal (sparseint$-rightshift-rec shift x x.height) (sparseint$-rightshift-rec shift x-equiv x.height))) :rule-classes :congruence)