Recognizer for rlp-error structures.
(rlp-error-p x) → *
Function:
(defun rlp-error-p (x) (declare (xargs :guard t)) (let ((__function__ 'rlp-error-p)) (declare (ignorable __function__)) (and (consp x) (cond ((or (atom x) (eq (car x) :no-bytes)) (and (true-listp (cdr x)) (eql (len (cdr x)) 0) (b* nil t))) ((eq (car x) :fewer-bytes-than-short-length) (and (true-listp (cdr x)) (eql (len (cdr x)) 3) (b* ((fragment (std::da-nth 0 (cdr x))) (required (std::da-nth 1 (cdr x))) (available (std::da-nth 2 (cdr x)))) (and (byte-listp fragment) (natp required) (natp available))))) ((eq (car x) :fewer-bytes-than-length-of-length) (and (true-listp (cdr x)) (eql (len (cdr x)) 3) (b* ((fragment (std::da-nth 0 (cdr x))) (required (std::da-nth 1 (cdr x))) (available (std::da-nth 2 (cdr x)))) (and (byte-listp fragment) (natp required) (natp available))))) ((eq (car x) :fewer-bytes-than-long-length) (and (true-listp (cdr x)) (eql (len (cdr x)) 3) (b* ((fragment (std::da-nth 0 (cdr x))) (required (std::da-nth 1 (cdr x))) (available (std::da-nth 2 (cdr x)))) (and (byte-listp fragment) (natp required) (natp available))))) ((eq (car x) :leading-zeros-in-long-length) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((fragment (std::da-nth 0 (cdr x)))) (byte-listp fragment)))) ((eq (car x) :non-optimal-short-length) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((fragment (std::da-nth 0 (cdr x)))) (byte-listp fragment)))) ((eq (car x) :non-optimal-long-length) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((fragment (std::da-nth 0 (cdr x)))) (byte-listp fragment)))) ((eq (car x) :subtree) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((error (std::da-nth 0 (cdr x)))) (rlp-error-p error)))) ((eq (car x) :extra-bytes) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((bytes (std::da-nth 0 (cdr x)))) (byte-listp bytes)))) ((eq (car x) :branch-tree) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((fragment (std::da-nth 0 (cdr x)))) (byte-listp fragment)))) (t (and (eq (car x) :leading-zeros-in-scalar) (and (true-listp (cdr x)) (eql (len (cdr x)) 1)) (b* ((bytes (std::da-nth 0 (cdr x)))) (byte-listp bytes))))))))
Theorem:
(defthm consp-when-rlp-error-p (implies (rlp-error-p x) (consp x)) :rule-classes :compound-recognizer)