Recognizer for oct-escape structures.
(oct-escapep x) → *
Function:
(defun oct-escapep (x) (declare (xargs :guard t)) (let ((__function__ 'oct-escapep)) (declare (ignorable __function__)) (and (consp x) (cond ((or (atom x) (eq (car x) :one)) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((digit (std::da-nth 0 (cdr x)))) (oct-digit-char-p digit)))) ((eq (car x) :two) (and (true-listp (cdr x)) (eql (len (cdr x)) 2) (b* ((digit1 (std::da-nth 0 (cdr x))) (digit2 (std::da-nth 1 (cdr x)))) (and (oct-digit-char-p digit1) (oct-digit-char-p digit2))))) (t (and (eq (car x) :three) (and (true-listp (cdr x)) (eql (len (cdr x)) 3)) (b* ((digit1 (std::da-nth 0 (cdr x))) (digit2 (std::da-nth 1 (cdr x))) (digit3 (std::da-nth 2 (cdr x)))) (and (oct-digit-char-p digit1) (oct-digit-char-p digit2) (oct-digit-char-p digit3)))))))))
Theorem:
(defthm consp-when-oct-escapep (implies (oct-escapep x) (consp x)) :rule-classes :compound-recognizer)