Simple way to URL encode a string.
Function:
(defun url-encode-string$inline (x) (declare (type string x)) (declare (xargs :guard (stringp x))) (declare (xargs :split-types t)) (let ((acl2::__function__ 'url-encode-string)) (declare (ignorable acl2::__function__)) (let ((x (mbe :logic (str-fix x) :exec x))) (rchars-to-string (url-encode-string-aux x 0 (length x) nil)))))
Theorem:
(defthm stringp-of-url-encode-string (b* ((encoded (url-encode-string$inline x))) (stringp encoded)) :rule-classes :type-prescription)
Theorem:
(defthm url-encode-string$inline-of-str-fix-x (equal (url-encode-string$inline (str-fix x)) (url-encode-string$inline x)))
Theorem:
(defthm url-encode-string$inline-streqv-congruence-on-x (implies (streqv x x-equiv) (equal (url-encode-string$inline x) (url-encode-string$inline x-equiv))) :rule-classes :congruence)