• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • 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-next-col
              • Distance-to-tab
              • Repeated-revappend
            • 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
        • Std/osets
        • Std/io
        • Std/basic
        • Std/system
        • Std/typed-lists
        • Std/bitsets
        • Std/testing
        • Std/typed-alists
        • Std/stobjs
      • Community
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Html-encode-push

    Html-encode-next-col

    Compute where we'll be after printing a character, accounting for tab sizes and newlines.

    Signature
    (html-encode-next-col char1 col tabsize) → new-col
    Arguments
    char1 — Character to be printed.
        Guard (characterp char1).
    col — Current column number before printing char1.
        Guard (natp col).
    tabsize — Guard (posp tabsize).
    Returns
    new-col — New column number after printing char1.
        Type (natp new-col).

    Definitions and Theorems

    Function: html-encode-next-col$inline

    (defun html-encode-next-col$inline (char1 col tabsize)
      (declare (xargs :guard (and (characterp char1)
                                  (natp col)
                                  (posp tabsize))))
      (let ((acl2::__function__ 'html-encode-next-col))
        (declare (ignorable acl2::__function__))
        (b* ((char1 (mbe :logic (char-fix char1)
                         :exec char1))
             (col (lnfix col)))
          (cond ((eql char1 #\Newline) 0)
                ((eql char1 #\Tab)
                 (+ col (distance-to-tab col tabsize)))
                (t (+ 1 col))))))

    Theorem: natp-of-html-encode-next-col

    (defthm natp-of-html-encode-next-col
      (b* ((new-col (html-encode-next-col$inline char1 col tabsize)))
        (natp new-col))
      :rule-classes :type-prescription)

    Theorem: html-encode-next-col$inline-of-char-fix-char1

    (defthm html-encode-next-col$inline-of-char-fix-char1
      (equal (html-encode-next-col$inline (char-fix char1)
                                          col tabsize)
             (html-encode-next-col$inline char1 col tabsize)))

    Theorem: html-encode-next-col$inline-chareqv-congruence-on-char1

    (defthm html-encode-next-col$inline-chareqv-congruence-on-char1
     (implies
          (chareqv char1 char1-equiv)
          (equal (html-encode-next-col$inline char1 col tabsize)
                 (html-encode-next-col$inline char1-equiv col tabsize)))
     :rule-classes :congruence)

    Theorem: html-encode-next-col$inline-of-nfix-col

    (defthm html-encode-next-col$inline-of-nfix-col
      (equal (html-encode-next-col$inline char1 (nfix col)
                                          tabsize)
             (html-encode-next-col$inline char1 col tabsize)))

    Theorem: html-encode-next-col$inline-nat-equiv-congruence-on-col

    (defthm html-encode-next-col$inline-nat-equiv-congruence-on-col
     (implies
          (acl2::nat-equiv col col-equiv)
          (equal (html-encode-next-col$inline char1 col tabsize)
                 (html-encode-next-col$inline char1 col-equiv tabsize)))
     :rule-classes :congruence)

    Theorem: html-encode-next-col$inline-of-pos-fix-tabsize

    (defthm html-encode-next-col$inline-of-pos-fix-tabsize
     (equal
         (html-encode-next-col$inline char1 col (acl2::pos-fix tabsize))
         (html-encode-next-col$inline char1 col tabsize)))

    Theorem: html-encode-next-col$inline-pos-equiv-congruence-on-tabsize

    (defthm html-encode-next-col$inline-pos-equiv-congruence-on-tabsize
     (implies
          (acl2::pos-equiv tabsize tabsize-equiv)
          (equal (html-encode-next-col$inline char1 col tabsize)
                 (html-encode-next-col$inline char1 col tabsize-equiv)))
     :rule-classes :congruence)