• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
      • Zcash
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Poseidon
      • Where-do-i-place-my-book
      • Axe
      • Aleo
        • Aleobft
        • Aleovm
        • Leo
          • Grammar
          • Early-version
            • Json2ast
            • Testing
            • Definition
              • Flattening
              • Abstract-syntax
              • Dynamic-semantics
              • Compilation
              • Static-semantics
              • Concrete-syntax
                • Pretty-printer
                • Grammar
                • Lexing-and-parsing
                  • Lexer
                    • Lex-symbol
                    • Lex-rest-of-block-comment-+-lex-rest-of-block-comment-after-star
                    • Lex-not-double-quote-or-backslash-or-line-feed-or-carriage-return
                    • Lex-not-star-or-slash-or-line-feed-or-carriage-return
                    • Lex-identifier/keyword/boolean/address
                    • Lex-simple-character-escape
                    • Lex-hexadecimal-digit
                    • Lex-token
                    • Lex-not-star-or-line-feed-or-carriage-return
                    • Lex-u8/16/32/64/128
                    • Lex-not-line-feed-or-carriage-return
                    • Lex-i8/16/32/64/128
                    • Lex-string-literal-element
                    • Lex-safe-ascii
                    • Lex-numeric-literal
                    • Lex-safe-nonascii
                    • Lex-letter/decdigit/underscore
                    • Lex-line-terminator
                    • Lex-unicode-character-escape
                    • Lex-ascii-character-escape
                    • Lex-1*6-hexadecimal-digit
                    • Lex-whitespace
                    • Lex-unsigned-literal
                    • Lex-lcletter/decdigit
                    • Lex-string-literal
                    • Lex-signed-literal
                    • Lex-product-group-literal
                    • Lex-lexeme
                    • Lex-single-quote-escape
                    • Lex-integer-literal
                    • Lex-double-quote-escape
                    • Lex-address-literal
                    • Lex-scalar-literal
                    • Lex-null-character-escape
                    • Lex-identifier
                    • Lex-horizontal-tab-escape
                    • Lex-carriage-return-escape
                    • Lex-line-comment
                    • Lex-letter
                      • Lex-field-literal
                      • Lex-comment
                      • Lex-block-comment
                      • Lex-uppercase-letter
                      • Lex-lowercase-letter
                      • Lex-line-feed-escape
                      • Lex-horizontal-tab
                      • Lex-carriage-return
                      • Lex-backslash-escape
                      • Lex-annotation
                      • Lex-visible-ascii
                      • Lex-single-quote
                      • Lex-octal-digit
                      • Lex-double-quote
                      • Lex-decimal-digit
                      • Lex-*-not-line-feed-or-carriage-return
                      • Lex-line-feed
                      • Lex-space
                      • Lex-numeral
                      • Lex-*-letter/decdigit/underscore
                      • Lex-*-string-literal-element
                      • Lex-58-lcletter/decdigit
                      • Lexemize-leo-from-string
                      • Lex-*-lcletter/decdigit
                      • Lex-*-hexadecimal-digit
                      • Lex-1*-decimal-digit
                      • Lex-*-decimal-digit
                      • Lex-*-lexeme
                      • Lexemize-leo-from-bytes
                      • Lexemize-leo
                      • *defparse-leo-repetition-table*
                      • *defparse-leo-group-table*
                      • Lex-generation-macros
                      • Lex-generation-tables
                      • *defparse-leo-option-table*
                    • Parser
                    • Token-fringe
                    • Longest-lexp
                    • Parser-interface
                    • Grammar-lexp
                    • Identifier-lexp
                    • Output-file-parsep
                    • Input-file-parsep
                    • File-lex-parse-p
                    • Filter-tokens
                    • Lexp
                    • File-parsep
                    • Input-parser
                    • Output-file-lex-parse-p
                    • Input-file-lex-parse-p
                    • Parser-abstractor-interface
                    • Identifier-abnf-stringp
                    • Symbol-abnf-stringp
                    • Keyword-abnf-stringp
                    • Output-parser
                    • Tokenizer
                  • Input-pretty-printer
                  • Output-pretty-printer
                  • Unicode-characters
                  • Concrete-syntax-trees
                  • Symbols
                  • Keywords
        • 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
    • Lexer

    Lex-letter

    Parse a letter.

    Signature
    (lex-letter abnf::input) → (mv abnf::tree abnf::rest-input)
    Arguments
    abnf::input — Guard (nat-listp abnf::input).
    Returns
    abnf::tree — Type (abnf::tree-resultp abnf::tree).
    abnf::rest-input — Type (nat-listp abnf::rest-input).

    Definitions and Theorems

    Function: lex-letter

    (defun lex-letter (abnf::input)
     (declare (xargs :guard (nat-listp abnf::input)))
     (let ((__function__ 'lex-letter))
      (declare (ignorable __function__))
      (b*
       (((mv abnf::treess abnf::input)
         (b* (((mv abnf::treess1 abnf::input1)
               (b* (((mv abnf::tree abnf::input)
                     (lex-uppercase-letter abnf::input))
                    ((when (reserrp abnf::tree))
                     (mv (reserrf-push abnf::tree)
                         abnf::input))
                    (abnf::trees1 (list abnf::tree))
                    (abnf::treess (list abnf::trees1)))
                 (mv abnf::treess abnf::input)))
              ((when (not (reserrp abnf::treess1)))
               (mv abnf::treess1 abnf::input1))
              ((mv abnf::treess2 abnf::input1)
               (b* (((mv abnf::tree abnf::input)
                     (lex-lowercase-letter abnf::input))
                    ((when (reserrp abnf::tree))
                     (mv (reserrf-push abnf::tree)
                         abnf::input))
                    (abnf::trees1 (list abnf::tree))
                    (abnf::treess (list abnf::trees1)))
                 (mv abnf::treess abnf::input)))
              ((when (not (reserrp abnf::treess2)))
               (mv abnf::treess2 abnf::input1)))
          (mv
           (reserrf
            (list
                 :found (list abnf::treess1 abnf::treess2)
                 :required
                 '(((:repetition
                         (:repeat 1 (:finite 1))
                         (:rulename (:rulename "uppercase-letter"))))
                   ((:repetition
                         (:repeat 1 (:finite 1))
                         (:rulename (:rulename "lowercase-letter")))))))
           abnf::input)))
        ((when (reserrp abnf::treess))
         (mv (reserrf-push abnf::treess)
             (nat-list-fix abnf::input))))
       (mv (abnf::make-tree-nonleaf :rulename? (abnf::rulename "letter")
                                    :branches abnf::treess)
           abnf::input))))

    Theorem: tree-resultp-of-lex-letter.tree

    (defthm tree-resultp-of-lex-letter.tree
      (b* (((mv abnf::?tree abnf::?rest-input)
            (lex-letter abnf::input)))
        (abnf::tree-resultp abnf::tree))
      :rule-classes :rewrite)

    Theorem: nat-listp-of-lex-letter.rest-input

    (defthm nat-listp-of-lex-letter.rest-input
      (b* (((mv abnf::?tree abnf::?rest-input)
            (lex-letter abnf::input)))
        (nat-listp abnf::rest-input))
      :rule-classes :rewrite)

    Theorem: len-of-lex-letter-<=

    (defthm len-of-lex-letter-<=
      (b* (((mv abnf::?tree abnf::?rest-input)
            (lex-letter abnf::input)))
        (<= (len abnf::rest-input)
            (len abnf::input)))
      :rule-classes :linear)

    Theorem: len-of-lex-letter-<

    (defthm len-of-lex-letter-<
      (b* (((mv abnf::?tree abnf::?rest-input)
            (lex-letter abnf::input)))
        (implies (not (reserrp abnf::tree))
                 (< (len abnf::rest-input)
                    (len abnf::input))))
      :rule-classes :linear)

    Theorem: lex-letter-of-nat-list-fix-input

    (defthm lex-letter-of-nat-list-fix-input
      (equal (lex-letter (nat-list-fix abnf::input))
             (lex-letter abnf::input)))

    Theorem: lex-letter-nat-list-equiv-congruence-on-input

    (defthm lex-letter-nat-list-equiv-congruence-on-input
      (implies (acl2::nat-list-equiv abnf::input input-equiv)
               (equal (lex-letter abnf::input)
                      (lex-letter input-equiv)))
      :rule-classes :congruence)