• 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
      • Taspi
      • Bitcoin
      • Riscv
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
        • Transformations
        • Language
          • Abstract-syntax
          • Dynamic-semantics
            • Exec
            • Find-fun
            • Init-local
            • Write-vars-values
            • Add-vars-values
            • Add-funs
            • Eoutcome
            • Soutcome
            • Ensure-funscope-disjoint
            • Write-var-value
            • Restrict-vars
            • Add-var-value
            • Funinfo
            • Exec-top-block
            • Values
            • Cstate
            • Funinfo+funenv
            • Read-vars-values
            • Read-var-value
            • Funenv
            • Funscope-for-fundefs
            • Exec-path
            • Path-to-var
            • Funinfo+funenv-result
            • Exec-literal
            • Soutcome-result
            • 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
              • Funscope-result
              • Funinfo-result
              • Funenv-result
              • Eoutcome-result
              • Cstate-result
              • Paths-to-vars
              • Funinfo-for-fundef
              • Lstate
              • Funscope
              • Mode-set
              • Modes
            • Concrete-syntax
            • Static-soundness
            • Static-semantics
            • Errors
          • Yul-json
        • 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
    • Literal-evaluation

    Eval-string-element

    Evaluate a string element to a list of bytes.

    Signature
    (eval-string-element elem) → bytes
    Arguments
    elem — Guard (string-elementp elem).
    Returns
    bytes — Type (ubyte8-listp bytes).

    The evaluation of plain string literals involves first turning the string into a sequence of bytes. An escape is turned into a list of bytes as formalized in eval-escape. A single character is turned into a singleton list consisting of the character's code.

    Definitions and Theorems

    Function: eval-string-element

    (defun eval-string-element (elem)
      (declare (xargs :guard (string-elementp elem)))
      (let ((__function__ 'eval-string-element))
        (declare (ignorable __function__))
        (string-element-case elem
                             :char (list (char-code elem.get))
                             :escape (eval-escape elem.get))))

    Theorem: ubyte8-listp-of-eval-string-element

    (defthm ubyte8-listp-of-eval-string-element
      (b* ((bytes (eval-string-element elem)))
        (ubyte8-listp bytes))
      :rule-classes :rewrite)

    Theorem: eval-string-element-of-string-element-fix-elem

    (defthm eval-string-element-of-string-element-fix-elem
      (equal (eval-string-element (string-element-fix elem))
             (eval-string-element elem)))

    Theorem: eval-string-element-string-element-equiv-congruence-on-elem

    (defthm eval-string-element-string-element-equiv-congruence-on-elem
      (implies (string-element-equiv elem elem-equiv)
               (equal (eval-string-element elem)
                      (eval-string-element elem-equiv)))
      :rule-classes :congruence)