• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
        • Defun
        • Declare
        • System-utilities
        • Stobj
        • State
        • Mutual-recursion
        • Memoize
        • Mbe
        • Io
        • Defpkg
        • Apply$
        • Loop$
        • Programming-with-state
        • Arrays
        • Characters
        • Time$
        • Defconst
        • Fast-alists
        • Defmacro
        • Loop$-primer
        • Evaluation
        • Guard
        • Equality-variants
        • Compilation
        • Hons
        • ACL2-built-ins
        • Developers-guide
        • System-attachments
        • Advanced-features
        • Set-check-invariant-risk
        • Numbers
        • Efficiency
        • Irrelevant-formals
        • Introduction-to-programming-in-ACL2-for-those-who-know-lisp
        • Redefining-programs
        • Lists
        • Invariant-risk
        • Errors
        • Defabbrev
        • Conses
        • Alists
        • Set-register-invariant-risk
        • Strings
          • Std/strings
            • Pretty-printing
            • Printtree
            • Base64
            • Charset-p
            • Strtok!
            • Cases
            • Concatenation
            • Character-kinds
            • Html-encoding
              • Html-encode-string-aux
              • Html-encode-chars-aux
              • Html-encode-push
              • Html-encode-string-basic-aux
              • Html-encode-string
              • Html-encode-char-basic
                • Html-encode-chars-basic-aux
                • Html-encode-string-basic
              • Substrings
              • Strtok
              • Equivalences
              • Url-encoding
              • Lines
              • Explode-implode-equalities
              • Ordering
              • Numbers
              • Pad-trim
              • Coercion
              • Std/strings/digit-to-char
              • Substitution
              • Symbols
            • String-listp
            • Stringp
            • Length
            • Search
            • Remove-duplicates
            • Position
            • Coerce
            • Concatenate
            • Reverse
            • String
            • Subseq
            • Substitute
            • String-upcase
            • String-downcase
            • Count
            • Char
            • String<
            • String-equal
            • String-utilities
            • String-append
            • String>=
            • String<=
            • String>
            • Hex-digit-char-theorems
            • String-downcase-gen
            • String-upcase-gen
          • Program-wrapper
          • Get-internal-time
          • Basics
          • Packages
          • Oracle-eval
          • Defmacro-untouchable
          • <<
          • Primitive
          • Revert-world
          • Unmemoize
          • Set-duplicate-keys-action
          • Symbols
          • Def-list-constructor
          • Easy-simplify-term
          • Defiteration
          • Fake-oracle-eval
          • Defopen
          • Sleep
        • Operational-semantics
        • Real
        • Start-here
        • Miscellaneous
        • Output-controls
        • Bdd
        • Macros
        • Installation
        • Mailing-lists
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Html-encoding

    Html-encode-char-basic

    HTML encode a single character (simple version, no tab support).

    Signature
    (html-encode-char-basic x acc) → new-acc
    Arguments
    x — Character to encode.
        Guard (characterp x).
    acc — Accumulator for output characters, reverse order.
    Returns
    new-acc — Type (character-listp new-acc), given (character-listp acc).

    Definitions and Theorems

    Function: html-encode-char-basic$inline

    (defun html-encode-char-basic$inline (x acc)
      (declare (xargs :guard (characterp x)))
      (declare (type character x))
      (declare (xargs :split-types t))
      (let ((acl2::__function__ 'html-encode-char-basic))
        (declare (ignorable acl2::__function__))
        (b* (((the character x)
              (mbe :logic (char-fix x) :exec x)))
          (case x
            (#\Space (if (or (atom acc)
                             (eql (car acc) #\Space)
                             (eql (car acc) #\Newline))
                         (revappend (html-space) acc)
                       (cons #\Space acc)))
            (#\Newline (revappend (html-newline) acc))
            (#\< (revappend (html-less) acc))
            (#\> (revappend (html-greater) acc))
            (#\& (revappend (html-amp) acc))
            (#\" (revappend (html-quote) acc))
            (otherwise (cons x acc))))))

    Theorem: character-listp-of-html-encode-char-basic

    (defthm character-listp-of-html-encode-char-basic
      (implies (character-listp acc)
               (b* ((new-acc (html-encode-char-basic$inline x acc)))
                 (character-listp new-acc)))
      :rule-classes :rewrite)

    Theorem: html-encode-char-basic$inline-of-char-fix-x

    (defthm html-encode-char-basic$inline-of-char-fix-x
      (equal (html-encode-char-basic$inline (char-fix x)
                                            acc)
             (html-encode-char-basic$inline x acc)))

    Theorem: html-encode-char-basic$inline-chareqv-congruence-on-x

    (defthm html-encode-char-basic$inline-chareqv-congruence-on-x
      (implies (chareqv x x-equiv)
               (equal (html-encode-char-basic$inline x acc)
                      (html-encode-char-basic$inline x-equiv acc)))
      :rule-classes :congruence)