Print an escape sequence.
We ensure that there is at least one digit in a hexadecimal escape sequence.
Function:
(defun print-escape (esc pstate) (declare (xargs :guard (and (escapep esc) (pristatep pstate)))) (let ((__function__ 'print-escape)) (declare (ignorable __function__)) (escape-case esc :simple (print-simple-escape esc.unwrap pstate) :oct (print-oct-escape esc.unwrap pstate) :hex (b* ((pstate (print-astring "\\x" pstate)) ((unless esc.unwrap) (raise "Misusage error: ~ hexadecimal escape sequence has no digits.") pstate) (pstate (print-hex-digit-achars esc.unwrap pstate))) pstate) :univ (print-univ-char-name esc.unwrap pstate))))
Theorem:
(defthm pristatep-of-print-escape (b* ((new-pstate (print-escape esc pstate))) (pristatep new-pstate)) :rule-classes :rewrite)
Theorem:
(defthm print-escape-of-escape-fix-esc (equal (print-escape (escape-fix esc) pstate) (print-escape esc pstate)))
Theorem:
(defthm print-escape-escape-equiv-congruence-on-esc (implies (escape-equiv esc esc-equiv) (equal (print-escape esc pstate) (print-escape esc-equiv pstate))) :rule-classes :congruence)
Theorem:
(defthm print-escape-of-pristate-fix-pstate (equal (print-escape esc (pristate-fix pstate)) (print-escape esc pstate)))
Theorem:
(defthm print-escape-pristate-equiv-congruence-on-pstate (implies (pristate-equiv pstate pstate-equiv) (equal (print-escape esc pstate) (print-escape esc pstate-equiv))) :rule-classes :congruence)