• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defmacro
        • Loop$-primer
        • Fast-alists
        • Defconst
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
        • Efficiency
        • Irrelevant-formals
        • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
        • Redefining-programs
        • Lists
        • Invariant-risk
        • Errors
        • Defabbrev
        • Conses
        • Alists
        • Set-register-invariant-risk
        • Strings
          • 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
            • String-listp
            • Stringp
            • Length
            • Search
            • Remove-duplicates
            • Position
            • Coerce
            • Concatenate
            • Reverse
            • String
            • Subseq
            • Substitute
            • String-upcase
            • String-downcase
            • Count
            • Char
            • String<
            • String-equal
            • String-utilities
            • String-append
            • String>=
            • String<=
            • String>
            • Hex-digit-char-theorems
            • String-downcase-gen
            • String-upcase-gen
          • Program-wrapper
          • Get-internal-time
          • Basics
          • Packages
          • Oracle-eval
          • Defmacro-untouchable
          • <<
          • Primitive
          • Revert-world
          • Unmemoize
          • Set-duplicate-keys-action
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Fake-oracle-eval
          • Defopen
          • Sleep
        • Operational-semantics
        • Real
        • Start-here
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Cases
    • Upper-case-p

    Up-alpha-p

    Determine if a character is an upper-case letter (A-Z).

    Signature
    (up-alpha-p x) → bool

    ACL2 has a built-in alternative to this function, common-lisp::upper-case-p, which however can also recognize characters that are not standard characters. (Historical note: Before May 2024, the guard for acl2::upper-case-p required standard-char-p yet also converted only standard characters; this provided motivation for the development of up-alpha-p.)

    Definitions and Theorems

    Function: up-alpha-p$inline

    (defun up-alpha-p$inline (x)
      (declare (type character x))
      (let ((acl2::__function__ 'up-alpha-p))
        (declare (ignorable acl2::__function__))
        (b* (((the (unsigned-byte 8) code)
              (char-code x)))
          (and (<= (big-a) code)
               (<= code (big-z))))))

    Theorem: chareqv-implies-equal-up-alpha-p-1

    (defthm chareqv-implies-equal-up-alpha-p-1
      (implies (chareqv x x-equiv)
               (equal (up-alpha-p x)
                      (up-alpha-p x-equiv)))
      :rule-classes (:congruence))

    Theorem: upper-case-p-is-up-alpha-p

    (defthm upper-case-p-is-up-alpha-p
      (implies (standard-char-p x)
               (equal (common-lisp::upper-case-p x)
                      (up-alpha-p (double-rewrite x)))))