Recognize printable ASCII characters, i.e. spaces and visible ASCII characters.
Function:
(defun printable-char-p (x) (declare (xargs :guard t)) (and (characterp x) (b* ((code (char-code x))) (and (<= 32 code) (<= code 126)))))
Theorem:
(defthm booleanp-of-printable-char-p (booleanp (printable-char-p x)) :rule-classes :type-prescription)
Theorem:
(defthm characterp-when-printable-char-p (implies (printable-char-p x) (characterp x)) :rule-classes :compound-recognizer)