Validate a character constant.
We check the characters that form the constant,
with respect to the prefix (if any).
If validation is successful, we return the type of the constant.
According to [C:6.4.4.4/10],
a character constant without prefix has type
The types
Function:
(defun valid-cconst (cconst) (declare (xargs :guard (cconstp cconst))) (let ((__function__ 'valid-cconst)) (declare (ignorable __function__)) (b* (((reterr) (irr-type)) ((cconst cconst) cconst) ((erp &) (valid-c-char-list cconst.cchars cconst.prefix?))) (if cconst.prefix? (retok (type-unknown)) (retok (type-sint))))))
Theorem:
(defthm typep-of-valid-cconst.type (b* (((mv acl2::?erp ?type) (valid-cconst cconst))) (typep type)) :rule-classes :rewrite)
Theorem:
(defthm valid-cconst-of-cconst-fix-cconst (equal (valid-cconst (cconst-fix cconst)) (valid-cconst cconst)))
Theorem:
(defthm valid-cconst-cconst-equiv-congruence-on-cconst (implies (cconst-equiv cconst cconst-equiv) (equal (valid-cconst cconst) (valid-cconst cconst-equiv))) :rule-classes :congruence)