• 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
        • Atj
        • Aij
        • Language
          • Syntax
            • Grammar
            • Unicode-escapes
              • Uniescape-parse-constraints-p
              • Even-backslashes-tree-constraints-p
              • Len-of-string-of-prefix-of-unicode-input-character-trees
              • Uniescape-parse
              • Nonzero-uletters-after-p
              • Abs-unicode-escape
              • Even-backslashes-before-p
              • Uniescape-tree-constraints-p
              • Uniescape-process
              • Uniescape-candidate-valid-p
              • Uniescape-candidate-p
              • Abs-raw-input-character
              • Abs-hex-digit
                • Abs-unicode-input-character
                • Some-uniescape-candidate-invalid-p
                • Uniescapep
                • Abs-unicode-input-character-list
                • Uniescape-parse-p
                • Eligible-backslash-p
                • Unicode-input-character-tree-is-escape-p
              • Unicode-input-char
              • Escape-sequence
              • Identifiers
              • Primitive-types
              • Reference-types
              • Keywords
              • Unicode-characters
              • Integer-literals
              • String-literals
              • Octal-digits
              • Hexadecimal-digits
              • Decimal-digits
              • Binary-digits
              • Character-literals
              • Null-literal
              • Floating-point-literals
              • Boolean-literals
              • Package-names
              • Literals
            • Semantics
        • Taspi
        • Riscv
        • 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
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Community
      • Proof-automation
      • ACL2
      • Macro-libraries
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Unicode-escapes

    Abs-hex-digit

    Abstract a hex-digit tree to a natural number below 16.

    Signature
    (abs-hex-digit tree) → val
    Arguments
    tree — Guard (abnf-tree-with-root-p tree "hex-digit").
    Returns
    val — Type (natp val).

    A hex-digit tree is essentially a single hexadecimal digit Unicode character, which denotes a natural number below 16. We abstract this kind of tree to the denoted value.

    A hex-digit tree has a single subtree, accessible via caar. That subtree is a terminal leaf tree with a single terminal (natural number) that is the ASCII/Unicode code of a hexadecimal digit, which we map to the value it denotes via hex-digit-value.

    Definitions and Theorems

    Function: abs-hex-digit

    (defun abs-hex-digit (tree)
      (declare (xargs :guard (abnf-tree-with-root-p tree "hex-digit")))
      (let ((__function__ 'abs-hex-digit))
        (declare (ignorable __function__))
        (b* ((subtree (caar (abnf::tree-nonleaf->branches tree)))
             (string (abnf::tree->string subtree))
             (hexdig (car string)))
          (hex-digit-value hexdig))))

    Theorem: natp-of-abs-hex-digit

    (defthm natp-of-abs-hex-digit
      (b* ((val (abs-hex-digit tree)))
        (natp val))
      :rule-classes :rewrite)

    Theorem: abs-hex-digit-upper-bound

    (defthm abs-hex-digit-upper-bound
      (b* ((?val (abs-hex-digit tree)))
        (<= val 15))
      :rule-classes :linear)