Coerce to a character.
(char-fix x) is the identity on characters, and returns the NUL character (i.e., the character whose code is 0) for any non-character.
This is similar to other fixing functions like fix and nfix. See also chareqv.
Function:
(defun char-fix$inline (x) (declare (xargs :guard t)) (if (characterp x) x (code-char 0)))
Theorem:
(defthm characterp-of-char-fix (characterp (char-fix x)) :rule-classes :type-prescription)
Theorem:
(defthm char-fix-default (implies (not (characterp x)) (equal (char-fix x) (code-char 0))))
Theorem:
(defthm char-fix-when-characterp (implies (characterp x) (equal (char-fix x) x)))