Convert the first character of a string to lower case.
(downcase-first x) → downcased
(downcase-first x) returns a copy of the string
For sometimes-better performance, we avoid consing and simply return
Function:
(defun downcase-first (x) (declare (type string x)) (let ((acl2::__function__ 'downcase-first)) (declare (ignorable acl2::__function__)) (mbe :logic (implode (downcase-first-charlist (explode x))) :exec (if (eql (length x) 0) x (let ((c (char x 0))) (if (up-alpha-p c) (cat (downcase-char-str c) (subseq x 1 nil)) x))))))
Theorem:
(defthm stringp-of-downcase-first (b* ((downcased (downcase-first x))) (stringp downcased)) :rule-classes :type-prescription)
Theorem:
(defthm streqv-implies-equal-downcase-first-1 (implies (streqv x x-equiv) (equal (downcase-first x) (downcase-first x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm istreqv-implies-istreqv-downcase-first-1 (implies (istreqv x x-equiv) (istreqv (downcase-first x) (downcase-first x-equiv))) :rule-classes (:congruence))