• 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
              • Basic-nat-to-bin-chars
              • Nat-to-bin-chars-aux
              • 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
    • Nat-to-bin-chars

    Nat-to-bin-chars-aux

    Signature
    (nat-to-bin-chars-aux n acc) → *
    Arguments
    n — Guard (natp n).

    Definitions and Theorems

    Function: nat-to-bin-chars-aux

    (defun nat-to-bin-chars-aux (n acc)
     (declare (xargs :guard (natp n)))
     (let ((acl2::__function__ 'nat-to-bin-chars-aux))
      (declare (ignorable acl2::__function__))
      (mbe
        :logic
        (revappend (basic-nat-to-bin-chars n)
                   acc)
        :exec
        (if (zp n)
            acc
          (nat-to-bin-chars-aux (the unsigned-byte
                                     (ash (the unsigned-byte n) -1))
                                (cons (if (eql (the bit (logand n 1)) 1)
                                          #\1
                                        #\0)
                                      acc))))))