Function:
(defun downcase-string-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) (eql xl (length x))))) (declare (xargs :split-types t :guard (<= n xl))) (let ((acl2::__function__ 'downcase-string-aux)) (declare (ignorable acl2::__function__)) (mbe :logic (revappend (downcase-charlist (nthcdr n (explode x))) acc) :exec (if (eql n xl) acc (let* ((char (char x n)) (downchar (downcase-char char))) (downcase-string-aux x (+ 1 n) xl (cons downchar acc)))))))