• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Testing-utilities
    • Math
      • Arithmetic
        • Lispfloat
        • Arithmetic-1
        • Number-theory
        • Proof-by-arith
        • Arith-equivs
          • Nat-equiv
          • Bit->bool
            • Bit-equiv
            • Int-equiv
            • Negp
            • Bool->bit
          • Number-theory
          • Arithmetic-3
          • Arithmetic-2
          • Arithmetic-light
          • Arithmetic-5
        • Bit-vectors
        • Algebra
    • Arith-equivs

    Bit->bool

    Coerce a bit into a Boolean.

    This is just (equal 1 x). However, using a function for this allows us to use congruences and to control case-splitting. For example, if we have

    (equal (equal 1 (foo x))
           (equal 1 (bar y)))
    this will case split into:
    (if (equal 1 (foo x))
        (equal 1 (bar y))
      (not (equal 1 (bar y))))
    whereas
    (equal (bit->bool (foo x)) (bit->bool (bar y)))
    will not.

    Because a bunch of libraries were written under the assumption that (equal 1 x) was the way to tell if a bit was true or false, we leave this enabled by default.

    Definitions and Theorems

    Function: bit->bool$inline

    (defun bit->bool$inline (x)
           (declare (xargs :guard t))
           (equal 1 x))

    Theorem: bit-equiv-implies-equal-bit->bool-1

    (defthm bit-equiv-implies-equal-bit->bool-1
            (implies (bit-equiv a a-equiv)
                     (equal (bit->bool a)
                            (bit->bool a-equiv)))
            :rule-classes (:congruence))