Ungroup digits from a larger base to a smaller base, little-endian.
(ungroup-bendian base exp digits) → new-digits
This is analogous to ungroup-lendian,
but each digit in the larger base is converted to
a big-endian sequence of
Function:
(defun ungroup-bendian (base exp digits) (declare (xargs :guard (and (dab-basep base) (posp exp) (dab-digit-listp (expt (dab-base-fix base) (pos-fix exp)) digits)))) (let ((__function__ 'ungroup-bendian)) (declare (ignorable __function__)) (b* ((exp (pos-fix exp)) (base^exp (expt (dab-base-fix base) exp)) (nat (bendian=>nat base^exp digits)) (number-of-new-digits (* (len digits) exp)) (new-digits (nat=>bendian base number-of-new-digits nat))) new-digits)))
Theorem:
(defthm return-type-of-ungroup-bendian (b* ((new-digits (ungroup-bendian base exp digits))) (dab-digit-listp base new-digits)) :rule-classes :rewrite)
Theorem:
(defthm ungroup-bendian-of-dab-digit-list-fix-digits (implies (equal base^exp (expt (dab-base-fix base) (pos-fix exp))) (equal (ungroup-bendian base exp (dab-digit-list-fix base^exp digits)) (ungroup-bendian base exp digits))))
Theorem:
(defthm ungroup-bendian-of-dab-digit-list-fix-digits-normalize-const (implies (syntaxp (and (quotep digits) (not (dab-digit-listp base (cadr digits))))) (equal (ungroup-bendian base exp digits) (ungroup-bendian base exp (dab-digit-list-fix (expt (dab-base-fix base) (pos-fix exp)) digits)))))
Theorem:
(defthm len-of-ungroup-bendian (equal (len (ungroup-bendian base exp digits)) (* (len digits) (pos-fix exp))))
Theorem:
(defthm ungroup-bendian-when-exp-is-1 (equal (ungroup-bendian base 1 digits) (dab-digit-list-fix base digits)))
Theorem:
(defthm ungroup-bendian-of-dab-base-fix-base (equal (ungroup-bendian (dab-base-fix base) exp digits) (ungroup-bendian base exp digits)))
Theorem:
(defthm ungroup-bendian-dab-base-equiv-congruence-on-base (implies (dab-base-equiv base base-equiv) (equal (ungroup-bendian base exp digits) (ungroup-bendian base-equiv exp digits))) :rule-classes :congruence)
Theorem:
(defthm ungroup-bendian-of-pos-fix-exp (equal (ungroup-bendian base (pos-fix exp) digits) (ungroup-bendian base exp digits)))
Theorem:
(defthm ungroup-bendian-pos-equiv-congruence-on-exp (implies (pos-equiv exp exp-equiv) (equal (ungroup-bendian base exp digits) (ungroup-bendian base exp-equiv digits))) :rule-classes :congruence)