• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
          • Omaps
          • Directed-untranslate
          • Include-book-paths
          • Ubi
          • Numbered-names
          • Digits-any-base
          • Context-message-pair
          • With-auto-termination
          • Make-termination-theorem
          • Theorems-about-true-list-lists
          • Checkpoint-list
          • Sublis-expr+
          • Integers-from-to
          • Prove$
          • Defthm<w
          • System-utilities-non-built-in
          • Integer-range-fix
          • Minimize-ruler-extenders
          • Add-const-to-untranslate-preprocess
          • Unsigned-byte-fix
          • Signed-byte-fix
          • Defthmr
          • Paired-names
          • Unsigned-byte-list-fix
          • Signed-byte-list-fix
          • Show-books
          • Skip-in-book
          • Typed-tuplep
          • List-utilities
          • Checkpoint-list-pretty
          • Defunt
          • Keyword-value-list-to-alist
          • Magic-macroexpand
          • Top-command-number-fn
          • Bits-as-digits-in-base-2
          • Show-checkpoint-list
          • Ubyte11s-as-digits-in-base-2048
          • Named-formulas
          • Bytes-as-digits-in-base-256
          • String-utilities
          • Make-keyword-value-list-from-keys-and-value
          • Defmacroq
          • Integer-range-listp
          • Apply-fn-if-known
          • Trans-eval-error-triple
          • Checkpoint-info-list
          • Previous-subsumer-hints
          • Fms!-lst
          • Zp-listp
          • Trans-eval-state
          • Injections
          • Doublets-to-alist
          • Theorems-about-osets
          • Typed-list-utilities
          • Book-runes-alist
          • User-interface
          • Bits/ubyte11s-digit-grouping
          • Bits/bytes-digit-grouping
          • Message-utilities
            • Msg-downcase-first
            • Maybe-msgp
            • Msg-listp
            • Msg-upcase-first
            • Subsetp-eq-linear
            • Oset-utilities
            • Strict-merge-sort-<
            • Miscellaneous-enumerations
            • Maybe-unquote
            • Thm<w
            • Defthmd<w
            • Io-utilities
          • Set
          • Soft
          • C
          • Bv
          • Imp-language
          • Event-macros
          • Java
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Message-utilities

    Msg-upcase-first

    Convert the first character of a structured message to upper case.

    Signature
    (msg-upcase-first msg) → new-msg
    Arguments
    msg — Guard (msgp msg).
    Returns
    new-msg — Type (msgp new-msg), given the guard.

    This is analogous to msg-downcase-first, but we use str::upcase-first instead of str::downcase-first on the strings, and the roles of the n and N command characters of the tilde-directives are swapped. See the documentation of msg-downcase-first.

    Definitions and Theorems

    Function: msg-upcase-first

    (defun msg-upcase-first (msg)
     (declare (xargs :guard (msgp msg)))
     (let ((__function__ 'msg-upcase-first))
      (declare (ignorable __function__))
      (b*
       (((when (stringp msg))
         (str::upcase-first msg))
        ((cons string alist) msg)
        ((unless (and (> (length string) 0)
                      (eql (char string 0) #\~)))
         (cons (str::upcase-first string) alist))
        ((unless (and (>= (length string) 3)
                      (member (char string 1)
                              (list #\@ #\# #\* #\& #\v #\n #\s #\S))))
         msg))
       (case (char string 1)
        (#\@ (b* (((unless (alistp alist)) msg)
                  (value (cdr (assoc (char string 2) alist)))
                  ((unless (msgp value)) msg)
                  (new-alist (acons (char string 2)
                                    (msg-upcase-first value)
                                    alist)))
               (cons string new-alist)))
        (#\n (b* ((new-string (concatenate 'string
                                           "~N" (subseq string 2 nil))))
               (cons new-string alist)))
        ((#\s #\S)
         (b* (((unless (alistp alist)) msg)
              (value (cdr (assoc (char string 2) alist)))
              ((unless (stringp value)) msg)
              (new-alist (acons (char string 2)
                                (str::upcase-first value)
                                alist)))
           (cons string new-alist)))
        (otherwise (prog2$ (raise "Message not supported: ~x0" msg)
                           msg))))))

    Theorem: msgp-of-msg-upcase-first

    (defthm msgp-of-msg-upcase-first
      (implies (and (msgp msg))
               (b* ((new-msg (msg-upcase-first msg)))
                 (msgp new-msg)))
      :rule-classes :rewrite)