Function:
(defun json-encode-str-aux (x n xl acc) (declare (type string x) (type (integer 0 *) n) (type (integer 0 *) xl)) (declare (xargs :guard (and (stringp x) (natp n) (equal xl (length x))))) (declare (xargs :split-types t :guard (<= n xl))) (let ((__function__ 'json-encode-str-aux)) (declare (ignorable __function__)) (b* (((when (mbe :logic (zp (- (nfix xl) (nfix n))) :exec (eql n xl))) acc) (acc (json-encode-char (char x n) acc)) ((the (integer 0 *) n) (+ 1 (the (integer 0 *) (lnfix n))))) (json-encode-str-aux x n xl acc))))
Theorem:
(defthm json-encode-str-aux-redef (implies (and (stringp x) (natp n) (natp xl) (<= n xl) (eql xl (length x))) (equal (json-encode-str-aux x n xl acc) (json-encode-chars (nthcdr n (explode x)) acc))))