Recognize an ACL2 string that is a C ASCII identifier.
The
For standard C (i.e. no GCC extensions), this notion is the same as the one of portable ASCII identifiers defined in the language formalization; in fact, we use a function defined here as part of the definition here. The notion is that the string must start with a letter or underscore, consists of only letters, digits, and underscores, and be distinct from the standard C keywords.
With GCC extensions, the notion is strenghtened to also exclude the GCC keywords.
Function:
(defun ascii-ident-stringp (x gcc) (declare (xargs :guard (booleanp gcc))) (let ((__function__ 'ascii-ident-stringp)) (declare (ignorable __function__)) (and (stringp x) (c::paident-char-listp (acl2::explode x)) (not (member-equal x *keywords*)) (or (not gcc) (not (member-equal x *gcc-keywords*))))))
Theorem:
(defthm booleanp-of-ascii-ident-stringp (b* ((yes/no (ascii-ident-stringp x gcc))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm ascii-ident-stringp-of-bool-fix-gcc (equal (ascii-ident-stringp x (bool-fix gcc)) (ascii-ident-stringp x gcc)))
Theorem:
(defthm ascii-ident-stringp-iff-congruence-on-gcc (implies (iff gcc gcc-equiv) (equal (ascii-ident-stringp x gcc) (ascii-ident-stringp x gcc-equiv))) :rule-classes :congruence)