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

    Ihs/logand-lemmas

    Lemmas about logand from the logops-lemmas book.

    Definitions and Theorems

    Theorem: commutativity-of-logand

    (defthm commutativity-of-logand
      (equal (logand i j) (logand j i)))

    Theorem: simplify-logand

    (defthm simplify-logand
      (and (equal (logand 0 i) 0)
           (equal (logand -1 i) (ifix i))))

    Theorem: logand-=-minus-1

    (defthm logand-=-minus-1
      (equal (equal (logand i j) -1)
             (and (equal i -1) (equal j -1))))

    Theorem: unsigned-byte-p-logand

    (defthm unsigned-byte-p-logand
      (implies (and (or (unsigned-byte-p size i)
                        (unsigned-byte-p size j))
                    (force (integerp i))
                    (force (integerp j)))
               (unsigned-byte-p size (logand i j))))

    Theorem: logand-upper-bound

    (defthm logand-upper-bound
      (implies (and (>= i 0) (integerp j))
               (<= (logand i j) i))
      :rule-classes
      ((:linear :corollary (implies (and (>= i 0) (integerp j))
                                    (<= (logand i j) i)))
       (:linear :corollary (implies (and (>= i 0) (integerp j))
                                    (<= (logand j i) i)))))

    Theorem: logand-logior

    (defthm logand-logior
      (implies (and (integerp x)
                    (integerp y)
                    (integerp z))
               (equal (logand x (logior y z))
                      (logior (logand x y) (logand x z)))))

    Theorem: logand-logxor

    (defthm logand-logxor
      (implies (and (force (integerp i))
                    (force (integerp j))
                    (force (integerp k)))
               (equal (logand i (logxor j k))
                      (logxor (logand i j) (logand i k)))))