• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • Std/strings
        • Pretty-printing
        • Printtree
        • Base64
        • Charset-p
        • Strtok!
        • Cases
        • Concatenation
        • Html-encoding
        • Character-kinds
        • Substrings
        • Strtok
        • Equivalences
        • Url-encoding
        • Lines
        • Explode-implode-equalities
        • Ordering
        • Numbers
          • Decimal
          • Hex
          • Octal
          • Binary
            • Parse-bits-from-string
            • Parse-bits-from-charlist
            • Nat-to-bin-chars
            • Bin-digit-chars-value
            • Take-leading-bin-digit-chars
            • Bin-digit-char-listp
            • Skip-leading-bit-digits
            • Bin-digit-char-list*p
            • Bin-digit-string-p
            • Bin-digit-char-value
              • Strval2
              • Nat-to-bin-string
              • Bin-digit-char-p
              • Nat-to-bin-string-list
              • Nat-to-bin-string-size
              • Revappend-nat-to-bin-chars
              • Binify-width
              • Binify
          • Pad-trim
          • Coercion
          • Std/strings/digit-to-char
          • Substitution
          • Symbols
        • Std/osets
        • Std/io
        • Std/basic
        • Std/system
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
      • Community
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Binary

    Bin-digit-char-value

    Coerces a bin-digit-char-p character into a number, 0 or 1.

    Signature
    (bin-digit-char-value x) → bit
    Arguments
    x — Guard (bin-digit-char-p x).
    Returns
    bit — Type (bitp bit).

    Definitions and Theorems

    Function: bin-digit-char-value$inline

    (defun bin-digit-char-value$inline (x)
      (declare (type character x))
      (declare (xargs :guard (bin-digit-char-p x)))
      (declare (xargs :split-types t))
      (let ((acl2::__function__ 'bin-digit-char-value))
        (declare (ignorable acl2::__function__))
        (if (eql x #\1) 1 0)))

    Theorem: bitp-of-bin-digit-char-value

    (defthm bitp-of-bin-digit-char-value
      (b* ((bit (bin-digit-char-value$inline x)))
        (bitp bit))
      :rule-classes :type-prescription)

    Theorem: ichareqv-implies-equal-bin-digit-char-value-1

    (defthm ichareqv-implies-equal-bin-digit-char-value-1
      (implies (ichareqv x x-equiv)
               (equal (bin-digit-char-value x)
                      (bin-digit-char-value x-equiv)))
      :rule-classes (:congruence))

    Theorem: unsigned-byte-p-of-bin-digit-char-value

    (defthm unsigned-byte-p-of-bin-digit-char-value
      (unsigned-byte-p 1 (bin-digit-char-value x)))

    Theorem: equal-of-bin-digit-char-value-and-bin-digit-char-value

    (defthm equal-of-bin-digit-char-value-and-bin-digit-char-value
      (implies (and (bin-digit-char-p x)
                    (bin-digit-char-p y))
               (equal (equal (bin-digit-char-value x)
                             (bin-digit-char-value y))
                      (equal x y))))

    Theorem: bin-digit-char-value-of-digit-to-char

    (defthm bin-digit-char-value-of-digit-to-char
      (implies (bitp n)
               (equal (bin-digit-char-value (digit-to-char n))
                      n)))