• 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
          • Sparseint-impl
          • 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

    Sparseint-length

    Compute the integer-length of a sparseint. Returns an integer, not a sparseint.

    Signature
    (sparseint-length x) → length
    Arguments
    x — Guard (sparseint-p x).
    Returns
    length — Type (natp length).

    Definitions and Theorems

    Function: sparseint-length$inline

    (defun sparseint-length$inline (x)
      (declare (xargs :guard (sparseint-p x)))
      (let ((__function__ 'sparseint-length))
        (declare (ignorable __function__))
        (sparseint$-length (sparseint-fix x))))

    Theorem: natp-of-sparseint-length

    (defthm natp-of-sparseint-length
      (b* ((length (sparseint-length$inline x)))
        (natp length))
      :rule-classes :type-prescription)

    Theorem: sparseint-length-correct

    (defthm sparseint-length-correct
      (b* ((common-lisp::?length (sparseint-length$inline x)))
        (equal length
               (integer-length (sparseint-val x)))))

    Theorem: sparseint-length$inline-of-sparseint-fix-x

    (defthm sparseint-length$inline-of-sparseint-fix-x
      (equal (sparseint-length$inline (sparseint-fix x))
             (sparseint-length$inline x)))

    Theorem: sparseint-length$inline-sparseint-equiv-congruence-on-x

    (defthm sparseint-length$inline-sparseint-equiv-congruence-on-x
      (implies (sparseint-equiv x x-equiv)
               (equal (sparseint-length$inline x)
                      (sparseint-length$inline x-equiv)))
      :rule-classes :congruence)