• 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
          • Icharlisteqv
          • Upcase-charlist
          • Downcase-charlist
          • Upcase-string
          • Istreqv
          • Downcase-char
          • Upcase-char
          • Ichareqv
          • Downcase-string
          • Upcase-first-charlist
          • Downcase-first-charlist
          • Downcase-first
          • Upcase-first
          • Down-alpha-p
          • Up-alpha-p
          • Upcase-char-str
          • Downcase-char-str
            • Upcase-string-list
            • Downcase-string-list
          • Concatenation
          • Html-encoding
          • Character-kinds
          • Substrings
          • Strtok
          • Equivalences
          • Url-encoding
          • Lines
          • Explode-implode-equalities
          • Ordering
          • Numbers
          • 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
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Cases

    Downcase-char-str

    Convert a character into a lower-case one-element string.

    Signature
    (downcase-char-str c) → str
    Returns
    str — Type (stringp str).

    (downcase-char-str c) is logically equal to:

    (implode (downcase-char c))

    But we store these strings in a table so that they don't have to be recomputed. This is mainly useful to reduce the creation of temporary strings during downcase-first.

    Definitions and Theorems

    Function: make-downcase-first-strtbl

    (defun make-downcase-first-strtbl (n)
      (declare (xargs :guard (and (natp n) (<= n 255))))
      (cons (cons n
                  (implode (list (downcase-char (code-char n)))))
            (if (zp n)
                nil
              (make-downcase-first-strtbl (- n 1)))))

    Function: downcase-char-str$inline

    (defun downcase-char-str$inline (c)
      (declare (type character c))
      (let ((acl2::__function__ 'downcase-char-str))
        (declare (ignorable acl2::__function__))
        (mbe :logic (implode (list (downcase-char c)))
             :exec (aref1 '*downcase-first-strtbl*
                          *downcase-first-strtbl*
                          (char-code c)))))

    Theorem: stringp-of-downcase-char-str

    (defthm stringp-of-downcase-char-str
      (b* ((str (downcase-char-str$inline c)))
        (stringp str))
      :rule-classes :type-prescription)