• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • ACL2
    • Macro-libraries
    • 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$-unary-bittest-offset

    Signature
    (sparseint$-unary-bittest-offset op offset x) → test
    Arguments
    op — Guard (integerp op).
    offset — Guard (natp offset).
    x — Guard (sparseint$-p x).
    Returns
    test — Type (booleanp test).

    Definitions and Theorems

    Function: sparseint$-unary-bittest-offset

    (defun sparseint$-unary-bittest-offset (op offset x)
      (declare (type (unsigned-byte 2) op))
      (declare (xargs :guard (and (integerp op)
                                  (natp offset)
                                  (sparseint$-p x))))
      (let ((__function__ 'sparseint$-unary-bittest-offset))
        (declare (ignorable __function__))
        (b* ((op (mbe :logic (loghead 2 op) :exec op)))
          (case op
            (0 nil)
            (1 (not (sparseint$-equal-int offset x -1)))
            (2 (not (sparseint$-equal-int offset x 0)))
            (t t)))))

    Theorem: booleanp-of-sparseint$-unary-bittest-offset

    (defthm booleanp-of-sparseint$-unary-bittest-offset
      (b* ((test (sparseint$-unary-bittest-offset op offset x)))
        (booleanp test))
      :rule-classes :type-prescription)

    Theorem: sparseint$-unary-bittest-offset-correct

    (defthm sparseint$-unary-bittest-offset-correct
     (b* ((?test (sparseint$-unary-bittest-offset op offset x)))
      (equal
        test
        (not (equal (unary-bitop op (logtail offset (sparseint$-val x)))
                    0)))))

    Theorem: sparseint$-unary-bittest-offset-of-ifix-op

    (defthm sparseint$-unary-bittest-offset-of-ifix-op
      (equal (sparseint$-unary-bittest-offset (ifix op)
                                              offset x)
             (sparseint$-unary-bittest-offset op offset x)))

    Theorem: sparseint$-unary-bittest-offset-int-equiv-congruence-on-op

    (defthm sparseint$-unary-bittest-offset-int-equiv-congruence-on-op
      (implies
           (int-equiv op op-equiv)
           (equal (sparseint$-unary-bittest-offset op offset x)
                  (sparseint$-unary-bittest-offset op-equiv offset x)))
      :rule-classes :congruence)

    Theorem: sparseint$-unary-bittest-offset-of-nfix-offset

    (defthm sparseint$-unary-bittest-offset-of-nfix-offset
      (equal (sparseint$-unary-bittest-offset op (nfix offset)
                                              x)
             (sparseint$-unary-bittest-offset op offset x)))

    Theorem: sparseint$-unary-bittest-offset-nat-equiv-congruence-on-offset

    (defthm
         sparseint$-unary-bittest-offset-nat-equiv-congruence-on-offset
      (implies
           (nat-equiv offset offset-equiv)
           (equal (sparseint$-unary-bittest-offset op offset x)
                  (sparseint$-unary-bittest-offset op offset-equiv x)))
      :rule-classes :congruence)

    Theorem: sparseint$-unary-bittest-offset-of-sparseint$-fix-x

    (defthm sparseint$-unary-bittest-offset-of-sparseint$-fix-x
     (equal
          (sparseint$-unary-bittest-offset op offset (sparseint$-fix x))
          (sparseint$-unary-bittest-offset op offset x)))

    Theorem: sparseint$-unary-bittest-offset-sparseint$-equiv-congruence-on-x

    (defthm
       sparseint$-unary-bittest-offset-sparseint$-equiv-congruence-on-x
      (implies
           (sparseint$-equiv x x-equiv)
           (equal (sparseint$-unary-bittest-offset op offset x)
                  (sparseint$-unary-bittest-offset op offset x-equiv)))
      :rule-classes :congruence)