• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
      • Std/osets
      • Std/io
      • Std/basic
        • Maybe-stringp
        • Maybe-natp
        • Two-nats-measure
        • Impossible
        • Bytep
        • Nat-list-measure
        • Maybe-posp
        • Nibblep
        • Organize-symbols-by-pkg
        • Organize-symbols-by-name
        • Lnfix
        • Good-valuep
        • Streqv
        • Chareqv
        • Symbol-package-name-non-cl
        • Arith-equivs
          • Nat-equiv
          • Bit->bool
            • Bit-equiv
            • Int-equiv
            • Negp
            • Bool->bit
          • Induction-schemes
          • Maybe-integerp
          • Char-fix
          • Pos-fix
          • Symbol-package-name-lst
          • Mbt$
          • Maybe-bitp
          • Good-pseudo-termp
          • Str-fix
          • Maybe-string-fix
          • Nonkeyword-listp
          • Lifix
          • Bfix
          • Std/basic/if*
          • Impliez
          • Tuplep
          • Std/basic/intern-in-package-of-symbol
          • Lbfix
          • Std/basic/symbol-name-lst
          • True
          • Std/basic/rfix
          • Std/basic/realfix
          • Std/basic/member-symbol-name
          • Std/basic/fix
          • False
          • Std/basic/nfix
          • Std/basic/ifix
        • Std/system
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • 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))