• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • 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$
        • Defmacro
        • Loop$-primer
        • Fast-alists
        • Defconst
        • 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
            • 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
              • Character-kinds
              • 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
        • Debugging
        • Miscellaneous
        • Output-controls
        • Macros
        • Interfacing-tools
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Html-encoding

    Html-encode-string

    (html-encode-string x tabsize) converts the string x into HTML, and returns the result as a new string. Tracks the column number to handle tab characters.

    Signature
    (html-encode-string x tabsize) → html-encoded
    Arguments
    x — Guard (stringp x).
    tabsize — Guard (posp tabsize).
    Returns
    html-encoded — Type (stringp html-encoded).

    Definitions and Theorems

    Function: html-encode-string

    (defun html-encode-string (x tabsize)
      (declare (xargs :guard (and (stringp x) (posp tabsize))))
      (let ((acl2::__function__ 'html-encode-string))
        (declare (ignorable acl2::__function__))
        (b* ((x (mbe :logic (str-fix x) :exec x))
             ((mv ?col acc)
              (html-encode-string-aux x 0 (length x)
                                      0 tabsize nil)))
          (rchars-to-string acc))))

    Theorem: stringp-of-html-encode-string

    (defthm stringp-of-html-encode-string
      (b* ((html-encoded (html-encode-string x tabsize)))
        (stringp html-encoded))
      :rule-classes :type-prescription)

    Theorem: html-encode-string-of-str-fix-x

    (defthm html-encode-string-of-str-fix-x
      (equal (html-encode-string (str-fix x) tabsize)
             (html-encode-string x tabsize)))

    Theorem: html-encode-string-streqv-congruence-on-x

    (defthm html-encode-string-streqv-congruence-on-x
      (implies (streqv x x-equiv)
               (equal (html-encode-string x tabsize)
                      (html-encode-string x-equiv tabsize)))
      :rule-classes :congruence)

    Theorem: html-encode-string-of-pos-fix-tabsize

    (defthm html-encode-string-of-pos-fix-tabsize
      (equal (html-encode-string x (acl2::pos-fix tabsize))
             (html-encode-string x tabsize)))

    Theorem: html-encode-string-pos-equiv-congruence-on-tabsize

    (defthm html-encode-string-pos-equiv-congruence-on-tabsize
      (implies (acl2::pos-equiv tabsize tabsize-equiv)
               (equal (html-encode-string x tabsize)
                      (html-encode-string x tabsize-equiv)))
      :rule-classes :congruence)