• 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
          • Atj
          • Aij
          • Language
            • Syntax
            • Semantics
              • Primitive-function-macros
              • Primitive-values
              • Floating-point-placeholders
              • Pointers
              • Floating-point-value-set-parameters
              • Values
              • Primitive-operations
              • Primitive-conversions
                • Primitive-narrowing-conversions
                  • Short-to-char
                  • Short-to-byte
                  • Long-to-short
                  • Float-to-short
                  • Float-to-long
                  • Float-to-char
                  • Float-to-byte
                  • Double-to-short
                  • Double-to-long
                  • Double-to-int
                  • Double-to-float
                  • Double-to-char
                  • Double-to-byte
                  • Char-to-short
                  • Long-to-int
                  • Long-to-char
                  • Long-to-byte
                  • Int-to-short
                  • Int-to-char
                  • Int-to-byte
                  • Float-to-int
                  • Char-to-byte
                  • Primitive-widening-conversions
                  • Primitive-widening-narrowing-conversions
                • Reference-values
          • Bitcoin
          • Ethereum
          • Yul
          • 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
    • Primitive-narrowing-conversions

    Char-to-byte

    Narrowing conversion from char to byte [JLS14:5.1.3].

    Signature
    (char-to-byte operand) → result
    Arguments
    operand — Guard (char-valuep operand).
    Returns
    result — Type (byte-valuep result).

    Definitions and Theorems

    Function: char-to-byte

    (defun char-to-byte (operand)
      (declare (xargs :guard (char-valuep operand)))
      (b* ((x (char-value->nat operand)))
        (byte-value (logext 8 x))))

    Theorem: byte-valuep-of-char-to-byte

    (defthm byte-valuep-of-char-to-byte
      (b* ((result (char-to-byte operand)))
        (byte-valuep result))
      :rule-classes :rewrite)

    Theorem: char-to-byte-of-char-value-fix-operand

    (defthm char-to-byte-of-char-value-fix-operand
      (equal (char-to-byte (char-value-fix operand))
             (char-to-byte operand)))

    Theorem: char-to-byte-char-value-equiv-congruence-on-operand

    (defthm char-to-byte-char-value-equiv-congruence-on-operand
      (implies (char-value-equiv operand operand-equiv)
               (equal (char-to-byte operand)
                      (char-to-byte operand-equiv)))
      :rule-classes :congruence)