• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
      • 100-theorems
      • Arithmetic
      • Bit-vectors
        • Sparseint
          • Sparseint-impl
            • Sparseint$-binary-bitop-width
            • Sparseint$-plus-width
            • Sparseint$-binary-bitop-offset
            • Sparseint$-binary-bitop-int-width
            • Sparseint$-plus-int-width
            • Sum-with-cin
            • Sparseint$-plus-offset
            • Sparseint$-binary-bitop-int
            • Sparseint$-finalize-concat
            • Sparseint$-plus-int
            • Sparseint$-binary-bittest-width
            • Sparseint$-binary-bittest-int-width
            • Sparseint$-trailing-0-count-width
            • Sparseint$-height
            • Int-to-sparseint$-rec
            • Carry-out
            • Sparseint$-compare-width
            • Sparseint$-binary-bittest-offset
            • Sparseint$-equal-width
            • Sparseint$-binary-bittest-int
            • Sparseint$-compare-int-width
            • Sparseint$-bitcount-width
            • Sparseint$-unary-bittest-width
            • Sparseint$-rightshift-rec
            • Sparseint$-equal-int-width
            • Sparseint$-trailing-0-count-rec
            • Sparseint$-unary-bitop
            • Sparseint$-concatenate
            • Sparseint$-length-width-rec
            • Sparseint$-sign-ext
            • Sparseint$-binary-bitop
            • Binary-bitop
            • Sparseint$-compare-offset
            • Sparseint$-unary-bittest-offset
            • Sparseint$-equal-offset
            • Sparseint$-truncate
            • Sparseint$-mergeable-leaves-p
              • Carry-out-bit
              • Sparseint$-truncate-height
              • Sparseint$-compare-int
              • Sparseint$-binary-bittest
              • Sparseint$-equal-int
              • Sparseint$-rightshift
              • Sparseint$-leaves-mergeable-p
              • Sparseint$-plus
              • Unary-bitop
              • Sparseint$-bitcount-rec
              • Within-1
              • Sparseint$
              • Binary-bitop-cofactor2
              • Binary-bitop-cofactor1
              • Sparseint$-compare
              • Sparseint$-unary-bittest
              • Sparseint$-height-correct-exec
              • Sparseint$-equal
              • Sparseint$-bitnot
              • Sparseint$-unary-minus
              • Sparseint$-bit
              • Int-to-sparseint$
              • Binary-bittest
              • Sparseint$-length-rec
              • Sparseint$-val
              • Binary-bitop-swap
              • Compare
              • Sparseint$-real-height
              • Sparseint$-height-correctp
              • Sparseint$-length
            • Sparseint-p
            • Sparseint-binary-bittest
            • Sparseint-concatenate
            • Sparseint-binary-bitop
            • Sparseint-bitite
            • Sparseint-fix
            • Sparseint$-binary-minus
            • Sparseint-trailing-1-count-from
            • Sparseint-trailing-0-count-from
            • Sparseint-equal
            • Sparseint-test-bitorc2
            • Sparseint-test-bitorc1
            • Sparseint-test-bitnand
            • Sparseint-test-bitandc2
            • Sparseint-test-bitandc1
            • Sparseint-test-bitand
            • Sparseint-rightshift
            • Sparseint-bitcount-from
            • Sparseint-test-bitxor
            • Sparseint-test-bitor
            • Sparseint-test-bitnor
            • Sparseint-test-biteqv
            • Sparseint-compare
            • Sparseint-binary-minus
            • Sparseint-sign-ext
            • Sparseint-plus
            • Sparseint-bitandc2
            • Sparseint-bitandc1
            • Sparseint-bitand
            • Sparseint$-leaf-bitlimit
            • Sparseint-bitxor
            • Sparseint-bitorc2
            • Sparseint-bitorc1
            • Sparseint-bitor
            • Sparseint-bitnor
            • Sparseint-bitnand
            • Sparseint-biteqv
            • Sparseint-ash
            • Sparseint-<
            • Sparseint-bit
            • Sparseint-trailing-1-count
            • Sparseint-trailing-0-count
            • Sparseint-unary-minus
            • Sparseint-length
            • Sparseint-bitnot
            • Sparseint-bitcount
            • Int-to-sparseint
            • Sparseint-val
          • Bitops
          • Bv
          • Ihs
          • Rtl
        • Algebra
      • Testing-utilities
    • Sparseint-impl

    Sparseint$-mergeable-leaves-p

    Signature
    (sparseint$-mergeable-leaves-p width lsbs msbs) → mergep
    Arguments
    width — Guard (posp width).
    lsbs — Guard (sparseint$-p lsbs).
    msbs — Guard (sparseint$-p msbs).

    Definitions and Theorems

    Function: sparseint$-mergeable-leaves-p

    (defun sparseint$-mergeable-leaves-p (width lsbs msbs)
     (declare (xargs :guard (and (posp width)
                                 (sparseint$-p lsbs)
                                 (sparseint$-p msbs))))
     (let ((__function__ 'sparseint$-mergeable-leaves-p))
      (declare (ignorable __function__))
      (and
        (sparseint$-case lsbs :leaf)
        (sparseint$-case msbs :leaf)
        (sparseint$-leaves-mergeable-p width (sparseint$-leaf->val lsbs)
                                       (sparseint$-leaf->val msbs)))))

    Theorem: not-mergeable-leaves-when-lsbs-concat

    (defthm not-mergeable-leaves-when-lsbs-concat
      (b* ((?mergep (sparseint$-mergeable-leaves-p width lsbs msbs)))
        (implies (sparseint$-case lsbs :concat)
                 (not mergep))))

    Theorem: not-mergeable-leaves-when-msbs-concat

    (defthm not-mergeable-leaves-when-msbs-concat
      (b* ((?mergep (sparseint$-mergeable-leaves-p width lsbs msbs)))
        (implies (sparseint$-case msbs :concat)
                 (not mergep))))

    Theorem: sparseint$-mergeable-leaves-p-of-pos-fix-width

    (defthm sparseint$-mergeable-leaves-p-of-pos-fix-width
      (equal (sparseint$-mergeable-leaves-p (pos-fix width)
                                            lsbs msbs)
             (sparseint$-mergeable-leaves-p width lsbs msbs)))

    Theorem: sparseint$-mergeable-leaves-p-pos-equiv-congruence-on-width

    (defthm sparseint$-mergeable-leaves-p-pos-equiv-congruence-on-width
     (implies
          (pos-equiv width width-equiv)
          (equal (sparseint$-mergeable-leaves-p width lsbs msbs)
                 (sparseint$-mergeable-leaves-p width-equiv lsbs msbs)))
     :rule-classes :congruence)

    Theorem: sparseint$-mergeable-leaves-p-of-sparseint$-fix-lsbs

    (defthm sparseint$-mergeable-leaves-p-of-sparseint$-fix-lsbs
      (equal (sparseint$-mergeable-leaves-p width (sparseint$-fix lsbs)
                                            msbs)
             (sparseint$-mergeable-leaves-p width lsbs msbs)))

    Theorem: sparseint$-mergeable-leaves-p-sparseint$-equiv-congruence-on-lsbs

    (defthm
      sparseint$-mergeable-leaves-p-sparseint$-equiv-congruence-on-lsbs
     (implies
          (sparseint$-equiv lsbs lsbs-equiv)
          (equal (sparseint$-mergeable-leaves-p width lsbs msbs)
                 (sparseint$-mergeable-leaves-p width lsbs-equiv msbs)))
     :rule-classes :congruence)

    Theorem: sparseint$-mergeable-leaves-p-of-sparseint$-fix-msbs

    (defthm sparseint$-mergeable-leaves-p-of-sparseint$-fix-msbs
     (equal
        (sparseint$-mergeable-leaves-p width lsbs (sparseint$-fix msbs))
        (sparseint$-mergeable-leaves-p width lsbs msbs)))

    Theorem: sparseint$-mergeable-leaves-p-sparseint$-equiv-congruence-on-msbs

    (defthm
      sparseint$-mergeable-leaves-p-sparseint$-equiv-congruence-on-msbs
     (implies
          (sparseint$-equiv msbs msbs-equiv)
          (equal (sparseint$-mergeable-leaves-p width lsbs msbs)
                 (sparseint$-mergeable-leaves-p width lsbs msbs-equiv)))
     :rule-classes :congruence)