(sparseint$-concatenate width lsbs msbs) → concat
Function:
(defun sparseint$-concatenate (width lsbs msbs) (declare (xargs :guard (and (natp width) (sparseint$-p lsbs) (sparseint$-p msbs)))) (declare (xargs :guard (and (sparseint$-height-correctp lsbs) (sparseint$-height-correctp msbs)))) (let ((__function__ 'sparseint$-concatenate)) (declare (ignorable __function__)) (b* (((when (eql (lnfix width) 0)) (sparseint$-fix msbs)) ((mv ans ?height) (sparseint$-concatenate-rebalance width lsbs (sparseint$-height lsbs) msbs (sparseint$-height msbs)))) ans)))
Theorem:
(defthm sparseint$-p-of-sparseint$-concatenate (b* ((concat (sparseint$-concatenate width lsbs msbs))) (sparseint$-p concat)) :rule-classes :rewrite)
Theorem:
(defthm sparseint$-height-correct-of-sparseint$-concatenate (b* ((?concat (sparseint$-concatenate width lsbs msbs))) (implies (and (sparseint$-height-correctp lsbs) (sparseint$-height-correctp msbs)) (sparseint$-height-correctp concat))))
Theorem:
(defthm sparseint$-concatenate-correct (b* ((?concat (sparseint$-concatenate width lsbs msbs))) (equal (sparseint$-val concat) (logapp width (sparseint$-val lsbs) (sparseint$-val msbs)))))
Theorem:
(defthm height-of-sparseint$-concatenate (b* ((?concat (sparseint$-concatenate width lsbs msbs))) (implies (and (sparseint$-height-correctp lsbs) (sparseint$-height-correctp msbs)) (<= (sparseint$-height concat) (+ 1 (max (sparseint$-height lsbs) (sparseint$-height msbs)))))) :rule-classes :linear)
Theorem:
(defthm sparseint$-concatenate-of-nfix-width (equal (sparseint$-concatenate (nfix width) lsbs msbs) (sparseint$-concatenate width lsbs msbs)))
Theorem:
(defthm sparseint$-concatenate-nat-equiv-congruence-on-width (implies (nat-equiv width width-equiv) (equal (sparseint$-concatenate width lsbs msbs) (sparseint$-concatenate width-equiv lsbs msbs))) :rule-classes :congruence)
Theorem:
(defthm sparseint$-concatenate-of-sparseint$-fix-lsbs (equal (sparseint$-concatenate width (sparseint$-fix lsbs) msbs) (sparseint$-concatenate width lsbs msbs)))
Theorem:
(defthm sparseint$-concatenate-sparseint$-equiv-congruence-on-lsbs (implies (sparseint$-equiv lsbs lsbs-equiv) (equal (sparseint$-concatenate width lsbs msbs) (sparseint$-concatenate width lsbs-equiv msbs))) :rule-classes :congruence)
Theorem:
(defthm sparseint$-concatenate-of-sparseint$-fix-msbs (equal (sparseint$-concatenate width lsbs (sparseint$-fix msbs)) (sparseint$-concatenate width lsbs msbs)))
Theorem:
(defthm sparseint$-concatenate-sparseint$-equiv-congruence-on-msbs (implies (sparseint$-equiv msbs msbs-equiv) (equal (sparseint$-concatenate width lsbs msbs) (sparseint$-concatenate width lsbs msbs-equiv))) :rule-classes :congruence)