• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • 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
        • Bitcoin
        • Ethereum
        • Yul
          • Transformations
          • Language
            • Abstract-syntax
            • Dynamic-semantics
            • Concrete-syntax
            • Static-soundness
            • Static-semantics
              • Static-safety-checking
              • Static-shadowing-checking
              • Mode-set-result
              • Literal-evaluation
                • Eval-literal
                • Eval-hex-string-literal
                • Eval-plain-string-literal
                • Ubyte16-to-utf8
                • Eval-escape
                • Eval-string-element
                • Eval-hex-string-rest-element-list
                • Eval-hex-string-rest-element
                • Eval-hex-string-content
                • Eval-string-element-list
                • Eval-hex-quad
                • Eval-hex-pair
                • Static-identifier-checking
                • Static-safety-checking-evm
                • Mode-set
                • Modes
              • 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
    • Literal-evaluation

    Eval-hex-pair

    Evaluate a pair of hex digits to a byte.

    Signature
    (eval-hex-pair hp) → val
    Arguments
    hp — Guard (hex-pairp hp).
    Returns
    val — Type (ubyte8p val).

    The digits are interpreted in big endian form.

    Definitions and Theorems

    Function: eval-hex-pair

    (defun eval-hex-pair (hp)
      (declare (xargs :guard (hex-pairp hp)))
      (let ((__function__ 'eval-hex-pair))
        (declare (ignorable __function__))
        (str::hex-digit-chars-value
             (list (hex-digit->get (hex-pair->1st hp))
                   (hex-digit->get (hex-pair->2nd hp))))))

    Theorem: ubyte8p-of-eval-hex-pair

    (defthm ubyte8p-of-eval-hex-pair
      (b* ((val (eval-hex-pair hp)))
        (ubyte8p val))
      :rule-classes :rewrite)

    Theorem: eval-hex-pair-of-hex-pair-fix-hp

    (defthm eval-hex-pair-of-hex-pair-fix-hp
      (equal (eval-hex-pair (hex-pair-fix hp))
             (eval-hex-pair hp)))

    Theorem: eval-hex-pair-hex-pair-equiv-congruence-on-hp

    (defthm eval-hex-pair-hex-pair-equiv-congruence-on-hp
      (implies (hex-pair-equiv hp hp-equiv)
               (equal (eval-hex-pair hp)
                      (eval-hex-pair hp-equiv)))
      :rule-classes :congruence)