Semantics of characters in case-insensitive character value notations.
(nat-match-insensitive-char-p nat char) → yes/no
A natural number matches a character in a case-insensitive character value notation iff the natural number is the code of the character or of the uppercase or lowercase counterpart of the character.
Function:
(defun nat-match-insensitive-char-p (nat char) (declare (xargs :guard (and (natp nat) (characterp char)))) (b* ((nat (mbe :logic (nfix nat) :exec nat))) (or (equal nat (char-code char)) (equal nat (char-code (upcase-char char))) (equal nat (char-code (downcase-char char))))))
Theorem:
(defthm booleanp-of-nat-match-insensitive-char-p (b* ((yes/no (nat-match-insensitive-char-p nat char))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm nat-match-insensitive-char-p-of-char-fix (equal (nat-match-insensitive-char-p nat (char-fix char)) (nat-match-insensitive-char-p nat char)))
Theorem:
(defthm nat-match-insensitive-char-p-of-nfix-nat (equal (nat-match-insensitive-char-p (nfix nat) char) (nat-match-insensitive-char-p nat char)))
Theorem:
(defthm nat-match-insensitive-char-p-nat-equiv-congruence-on-nat (implies (acl2::nat-equiv nat nat-equiv) (equal (nat-match-insensitive-char-p nat char) (nat-match-insensitive-char-p nat-equiv char))) :rule-classes :congruence)
Theorem:
(defthm nat-match-insensitive-char-p-of-char-fix-char (equal (nat-match-insensitive-char-p nat (char-fix char)) (nat-match-insensitive-char-p nat char)))
Theorem:
(defthm nat-match-insensitive-char-p-chareqv-congruence-on-char (implies (acl2::chareqv char char-equiv) (equal (nat-match-insensitive-char-p nat char) (nat-match-insensitive-char-p nat char-equiv))) :rule-classes :congruence)