• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
          • Atj
          • Aij
          • Language
            • Syntax
              • Grammar
              • Unicode-escapes
              • Unicode-input-char
              • Escape-sequence
              • Identifiers
                • Midentifier
                • Ascii-identifier-part-p
                • Identifier
                • Tidentifier
                • Umidentifier
                • Ascii-identifier-ignore-p
                • Ascii-identifier-start-p
                  • Nonascii-identifier-part-p
                  • Nonascii-identifier-ignore-p
                  • Nonascii-identifier-start-p
                  • Identifier-part-listp
                  • Identifier-start-p
                  • Identifier-part-p
                  • Identifier-ignore-p
                  • No-identifier-ignore-p
                  • Tidentifierp
                  • Identifierp
                  • Umidentifier-fix
                  • Tidentifier-fix
                  • Midentifier-fix
                  • Identifier-fix
                  • Umidentifierp
                  • Midentifierp
                  • Identifier-list
                • Primitive-types
                • Reference-types
                • Keywords
                • Unicode-characters
                • Integer-literals
                • String-literals
                • Octal-digits
                • Hexadecimal-digits
                • Decimal-digits
                • Binary-digits
                • Character-literals
                • Null-literal
                • Floating-point-literals
                • Boolean-literals
                • Package-names
                • Literals
              • Semantics
          • 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
    • Identifiers

    Ascii-identifier-start-p

    Check if an ASCII character can start identifiers.

    Signature
    (ascii-identifier-start-p char) → yes/no
    Arguments
    char — Guard (asciip char).
    Returns
    yes/no — Type (booleanp yes/no).

    [JLS14:3.8] introduces the notion of `Java letter' as a character that can be used to start an identifier. [JLS14:3.8] defines this notion in terms of the API method Character.isJavaIdentifierStart(int). [JCAPIS] specifies this method in terms of Unicode notions.

    [JLS14:3.8] says that this notion includes the ASCII uppercase and lowercase Latin letters, as well as dollar and underscore. Running OpenJDK 14's implementation of Character.isJavaIdentifierStart(int) on all the ASCII codes (i.e. the integers from 0 to 127) returns true for the characters with the codes 36 (dollar), 65 to 90 (uppercase letters), 95 (underscore), 97-122 (lowercase letters), and no others; these are exactly the ASCII characters mentioned by [JLS14:3.8]. Ideally, this should be confirmed with the Unicode standard.

    Definitions and Theorems

    Function: ascii-identifier-start-p

    (defun ascii-identifier-start-p (char)
      (declare (xargs :guard (asciip char)))
      (let ((__function__ 'ascii-identifier-start-p))
        (declare (ignorable __function__))
        (b* ((char (mbe :logic (ascii-fix char)
                        :exec char)))
          (or (= char (char-code #\$))
              (and (<= (char-code #\A) char)
                   (<= char (char-code #\Z)))
              (= char (char-code #\_))
              (and (<= (char-code #\a) char)
                   (<= char (char-code #\z)))))))

    Theorem: booleanp-of-ascii-identifier-start-p

    (defthm booleanp-of-ascii-identifier-start-p
      (b* ((yes/no (ascii-identifier-start-p char)))
        (booleanp yes/no))
      :rule-classes :rewrite)

    Theorem: ascii-identifier-start-p-of-ascii-fix-char

    (defthm ascii-identifier-start-p-of-ascii-fix-char
      (equal (ascii-identifier-start-p (ascii-fix char))
             (ascii-identifier-start-p char)))

    Theorem: ascii-identifier-start-p-ascii-equiv-congruence-on-char

    (defthm ascii-identifier-start-p-ascii-equiv-congruence-on-char
      (implies (ascii-equiv char char-equiv)
               (equal (ascii-identifier-start-p char)
                      (ascii-identifier-start-p char-equiv)))
      :rule-classes :congruence)