Recognizer for location structures.
(locationp x) → *
Function:
(defun locationp (x) (declare (xargs :guard t)) (let ((__function__ 'locationp)) (declare (ignorable __function__)) (and (consp x) (cond ((or (atom x) (eq (car x) :var)) (and (true-listp (cdr x)) (eql (len (cdr x)) 1) (b* ((name (std::da-nth 0 (cdr x)))) (identifierp name)))) ((eq (car x) :tuple-comp) (and (true-listp (cdr x)) (eql (len (cdr x)) 2) (b* ((tuple (std::da-nth 0 (cdr x))) (index (std::da-nth 1 (cdr x)))) (and (locationp tuple) (natp index))))) (t (and (eq (car x) :struct-comp) (and (true-listp (cdr x)) (eql (len (cdr x)) 2)) (b* ((struct (std::da-nth 0 (cdr x))) (name (std::da-nth 1 (cdr x)))) (and (locationp struct) (identifierp name)))))))))
Theorem:
(defthm consp-when-locationp (implies (locationp x) (consp x)) :rule-classes :compound-recognizer)