Determine if a character is a lower-case letter (a-z).
(down-alpha-p x) → bool
ACL2 has a built-in alternative to this function, common-lisp::lower-case-p, which however can also recognize characters that are not standard characters. (Historical note: Before May 2024, the guard for acl2::lower-case-p required standard-char-p yet also converted only standard characters; this provided motivation for the development of down-alpha-p.)
Function:
(defun down-alpha-p$inline (x) (declare (type character x)) (let ((acl2::__function__ 'down-alpha-p)) (declare (ignorable acl2::__function__)) (b* (((the (unsigned-byte 8) code) (char-code x))) (and (<= (little-a) code) (<= code (little-z))))))
Theorem:
(defthm chareqv-implies-equal-down-alpha-p-1 (implies (chareqv x x-equiv) (equal (down-alpha-p x) (down-alpha-p x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm lower-case-p-is-down-alpha-p (implies (standard-char-p x) (equal (common-lisp::lower-case-p x) (down-alpha-p (double-rewrite x)))))
Theorem:
(defthm down-alpha-p-when-up-alpha-p (implies (up-alpha-p x) (not (down-alpha-p x))))