• 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-sign-ext

    Sign-extend the given sparseint at the given (positive) position

    Signature
    (sparseint-sign-ext n x) → ext
    Arguments
    n — Guard (posp n).
    x — Guard (sparseint-p x).
    Returns
    ext — Type (sparseint-p ext).

    Definitions and Theorems

    Function: sparseint-sign-ext

    (defun sparseint-sign-ext (n x)
      (declare (xargs :guard (and (posp n) (sparseint-p x))))
      (let ((__function__ 'sparseint-sign-ext))
        (declare (ignorable __function__))
        (b* ((x (sparseint-fix x))
             ((mv ans ?height)
              (sparseint$-sign-ext n x (sparseint$-height x))))
          ans)))

    Theorem: sparseint-p-of-sparseint-sign-ext

    (defthm sparseint-p-of-sparseint-sign-ext
      (b* ((ext (sparseint-sign-ext n x)))
        (sparseint-p ext))
      :rule-classes :rewrite)

    Theorem: sparseint-sign-ext-correct

    (defthm sparseint-sign-ext-correct
      (b* nil
        (equal (sparseint-val (sparseint-sign-ext n x))
               (logext n (sparseint-val x)))))

    Theorem: sparseint-sign-ext-of-pos-fix-n

    (defthm sparseint-sign-ext-of-pos-fix-n
      (equal (sparseint-sign-ext (pos-fix n) x)
             (sparseint-sign-ext n x)))

    Theorem: sparseint-sign-ext-pos-equiv-congruence-on-n

    (defthm sparseint-sign-ext-pos-equiv-congruence-on-n
      (implies (pos-equiv n n-equiv)
               (equal (sparseint-sign-ext n x)
                      (sparseint-sign-ext n-equiv x)))
      :rule-classes :congruence)

    Theorem: sparseint-sign-ext-of-sparseint-fix-x

    (defthm sparseint-sign-ext-of-sparseint-fix-x
      (equal (sparseint-sign-ext n (sparseint-fix x))
             (sparseint-sign-ext n x)))

    Theorem: sparseint-sign-ext-sparseint-equiv-congruence-on-x

    (defthm sparseint-sign-ext-sparseint-equiv-congruence-on-x
      (implies (sparseint-equiv x x-equiv)
               (equal (sparseint-sign-ext n x)
                      (sparseint-sign-ext n x-equiv)))
      :rule-classes :congruence)