Convert every character in a list to lower case.
(downcase-charlist x) → *
ACL2 has a built-in alternative to this function,
For sometimes-better performance, we avoid consing and simply return
Function:
(defun downcase-charlist (x) (declare (xargs :guard (character-listp x))) (let ((acl2::__function__ 'downcase-charlist)) (declare (ignorable acl2::__function__)) (mbe :logic (if (atom x) nil (cons (downcase-char (car x)) (downcase-charlist (cdr x)))) :exec (if (charlist-has-some-up-alpha-p x) (reverse (downcase-charlist-aux x nil)) x))))
Theorem:
(defthm downcase-charlist-when-atom (implies (atom x) (equal (downcase-charlist x) nil)))
Theorem:
(defthm downcase-charlist-of-cons (equal (downcase-charlist (cons a x)) (cons (downcase-char a) (downcase-charlist x))))
Theorem:
(defthm icharlisteqv-implies-equal-downcase-charlist-1 (implies (icharlisteqv x x-equiv) (equal (downcase-charlist x) (downcase-charlist x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm character-listp-downcase-charlist (character-listp (downcase-charlist x)))
Theorem:
(defthm consp-of-downcase-charlist (equal (consp (downcase-charlist x)) (consp x)))
Theorem:
(defthm downcase-charlist-under-iff (iff (downcase-charlist x) (consp x)))
Theorem:
(defthm len-of-downcase-charlist (equal (len (downcase-charlist x)) (len x)))
Theorem:
(defthm downcase-charlist-aux-is-downcase-charlist (equal (downcase-charlist-aux x acc) (revappend (downcase-charlist x) acc)))
Theorem:
(defthm downcase-charlist-does-nothing-unless-charlist-has-some-up-alpha-p (implies (and (not (charlist-has-some-up-alpha-p x)) (character-listp x)) (equal (downcase-charlist x) x)))
Theorem:
(defthm string-downcase1-redef (implies (standard-char-listp x) (equal (acl2::string-downcase1 x) (downcase-charlist (double-rewrite x)))))