Print a character usable in header names in double quotes.
The abstract syntax puts no limitation on the character (code), but here we check that it satisfies the requirements in the concrete syntax. It must be a character in the grammar, and in addition it must not be a double quote or a new-line character. The latter check encompasses not only line feed, but also carriage return: recall that both are allowed in our grammar, and that we allow three kinds of new-line characters (line feed alone, carriage return alone, or line feed followed by carriage return).
Function:
(defun print-q-char (qchar pstate) (declare (xargs :guard (and (q-char-p qchar) (pristatep pstate)))) (let ((__function__ 'print-q-char)) (declare (ignorable __function__)) (b* ((code (q-char->char qchar)) ((unless (and (grammar-character-p code) (not (= code (char-code #\"))) (not (= code 10)) (not (= code 13)))) (raise "Misusage error: ~ the character code ~x0 is disallowed ~ in a header in between double quotes." code) (pristate-fix pstate))) (print-char code pstate))))
Theorem:
(defthm pristatep-of-print-q-char (b* ((new-pstate (print-q-char qchar pstate))) (pristatep new-pstate)) :rule-classes :rewrite)
Theorem:
(defthm pristate->gcc-of-print-q-char (b* ((?new-pstate (print-q-char qchar pstate))) (equal (pristate->gcc new-pstate) (pristate->gcc pstate))))
Theorem:
(defthm print-q-char-of-q-char-fix-qchar (equal (print-q-char (q-char-fix qchar) pstate) (print-q-char qchar pstate)))
Theorem:
(defthm print-q-char-q-char-equiv-congruence-on-qchar (implies (q-char-equiv qchar qchar-equiv) (equal (print-q-char qchar pstate) (print-q-char qchar-equiv pstate))) :rule-classes :congruence)
Theorem:
(defthm print-q-char-of-pristate-fix-pstate (equal (print-q-char qchar (pristate-fix pstate)) (print-q-char qchar pstate)))
Theorem:
(defthm print-q-char-pristate-equiv-congruence-on-pstate (implies (pristate-equiv pstate pstate-equiv) (equal (print-q-char qchar pstate) (print-q-char qchar pstate-equiv))) :rule-classes :congruence)