Print a character usable in header names in angle brackets.
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 greater-than 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-h-char (hchar pstate) (declare (xargs :guard (and (h-char-p hchar) (pristatep pstate)))) (let ((__function__ 'print-h-char)) (declare (ignorable __function__)) (b* ((code (h-char->char hchar)) ((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 angle brackets." code) (pristate-fix pstate))) (print-char code pstate))))
Theorem:
(defthm pristatep-of-print-h-char (b* ((new-pstate (print-h-char hchar pstate))) (pristatep new-pstate)) :rule-classes :rewrite)
Theorem:
(defthm pristate->gcc-of-print-h-char (b* ((?new-pstate (print-h-char hchar pstate))) (equal (pristate->gcc new-pstate) (pristate->gcc pstate))))
Theorem:
(defthm print-h-char-of-h-char-fix-hchar (equal (print-h-char (h-char-fix hchar) pstate) (print-h-char hchar pstate)))
Theorem:
(defthm print-h-char-h-char-equiv-congruence-on-hchar (implies (h-char-equiv hchar hchar-equiv) (equal (print-h-char hchar pstate) (print-h-char hchar-equiv pstate))) :rule-classes :congruence)
Theorem:
(defthm print-h-char-of-pristate-fix-pstate (equal (print-h-char hchar (pristate-fix pstate)) (print-h-char hchar pstate)))
Theorem:
(defthm print-h-char-pristate-equiv-congruence-on-pstate (implies (pristate-equiv pstate pstate-equiv) (equal (print-h-char hchar pstate) (print-h-char hchar pstate-equiv))) :rule-classes :congruence)