HTML encode a single character (simple version, no tab support).
(html-encode-char-basic x acc) → new-acc
Function:
(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:
(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:
(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:
(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)