• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • Proof-automation
    • ACL2
    • Macro-libraries
    • 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
        • Bitcoin
        • Ethereum
        • Yul
          • Transformations
          • Language
            • Abstract-syntax
            • Dynamic-semantics
            • Concrete-syntax
              • Lexer
                • Lex-keyword
                • Lex-group-escape-sequence-single
                • Lex-symbol
                • Lex-rest-of-block-comment-fns
                • Lex-group-for-hex-string
                • Lex-hex-digit
                • Lex-group-escape-sequence-body
                • Lex-whitespace-char
                • Lex-string-literal
                • Lex-literal
                • Lex-identifier-start
                • Lex-hex-string
                • Lex-single-quoted-printable
                • Lex-double-quoted-printable
                • Lex-group-optional-underbar-and-two-hex-digits
                • Lex-escape-sequence
                • Lex-token
                • Lex-not-star-or-slash
                • Lex-not-lf-or-cr
                • Lex-group-squoted-or-escape
                • Lex-group-dquoted-or-escape
                • Lex-optional-sequence-of-2hex-digits
                • Lex-decimal-number
                • Lex-lexeme
                • Lex-identifier-rest
                • Lex-end-of-line-comment
                • Lex-nonzero-decimal-digit
                • Lex-repetition-*-optional-underbar-and-two-hex-digits
                • Lex-not-star
                • Lex-comment
                • Lex-boolean
                • Lex-block-comment
                • Lex-uppercase-letter
                • Lex-lowercase-letter
                • Lex-identifier
                • Lex-hex-number
                • Lex-decimal-digit
                • Lex-squote
                • Lex-repetition-4-hex-digits
                • Lex-optional-underbar
                • Lex-dquote
                • Lex-repetition-*-squoted-or-escape
                • Lex-repetition-*-dquoted-or-escape
                • Lex-repetition-*-whitespace-char
                • Lex-repetition-*-identifier-rest
                • Lex-repetition-2-hex-digits
                  • Lex-lf
                  • Lex-cr
                  • Lex-repetition-*-not-lf-or-cr
                  • Lex-repetition-*-decimal-digit
                  • Lexemeize-yul
                  • Lex-repetition-*-lexeme
                  • Lex-repetition-*-hex-digit
                  • *defparse-yul-group-table*
                  • Lex-whitespace
                  • Lexemeize-yul-bytes
                  • *defparse-yul-repetition-table*
                  • *defparse-yul-option-table*
                • Parser
                • Grammar-old
                • Grammar
                • Tokenizer
              • Static-soundness
              • Static-semantics
              • Errors
            • Yul-json
          • 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
    • Lexer

    Lex-repetition-2-hex-digits

    Lex exactly 2 hexadecimal digits.

    Signature
    (lex-repetition-2-hex-digits input) → (mv trees rest-input)
    Arguments
    input — Guard (nat-listp input).
    Returns
    trees — Type (abnf::tree-list-resultp trees).
    rest-input — Type (nat-listp rest-input).

    This is used to lex an 8-bit number expressed in hex.

    Definitions and Theorems

    Function: lex-repetition-2-hex-digits

    (defun lex-repetition-2-hex-digits (input)
      (declare (xargs :guard (nat-listp input)))
      (let ((__function__ 'lex-repetition-2-hex-digits))
        (declare (ignorable __function__))
        (b* (((mv tree-digit1 input-after-digit1)
              (lex-hex-digit input))
             ((when (reserrp tree-digit1))
              (mv tree-digit1 (nat-list-fix input)))
             ((mv tree-digit2 input-after-digit2)
              (lex-hex-digit input-after-digit1))
             ((when (reserrp tree-digit2))
              (mv tree-digit2 (nat-list-fix input))))
          (mv (list tree-digit1 tree-digit2)
              input-after-digit2))))

    Theorem: tree-list-resultp-of-lex-repetition-2-hex-digits.trees

    (defthm tree-list-resultp-of-lex-repetition-2-hex-digits.trees
      (b* (((mv ?trees ?rest-input)
            (lex-repetition-2-hex-digits input)))
        (abnf::tree-list-resultp trees))
      :rule-classes :rewrite)

    Theorem: nat-listp-of-lex-repetition-2-hex-digits.rest-input

    (defthm nat-listp-of-lex-repetition-2-hex-digits.rest-input
      (b* (((mv ?trees ?rest-input)
            (lex-repetition-2-hex-digits input)))
        (nat-listp rest-input))
      :rule-classes :rewrite)

    Theorem: len-of-lex-repetition-2-hex-digits-<

    (defthm len-of-lex-repetition-2-hex-digits-<
      (b* (((mv ?trees ?rest-input)
            (lex-repetition-2-hex-digits input)))
        (implies (not (reserrp trees))
                 (< (len rest-input) (len input))))
      :rule-classes :linear)

    Theorem: lex-repetition-2-hex-digits-of-nat-list-fix-input

    (defthm lex-repetition-2-hex-digits-of-nat-list-fix-input
      (equal (lex-repetition-2-hex-digits (nat-list-fix input))
             (lex-repetition-2-hex-digits input)))

    Theorem: lex-repetition-2-hex-digits-nat-list-equiv-congruence-on-input

    (defthm
         lex-repetition-2-hex-digits-nat-list-equiv-congruence-on-input
      (implies (acl2::nat-list-equiv input input-equiv)
               (equal (lex-repetition-2-hex-digits input)
                      (lex-repetition-2-hex-digits input-equiv)))
      :rule-classes :congruence)