• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
        • Proof-support
        • Abstract-syntax
        • R1cs-subset
        • Semantics
        • Abstract-syntax-operations
        • Indexed-names
        • Well-formedness
        • Concrete-syntax
          • Lexer
          • Grammar
          • Parser
            • Parse-separator
            • Parse-operator
            • Parse-definition
            • Parse-relation-constraint
            • Parse-equality-constraint
            • Parse-*-comma-identifier
            • Parse-*-comma-expression
            • Parse-*-comma-constraint
            • Parse-system
            • Parse-identifier
            • Parse-pfcs-integer
            • Parse-constraint
            • Parse-*-definition
            • Parse-*-constraint
            • Parsize
            • Check-token-string
            • Check-token-root
            • Parse-token
              • Token-stringp
              • Token-rootp
              • Patbind-pok<
              • Parse-multiplication-expression-rest
              • Parse-addition-expression-rest
              • Parse-primary-expression
              • Parse-multiplication-expression
              • Parse-addition-expression
              • Parse-expression
              • Patbind-pok
              • Perr
            • Tokenizer
          • R1cs-bridge
          • Parser-interface
        • Legacy-defrstobj
        • Proof-checker-array
        • Soft
        • C
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Taspi
        • Bitcoin
        • Riscv
        • 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
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Parser

    Parse-token

    Parse a token.

    Signature
    (parse-token input) → (mv tree? rest-input)
    Arguments
    input — Guard (abnf::tree-listp input).
    Returns
    tree? — Type (abnf::tree-optionp tree?).
    rest-input — Type (abnf::tree-listp rest-input).

    This is used to obtain the next token in the input, if any.

    Definitions and Theorems

    Function: parse-token

    (defun parse-token (input)
      (declare (xargs :guard (abnf::tree-listp input)))
      (let ((__function__ 'parse-token))
        (declare (ignorable __function__))
        (b* (((when (atom input)) (mv nil nil))
             (input (abnf::tree-list-fix input)))
          (mv (car input) (cdr input)))))

    Theorem: tree-optionp-of-parse-token.tree?

    (defthm tree-optionp-of-parse-token.tree?
      (b* (((mv ?tree? ?rest-input)
            (parse-token input)))
        (abnf::tree-optionp tree?))
      :rule-classes :rewrite)

    Theorem: tree-listp-of-parse-token.rest-input

    (defthm tree-listp-of-parse-token.rest-input
      (b* (((mv ?tree? ?rest-input)
            (parse-token input)))
        (abnf::tree-listp rest-input))
      :rule-classes :rewrite)

    Theorem: len-of-parse-token-<=

    (defthm len-of-parse-token-<=
      (b* (((mv ?tree? ?rest-input)
            (parse-token input)))
        (<= (len rest-input) (len input)))
      :rule-classes :linear)

    Theorem: len-of-parse-token-<

    (defthm len-of-parse-token-<
      (b* (((mv ?tree? ?rest-input)
            (parse-token input)))
        (implies tree? (< (len rest-input) (len input))))
      :rule-classes :linear)

    Theorem: parse-token-of-tree-list-fix-input

    (defthm parse-token-of-tree-list-fix-input
      (equal (parse-token (abnf::tree-list-fix input))
             (parse-token input)))

    Theorem: parse-token-tree-list-equiv-congruence-on-input

    (defthm parse-token-tree-list-equiv-congruence-on-input
      (implies (abnf::tree-list-equiv input input-equiv)
               (equal (parse-token input)
                      (parse-token input-equiv)))
      :rule-classes :congruence)