• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
      • Proof-checker-array
      • Soft
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Ethereum
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • Zcash
      • Des
      • X86isa
      • Sha-2
      • Yul
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Axe
      • Poseidon
      • Where-do-i-place-my-book
      • Aleo
        • Aleobft
        • Aleovm
        • Leo
          • Grammar
          • Early-version
            • Json2ast
            • Testing
            • Definition
              • Flattening
              • Abstract-syntax
                • Expression
                • Syntax-abstraction
                • Statement
                • Files
                • Input-files
                • Identifiers
                  • Identifier
                  • Identifier-option
                  • Programid
                  • Locator
                  • Identifier-grammar-chars-p
                  • Identifier-option-result
                  • Programid-result
                  • Locator-result
                  • Identifier-result
                  • Identifier-list-result
                  • Identifier-string-p
                    • Identifier-set
                    • Identifier-list
                  • Types
                  • Struct-init
                  • Branch
                  • Statements
                  • Format-strings
                  • Input-syntax-abstraction
                  • Expressions
                  • Output-files
                  • Addresses
                  • Literals
                  • Characters
                  • Expression-list
                  • Statement-list
                  • Output-syntax-abstraction
                  • Struct-init-list
                  • Branch-list
                  • Annotations
                  • Abstract-syntax-trees
                  • Symbols
                  • Keywords
                  • Programs
                  • Packages
                  • Bit-sizes
                • Dynamic-semantics
                • Compilation
                • Static-semantics
                • Concrete-syntax
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Identifiers

    Identifier-string-p

    Check if a string is a valid Leo identifier.

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

    The string's characters must follow the grammar rule. In addition, the string must not be a keyword or boolean literal, and must not be or start with aleo1.

    Definitions and Theorems

    Function: identifier-string-p

    (defun identifier-string-p (string)
      (declare (xargs :guard (stringp string)))
      (let ((__function__ 'identifier-string-p))
        (declare (ignorable __function__))
        (and (identifier-grammar-chars-p (acl2::explode string))
             (not (member-equal (str-fix string)
                                *keywords*))
             (not (equal (str-fix string) "true"))
             (not (equal (str-fix string) "false"))
             (not (prefixp (acl2::explode "aleo1")
                           (acl2::explode string))))))

    Theorem: booleanp-of-identifier-string-p

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

    Theorem: identifier-string-p-of-str-fix-string

    (defthm identifier-string-p-of-str-fix-string
      (equal (identifier-string-p (str-fix string))
             (identifier-string-p string)))

    Theorem: identifier-string-p-streqv-congruence-on-string

    (defthm identifier-string-p-streqv-congruence-on-string
      (implies (acl2::streqv string string-equiv)
               (equal (identifier-string-p string)
                      (identifier-string-p string-equiv)))
      :rule-classes :congruence)