• 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
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
          • Atj
          • Aij
          • Language
            • Syntax
              • Grammar
              • Unicode-escapes
                • Uniescape-parse-constraints-p
                • Even-backslashes-tree-constraints-p
                • Len-of-string-of-prefix-of-unicode-input-character-trees
                • Uniescape-parse
                • Nonzero-uletters-after-p
                  • Abs-unicode-escape
                  • Even-backslashes-before-p
                  • Uniescape-tree-constraints-p
                  • Uniescape-process
                  • Uniescape-candidate-valid-p
                  • Uniescape-candidate-p
                  • Abs-raw-input-character
                  • Abs-hex-digit
                  • Abs-unicode-input-character
                  • Some-uniescape-candidate-invalid-p
                  • Uniescapep
                  • Abs-unicode-input-character-list
                  • Uniescape-parse-p
                  • Eligible-backslash-p
                  • Unicode-input-character-tree-is-escape-p
                • Unicode-input-char
                • Escape-sequence
                • Identifiers
                • 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
          • Riscv
          • 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
    • Unicode-escapes

    Nonzero-uletters-after-p

    Check if, in a list of Unicode characters, the character at position pos is followed by a non-zero number of `u' letters.

    In this definition, we want n to be not merely a non-zero number of `u' letters at positions (+ pos 1) etc., but the maximum such number, i.e. such that (+ pos n 1) either is past the end of the list or is not a `u' letter; this is expressed by the last conjunct inside the quantification. The witness function returns this number, which is used in subsequent definitions.

    Note that (take n (nthcdr (1+ pos) unicodes)) consists of the characters from position (+ pos 1) to (+ pos n), both extremes inclusive (positions in lists are zero-based).

    Definitions and Theorems

    Theorem: nonzero-uletters-after-p-suff

    (defthm nonzero-uletters-after-p-suff
      (implies (and (posp n)
                    (< (+ pos n) (len unicodes))
                    (equal (take n (nthcdr (1+ pos) unicodes))
                           (repeat n (char-code #\u)))
                    (or (equal (1+ (+ pos n)) (len unicodes))
                        (not (equal (nth (1+ (+ pos n)) unicodes)
                                    (char-code #\u)))))
               (nonzero-uletters-after-p pos unicodes)))

    Theorem: booleanp-of-nonzero-uletters-after-p

    (defthm booleanp-of-nonzero-uletters-after-p
      (b* ((yes/no (nonzero-uletters-after-p pos unicodes)))
        (booleanp yes/no))
      :rule-classes :rewrite)

    Theorem: posp-of-nonzero-uletters-number

    (defthm posp-of-nonzero-uletters-number
      (implies (nonzero-uletters-after-p pos unicodes)
               (posp (number-of-nonzero-uletters-after pos unicodes)))
      :rule-classes :type-prescription)