• Top
  • Char

Charp

Recognizer for char structures.

Signature
(charp x) → *

Definitions and Theorems

Function: charp

(defun charp (x)
  (declare (xargs :guard t))
  (let ((__function__ 'charp))
    (declare (ignorable __function__))
    (and (consp x)
         (eq (car x) :char)
         (mbe :logic (and (alistp (cdr x))
                          (equal (strip-cars (cdr x))
                                 '(codepoint)))
              :exec (fty::alist-with-carsp (cdr x)
                                           '(codepoint)))
         (b* ((codepoint (cdr (std::da-nth 0 (cdr x)))))
           (and (natp codepoint)
                (<= codepoint 1114111))))))

Theorem: consp-when-charp

(defthm consp-when-charp
  (implies (charp x) (consp x))
  :rule-classes :compound-recognizer)