• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
        • Deftreeops
        • Defdefparse
        • Defgrammar
        • Tree-utilities
        • Notation
        • Grammar-parser
          • Grammar-parser-implementation
            • Parse-grammar-from-file
            • Parse-ichar2
            • Parse-ichar
            • Parse-in-either-range
            • Parse-*-in-either-range
            • Parse-bit
            • Parse-equal-/-equal-slash
            • Parse-wsp
            • Parse-*digit-star-*digit
            • Parse-hexdig
            • Parse-cwsp
            • Parse-concatenation
            • Parse-case-insensitive-string
            • Parse-alpha
            • Parse-dot-1*bit
            • Parse-case-sensitive-string
            • Parse-bin/dec/hex-val
            • Parse-alpha/digit/dash
            • Parse-rule
            • Parse-repeat
            • Parse-cnl
            • Parse-sp
            • Parse-rule-/-*cwsp-cnl
            • Parse-element
            • Parse-dec-val
            • Parse-bin-val
            • Parse-alternation
            • Parse-*cwsp-cnl
            • Parse-*bit
            • Parse-wsp/vchar
            • Parse-quoted-string
            • Parse-prose-val
            • Parse-hex-val
            • Parse-grammar
            • Parse-elements
            • Parse-defined-as
            • Parse-dash-1*hexdig
            • Parse-comment
            • Parse-char-val
            • Parse-1*bit
            • Parse-rulename
            • Parse-num-val
            • Parse-htab
            • Parse-hex-val-rest
            • Parse-dot-1*hexdig
            • Parse-dot-1*digit
            • Parse-digit
            • Parse-dec-val-rest
            • Parse-dash-1*digit
            • Parse-dash-1*bit
            • Parse-crlf
            • Parse-cr
            • Parse-conc-rest-comp
            • Parse-cnl-wsp
            • Parse-bin-val-rest
            • Parse-alt-rest-comp
            • Parse-*cwsp
            • Parse-vchar
            • Parse-rulelist
            • Parse-option
            • Parse-group
            • Parse-1*-dot-1*hexdig
            • Parse-1*-dot-1*digit
            • Parse-1*-dot-1*bit
            • Parse-*-rule-/-*cwsp-cnl
            • Parse-*-alpha/digit/dash
            • Parse-lf
            • Parse-dquote
            • Parse-1*hexdig
            • Parse-1*cwsp
            • Parse-?repeat
            • Parse-*-dot-1*hexdig
            • Parse-*-dot-1*digit
            • Parse-*-dot-1*bit
            • Parse-repetition
            • Parse-1*digit
            • Parse-?%i
            • Parse-*wsp/vchar
            • Parse-*hexdig
              • Parse-*digit
              • Parse-alt-rest
              • Parse-conc-rest
              • *grammar-parser-error-msg*
            • Grammar-parser-correctness
          • Meta-circular-validation
          • Parsing-primitives-defresult
          • Parsing-primitives-seq
          • Operations
          • Examples
          • Differences-with-paper
          • Constructor-utilities
          • Grammar-printer
          • Parsing-tools
        • 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
        • 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
    • Grammar-parser-implementation

    Parse-*hexdig

    Parse a repetition of zero or more hexadecimal digits.

    Signature
    (parse-*hexdig input) → (mv error? trees rest-input)
    Arguments
    input — Guard (nat-listp input).
    Returns
    error? — Type (not error?).
    trees — Type (tree-listp trees).
    rest-input — Type (nat-listp rest-input).

    Definitions and Theorems

    Function: parse-*hexdig

    (defun parse-*hexdig (input)
      (declare (xargs :guard (nat-listp input)))
      (seq-backtrack input
                     ((tree := (parse-hexdig input))
                      (trees := (parse-*hexdig input))
                      (return (cons tree trees)))
                     ((return-raw (mv nil nil (nat-list-fix input))))))

    Theorem: not-of-parse-*hexdig.error?

    (defthm not-of-parse-*hexdig.error?
      (b* (((mv ?error? ?trees ?rest-input)
            (parse-*hexdig input)))
        (not error?))
      :rule-classes :rewrite)

    Theorem: tree-listp-of-parse-*hexdig.trees

    (defthm tree-listp-of-parse-*hexdig.trees
      (b* (((mv ?error? ?trees ?rest-input)
            (parse-*hexdig input)))
        (tree-listp trees))
      :rule-classes :rewrite)

    Theorem: nat-listp-of-parse-*hexdig.rest-input

    (defthm nat-listp-of-parse-*hexdig.rest-input
      (b* (((mv ?error? ?trees ?rest-input)
            (parse-*hexdig input)))
        (nat-listp rest-input))
      :rule-classes :rewrite)

    Theorem: len-of-parse-*hexdig-linear

    (defthm len-of-parse-*hexdig-linear
      (b* (((mv ?error? ?trees ?rest-input)
            (parse-*hexdig input)))
        (<= (len rest-input) (len input)))
      :rule-classes :linear)

    Theorem: parse-*hexdig-of-nat-list-fix-input

    (defthm parse-*hexdig-of-nat-list-fix-input
      (equal (parse-*hexdig (nat-list-fix input))
             (parse-*hexdig input)))

    Theorem: parse-*hexdig-nat-list-equiv-congruence-on-input

    (defthm parse-*hexdig-nat-list-equiv-congruence-on-input
      (implies (acl2::nat-list-equiv input input-equiv)
               (equal (parse-*hexdig input)
                      (parse-*hexdig input-equiv)))
      :rule-classes :congruence)