• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Hons-and-memoization
      • Events
      • History
      • Parallelism
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Mutual-recursion
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Loop$-primer
        • Fast-alists
        • Defmacro
        • Defconst
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
          • Natp
          • Unsigned-byte-p
          • Posp
          • +
          • Bitp
          • Zero-test-idioms
          • Nat-listp
          • Integerp
          • <
          • *
          • Zp
          • -
          • Signed-byte-p
          • Logbitp
            • Open-logbitp-of-const-meta
            • Ihs/logbitp-lemmas
              • Equal-by-logbitp
              • Logbit
              • Logbitp-mismatch
              • Logbitp-bounds
              • Logbitp-defaults
              • Logbitp*
            • Expt
            • Ash
            • Rationalp
            • Sharp-f-reader
            • Logand
            • =
            • <=
            • Floor
            • Random$
            • Nfix
            • Truncate
            • Complex
            • Numbers-introduction
            • Code-char
            • Integer-length
            • Zip
            • Logior
            • Sharp-u-reader
            • Char-code
            • Unary--
            • Integer-listp
            • Boole$
            • /
            • Mod
            • Logxor
            • Lognot
            • Integer-range-p
            • Ifix
            • ACL2-numberp
            • Ceiling
            • Mod-expt
            • Round
            • Logeqv
            • Explode-nonnegative-integer
            • Max
            • Evenp
            • Nonnegative-integer-quotient
            • Zerop
            • Abs
            • Fix
            • Allocate-fixnum-range
            • Rem
            • 1+
            • Pos-listp
            • Signum
            • Real/rationalp
            • Rational-listp
            • Rfix
            • >=
            • >
            • Logcount
            • ACL2-number-listp
            • /=
            • Unary-/
            • Complex/complex-rationalp
            • Logtest
            • Logandc1
            • Logorc1
            • Logandc2
            • 1-
            • Numerator
            • Logorc2
            • Denominator
            • The-number
            • Realfix
            • Complex-rationalp
            • Min
            • Lognor
            • Zpf
            • Oddp
            • Minusp
            • Lognand
            • Imagpart
            • Conjugate
            • Int=
            • Realpart
            • Plusp
          • Irrelevant-formals
          • Efficiency
          • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
          • Redefining-programs
          • Lists
          • Invariant-risk
          • Errors
          • Defabbrev
          • Conses
          • Alists
          • Set-register-invariant-risk
          • Strings
          • Program-wrapper
          • Get-internal-time
          • Basics
          • Packages
          • Defmacro-untouchable
          • Primitive
          • <<
          • Revert-world
          • Set-duplicate-keys-action
          • Unmemoize
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Defopen
          • Sleep
        • Start-here
        • Real
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Logbitp
    • Logbit
    • Logops-lemmas

    Ihs/logbitp-lemmas

    Lemmas about logbitp and logbit from the logops-lemmas book.

    We prove a set of lemmas about logbitp, then prove the analogous lemmas about logbit, which is defined in terms of logbitp.

    Definitions and Theorems

    Theorem: logbitp-0-minus-1

    (defthm logbitp-0-minus-1
            (implies (and (integerp pos) (>= pos 0))
                     (and (not (logbitp pos 0))
                          (logbitp pos -1))))

    Theorem: logbit-0-minus-1

    (defthm logbit-0-minus-1
            (implies (and (integerp pos)
                          (>= pos 0)
                          (integerp i))
                     (and (equal (logbit pos 0) 0)
                          (equal (logbit pos -1) 1))))

    Theorem: logbitp-loghead

    (defthm logbitp-loghead
            (implies (and (loghead-guard size i)
                          (force (integerp pos))
                          (force (>= pos 0)))
                     (equal (logbitp pos (loghead size i))
                            (if (< pos size) (logbitp pos i) nil))))

    Theorem: logbit-loghead

    (defthm logbit-loghead
            (implies (and (loghead-guard size i)
                          (force (integerp pos))
                          (force (>= pos 0))
                          (< pos size))
                     (equal (logbit pos (loghead size i))
                            (if (< pos size) (logbit pos i) 0))))

    Theorem: logbitp-logtail

    (defthm logbitp-logtail
            (implies (and (logtail-guard pos i)
                          (force (integerp pos1))
                          (force (>= pos1 0)))
                     (equal (logbitp pos1 (logtail pos i))
                            (logbitp (+ pos pos1) i))))

    Theorem: logbit-logtail

    (defthm logbit-logtail
            (implies (and (logtail-guard pos i)
                          (force (integerp pos1))
                          (force (>= pos1 0)))
                     (equal (logbit pos1 (logtail pos i))
                            (logbit (+ pos pos1) i))))

    Theorem: logbitp-logapp

    (defthm logbitp-logapp
            (implies (and (logapp-guard size i j)
                          (force (integerp pos))
                          (force (>= pos 0)))
                     (equal (logbitp pos (logapp size i j))
                            (if (< pos size)
                                (logbitp pos i)
                                (logbitp (- pos size) j)))))

    Theorem: logbit-logapp

    (defthm logbit-logapp
            (implies (and (logapp-guard size i j)
                          (force (integerp pos))
                          (force (>= pos 0)))
                     (equal (logbit pos (logapp size i j))
                            (if (< pos size)
                                (logbit pos i)
                                (logbit (- pos size) j)))))

    Theorem: logbitp-logrpl

    (defthm logbitp-logrpl
            (implies (and (logrpl-guard size i j)
                          (force (integerp pos))
                          (force (>= pos 0)))
                     (equal (logbitp pos (logrpl size i j))
                            (if (< pos size)
                                (logbitp pos i)
                                (logbitp pos j)))))

    Theorem: logbit-logrpl

    (defthm logbit-logrpl
            (implies (and (logrpl-guard size i j)
                          (force (integerp pos))
                          (force (>= pos 0)))
                     (equal (logbit pos (logrpl size i j))
                            (if (< pos size)
                                (logbit pos i)
                                (logbit pos j)))))

    Theorem: logbitp-lognot

    (defthm logbitp-lognot
            (implies (and (integerp pos)
                          (>= pos 0)
                          (integerp i))
                     (equal (logbitp pos (lognot i))
                            (not (logbitp pos i)))))

    Theorem: logbit-lognot

    (defthm logbit-lognot
            (implies (and (integerp pos)
                          (>= pos 0)
                          (integerp i))
                     (equal (logbit pos (lognot i))
                            (b-not (logbit pos i)))))

    Theorem: logbitp-lognotu

    (defthm logbitp-lognotu
            (implies (and (integerp pos)
                          (>= pos 0)
                          (integerp i)
                          (force (integerp size))
                          (force (>= size 0)))
                     (equal (logbitp pos (lognotu size i))
                            (if (< pos size)
                                (not (logbitp pos i))
                                nil))))

    Theorem: logbit-lognotu

    (defthm logbit-lognotu
            (implies (and (integerp pos)
                          (>= pos 0)
                          (integerp i)
                          (force (integerp size))
                          (force (>= size 0)))
                     (equal (logbit pos (lognotu size i))
                            (if (< pos size)
                                (b-not (logbit pos i))
                                0))))