Generic typed list recognizer function.
Function:
(defun element-list-p (x) (if (atom x) (element-list-final-cdr-p x) (and (element-p (car x)) (element-list-p (cdr x)))))
Theorem:
(defthm element-list-p-of-cons (equal (element-list-p (cons a x)) (and (element-p a) (element-list-p x))) :rule-classes :rewrite)
Theorem:
(defthm element-list-p-of-cdr-when-element-list-p (implies (element-list-p (double-rewrite x)) (element-list-p (cdr x))) :rule-classes :rewrite)
Theorem:
(defthm element-list-p-when-not-consp-non-true-list (implies (and (element-list-final-cdr-p t) (not (consp x))) (element-list-p x)) :rule-classes :rewrite)
Theorem:
(defthm element-list-p-when-not-consp-true-list (implies (and (not (element-list-final-cdr-p t)) (not (consp x))) (equal (element-list-p x) (not x))) :rule-classes :rewrite)
Theorem:
(defthm element-p-of-car-when-element-list-p-when-element-p-nil (implies (and (element-p nil) (element-list-p x)) (element-p (car x))) :rule-classes :rewrite)
Theorem:
(defthm element-p-of-car-when-element-list-p-when-not-element-p-nil-and-not-negated (implies (and (not (element-p nil)) (element-list-p x)) (iff (element-p (car x)) (consp x))) :rule-classes :rewrite)
Theorem:
(defthm element-p-of-car-when-element-list-p-when-not-element-p-nil-and-negated (implies (and (not (element-p nil)) (element-list-p x)) (iff (non-element-p (car x)) (not (consp x)))) :rule-classes :rewrite)
Theorem:
(defthm element-p-of-car-when-element-list-p-when-unknown-nil (implies (element-list-p x) (iff (element-p (car x)) (or (consp x) (element-p nil)))) :rule-classes :rewrite)
Theorem:
(defthm element-p-of-car-when-element-list-p-when-unknown-nil-negated (implies (element-list-p x) (iff (non-element-p (car x)) (and (not (consp x)) (non-element-p nil)))) :rule-classes :rewrite)
Theorem:
(defthm true-listp-when-element-list-p-rewrite (implies (and (element-list-p x) (not (element-list-final-cdr-p t))) (true-listp x)) :rule-classes :rewrite)
Theorem:
(defthm true-listp-when-element-list-p-compound-recognizer (implies (and (element-list-p x) (not (element-list-final-cdr-p t))) (true-listp x)) :rule-classes nil)
Theorem:
(defthm element-list-p-of-append-non-true-list (implies (element-list-final-cdr-p t) (equal (element-list-p (append a b)) (and (element-list-p a) (element-list-p b)))) :rule-classes :rewrite)