• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Testing-utilities
    • Math
      • Arithmetic
      • Bit-vectors
        • Sparseint
        • Bitops
          • Bitops/merge
            • Merge-64-u8s
            • Merge-32-u8s
            • Merge-32-u16s
            • Merge-16-bits
            • Merge-16-u8s
            • Merge-16-u32s
            • Merge-16-u16s
            • Merge-8-bits
            • Merge-8-u2s
            • Merge-8-u4s
            • Merge-8-u64s
            • Merge-8-u32s
            • Merge-8-u16s
            • Merge-8-u8s
            • Merge-4-bits
            • Merge-4-u8s
            • Merge-4-u4s
            • Merge-4-u16s
            • Merge-4-u2s
            • Merge-4-u64s
            • Merge-4-u32s
            • Merge-4-u128s
            • Merge-2-bits
            • Merge-2-u8s
            • Merge-2-u64s
            • Merge-2-u32s
            • Merge-2-u256s
            • Merge-2-u16s
            • Merge-2-u128s
            • Merge-2-u4s
            • Merge-2-u2s
            • Merge-unsigneds
              • Merge-unsigneds-aux
              • Indexed-subst-templates
            • Bitops-compatibility
            • Bitops-books
            • Logbitp-reasoning
            • Bitops/signed-byte-p
            • Fast-part-select
            • Bitops/integer-length
            • Bitops/extra-defs
            • Install-bit
            • Trailing-0-count
            • Bitops/defaults
            • Logbitp-mismatch
            • Trailing-1-count
            • Bitops/rotate
            • Bitops/equal-by-logbitp
            • Bitops/ash-bounds
            • Bitops/fast-logrev
            • Limited-shifts
            • Bitops/part-select
            • Bitops/parity
            • Bitops/saturate
            • Bitops/part-install
            • Bitops/logbitp-bounds
            • Bitops/ihsext-basics
            • Bitops/fast-rotate
            • Bitops/fast-logext
            • Bitops/ihs-extensions
          • Bv
          • Ihs
          • Rtl
        • Algebra
    • Bitops/merge

    Merge-unsigneds

    Concatenate the given list of integers together at the given width, most-significant first, to form a single natural number.

    Signature
    (merge-unsigneds width elts) → packed
    Arguments
    width — Guard (natp width).
    elts — Guard (integer-listp elts).
    Returns
    packed — Type (natp packed).

    Definitions and Theorems

    Function: merge-unsigneds

    (defun merge-unsigneds (width elts)
           (declare (xargs :guard (and (natp width)
                                       (integer-listp elts))))
           (let ((__function__ 'merge-unsigneds))
                (declare (ignorable __function__))
                (merge-unsigneds-aux width elts 0)))

    Theorem: natp-of-merge-unsigneds

    (defthm natp-of-merge-unsigneds
            (b* ((packed (merge-unsigneds width elts)))
                (natp packed))
            :rule-classes :type-prescription)

    Theorem: width-of-merge-unsigneds

    (defthm width-of-merge-unsigneds
            (b* ((?packed (merge-unsigneds width elts)))
                (implies (and (<= (* (nfix width) (len elts)) n)
                              (natp n))
                         (unsigned-byte-p n packed))))

    Theorem: merge-unsigneds-alt-def

    (defthm merge-unsigneds-alt-def
            (equal (merge-unsigneds width elts)
                   (if (atom elts)
                       0
                       (logapp (* (nfix width) (len (cdr elts)))
                               (merge-unsigneds width (cdr elts))
                               (loghead width (car elts)))))
            :rule-classes
            ((:definition :controller-alist ((merge-unsigneds nil t)))))