• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • Std
      • Std/lists
      • Std/alists
      • Obags
      • Std/util
      • 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
          • Ordering
          • Numbers
          • Pad-trim
          • Coercion
          • Std/strings-extensions
          • Std/strings/digit-to-char
          • Substitution
          • Symbols
        • Std/io
        • Std/osets
        • Std/system
        • Std/basic
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
        • Std-extensions
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • 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)