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