• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
      • 100-theorems
      • Arithmetic
      • Bit-vectors
        • Sparseint
        • Bitops
          • Bitops/merge
            • Merge-64-u8s
            • Merge-64-bits
            • Merge-32-u8s
            • Merge-32-u4s
            • Merge-32-u2s
            • Merge-32-u16s
            • Merge-32-bits
            • Merge-16-bits
            • Merge-16-u32s
            • Merge-16-u16s
            • Merge-16-u8s
            • Merge-16-u4s
            • Merge-16-u2s
            • Merge-8-bits
            • Merge-8-u2s
            • Merge-8-u64s
            • Merge-8-u4s
            • 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-u64s
            • Merge-2-u256s
            • Merge-2-u16s
            • Merge-2-u128s
            • Merge-2-bits
            • Merge-2-u8s
            • Merge-2-u4s
            • Merge-2-u32s
            • 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
      • Testing-utilities
    • Bitops/merge

    Merge-unsigneds-aux

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

    Definitions and Theorems

    Function: merge-unsigneds-aux

    (defun merge-unsigneds-aux (width elts acc)
      (declare (xargs :guard (and (natp width)
                                  (integer-listp elts)
                                  (natp acc))))
      (let ((__function__ 'merge-unsigneds-aux))
        (declare (ignorable __function__))
        (if (atom elts)
            (lnfix acc)
          (merge-unsigneds-aux width (cdr elts)
                               (logapp width (car elts)
                                       (lnfix acc))))))

    Theorem: natp-of-merge-unsigneds-aux

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

    Theorem: width-of-merge-unsigneds-aux

    (defthm width-of-merge-unsigneds-aux
      (b* ((?packed (merge-unsigneds-aux width elts acc)))
        (unsigned-byte-p (+ (integer-length (nfix acc))
                            (* (nfix width) (len elts)))
                         packed)))

    Theorem: merge-unsigneds-aux-of-nil

    (defthm merge-unsigneds-aux-of-nil
      (equal (merge-unsigneds-aux width nil acc)
             (nfix acc)))

    Theorem: merge-unsigneds-aux-of-cons

    (defthm merge-unsigneds-aux-of-cons
      (equal (merge-unsigneds-aux width (cons a b)
                                  acc)
             (merge-unsigneds-aux width b (logapp width a (nfix acc)))))