• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • C
        • Soft
        • Bv
        • Imp-language
        • Ethereum
        • Event-macros
        • Java
          • Atj
            • Atj-implementation
              • Atj-types
              • Atj-java-primitive-array-model
              • Atj-java-abstract-syntax
              • Atj-input-processing
              • Atj-java-pretty-printer
              • Atj-code-generation
              • Atj-java-primitives
              • Atj-java-primitive-arrays
              • Atj-type-macros
              • Atj-java-syntax-operations
              • Atj-fn
              • Atj-library-extensions
                • Fty-check-mv-let-call
                • Fty-check-if-call
                • Atj-fn-body
                • Atj-string-ascii-java-identifier-p
                  • Fty-check-list-call
                  • Atj-string-ascii-java-package-name-p
                  • Atj-string-ascii-java-identifier-listp
                  • *atj-java-lang-class-names*
                • Atj-java-input-types
                • Atj-test-structures
                • Aij-notions
                • Atj-macro-definition
              • Atj-tutorial
            • Aij
            • Language
          • Riscv
          • Bitcoin
          • Zcash
          • Yul
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Axe
          • Lists-light
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Atj-library-extensions

    Atj-string-ascii-java-identifier-p

    Check if an ACL2 string is a valid ASCII Java identifier.

    Signature
    (atj-string-ascii-java-identifier-p string) → yes/no
    Arguments
    string — Guard (stringp string).
    Returns
    yes/no — Type (booleanp yes/no).

    The string must be non-empty, start with a letter or underscore or dollar sign, and continue with zero or more letters, digits, underscores, and dollar signs. It must also be different from Java keywords and from the boolean and null literals.

    Here for simplicity we disallow ignorable characters. See the formalization of identifiers for more details. It is expected that (perhaps an extension of) that formalization will replace this function here, but for now this function is adequate to ATJ's needs.

    Definitions and Theorems

    Function: atj-string-ascii-java-identifier-p

    (defun atj-string-ascii-java-identifier-p (string)
     (declare (xargs :guard (stringp string)))
     (let ((__function__ 'atj-string-ascii-java-identifier-p))
      (declare (ignorable __function__))
      (and
       (not (member-equal string *reserved-keywords*))
       (not (member-equal string *boolean-literals*))
       (not (equal string *null-literal*))
       (b* ((chars (explode string)))
        (and
           (consp chars)
           (str::letter/uscore/dollar-char-p (car chars))
           (str::letter/digit/uscore/dollar-charlist-p (cdr chars)))))))

    Theorem: booleanp-of-atj-string-ascii-java-identifier-p

    (defthm booleanp-of-atj-string-ascii-java-identifier-p
      (b* ((yes/no (atj-string-ascii-java-identifier-p string)))
        (booleanp yes/no))
      :rule-classes :rewrite)