• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
      • Std/lists
      • Omaps
      • Std/alists
      • Obags
      • Std/util
      • 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
        • Std/osets
        • Std/io
        • Std/basic
        • Std/system
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Html-encoding

    Html-encode-string-basic-aux

    Convert a string into HTML (simple version, no tab support).

    Signature
    (html-encode-string-basic-aux x n xl acc) → *
    Arguments
    x — String we're encoding.
        Guard (stringp x).
    n — Current position in x. Should typically start as 0.
        Guard (natp n).
    xl — Precomputed length of x.
        Guard (eql xl (length x)).
    acc — Accumulator for output characters, reverse order.

    Definitions and Theorems

    Function: html-encode-string-basic-aux

    (defun html-encode-string-basic-aux (x n xl acc)
      (declare (xargs :guard (and (stringp x)
                                  (natp n)
                                  (eql xl (length x)))))
      (declare (type unsigned-byte n xl))
      (declare (xargs :split-types t :guard (<= n xl)))
      (let ((acl2::__function__ 'html-encode-string-basic-aux))
        (declare (ignorable acl2::__function__))
        (mbe :logic
             (html-encode-chars-basic-aux (nthcdr n (explode x))
                                          acc)
             :exec
             (b* (((when (mbe :logic (zp (- (nfix xl) (nfix n)))
                              :exec (eql n xl)))
                   acc)
                  (acc (html-encode-char-basic (char x n) acc))
                  ((the unsigned-byte n)
                   (mbe :logic (+ 1 (lnfix n))
                        :exec (+ 1 n))))
               (html-encode-string-basic-aux x n xl acc)))))

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

    (defthm html-encode-string-basic-aux-of-str-fix-x
      (equal (html-encode-string-basic-aux (str-fix x)
                                           n xl acc)
             (html-encode-string-basic-aux x n xl acc)))

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

    (defthm html-encode-string-basic-aux-streqv-congruence-on-x
      (implies (streqv x x-equiv)
               (equal (html-encode-string-basic-aux x n xl acc)
                      (html-encode-string-basic-aux x-equiv n xl acc)))
      :rule-classes :congruence)

    Theorem: html-encode-string-basic-aux-of-nfix-n

    (defthm html-encode-string-basic-aux-of-nfix-n
      (equal (html-encode-string-basic-aux x (nfix n)
                                           xl acc)
             (html-encode-string-basic-aux x n xl acc)))

    Theorem: html-encode-string-basic-aux-nat-equiv-congruence-on-n

    (defthm html-encode-string-basic-aux-nat-equiv-congruence-on-n
      (implies (acl2::nat-equiv n n-equiv)
               (equal (html-encode-string-basic-aux x n xl acc)
                      (html-encode-string-basic-aux x n-equiv xl acc)))
      :rule-classes :congruence)