Generic typed list recognizer function.
Function:
(defun keyval-alist-p (x) (if (atom x) (keyval-alist-final-cdr-p x) (and (consp (car x)) (keytype-p (caar x)) (valtype-p (cdar x)) (keyval-alist-p (cdr x)))))
Theorem:
(defthm keytype-p-of-caar-when-keyval-alist-p-when-keytype-p-nil (implies (and (keytype-p nil) (keyval-alist-p x)) (keytype-p (caar x))) :rule-classes :rewrite)
Theorem:
(defthm valtype-p-of-cdar-when-keyval-alist-p-when-valtype-p-nil (implies (and (valtype-p nil) (keyval-alist-p x)) (valtype-p (cdar x))) :rule-classes :rewrite)
Theorem:
(defthm keytype-p-of-caar-when-keyval-alist-p-when-not-keytype-p-nil-and-not-negated (implies (and (not (keytype-p nil)) (keyval-alist-p x)) (iff (keytype-p (caar x)) (consp x))) :rule-classes :rewrite)
Theorem:
(defthm keytype-p-of-caar-when-keyval-alist-p-when-not-keytype-p-nil-and-negated (implies (and (not (keytype-p nil)) (keyval-alist-p x)) (iff (non-keytype-p (caar x)) (not (consp x)))) :rule-classes :rewrite)
Theorem:
(defthm valtype-p-of-cdar-when-keyval-alist-p-when-not-valtype-p-nil-and-not-negated (implies (and (not (valtype-p nil)) (keyval-alist-p x)) (iff (valtype-p (cdar x)) (consp x))) :rule-classes :rewrite)
Theorem:
(defthm valtype-p-of-cdar-when-keyval-alist-p-when-not-valtype-p-nil-and-negated (implies (and (not (valtype-p nil)) (keyval-alist-p x)) (iff (non-valtype-p (cdar x)) (not (consp x)))) :rule-classes :rewrite)
Theorem:
(defthm keytype-p-of-caar-when-keyval-alist-p-when-unknown-nil (implies (keyval-alist-p x) (iff (keytype-p (caar x)) (or (consp x) (keytype-p nil)))) :rule-classes :rewrite)
Theorem:
(defthm keytype-p-of-caar-when-keyval-alist-p-when-unknown-nil-negated (implies (keyval-alist-p x) (iff (non-keytype-p (caar x)) (and (not (consp x)) (non-keytype-p nil)))) :rule-classes :rewrite)
Theorem:
(defthm valtype-p-of-cdar-when-keyval-alist-p-when-unknown-nil (implies (keyval-alist-p x) (iff (valtype-p (cdar x)) (or (consp x) (valtype-p nil)))) :rule-classes :rewrite)
Theorem:
(defthm valtype-p-of-cdar-when-keyval-alist-p-when-unknown-nil-negated (implies (keyval-alist-p x) (iff (non-valtype-p (cdar x)) (and (not (consp x)) (non-valtype-p nil)))) :rule-classes :rewrite)
Theorem:
(defthm alistp-when-keyval-alist-p-tau (implies (and (keyval-alist-p x) (not (keyval-alist-final-cdr-p t))) (alistp x)) :rule-classes nil)
Theorem:
(defthm alistp-when-keyval-alist-p-rewrite (implies (and (keyval-alist-p x) (not (keyval-alist-final-cdr-p t))) (alistp x)) :rule-classes :rewrite)
Theorem:
(defthm valtype-p-of-cdr-of-hons-assoc-equal-when-keyval-alist-p-unknown-valtype-p-nil (implies (keyval-alist-p x) (iff (valtype-p (cdr (hons-assoc-equal k x))) (or (hons-assoc-equal k x) (valtype-p nil)))) :rule-classes :rewrite)
Theorem:
(defthm valtype-p-of-cdr-of-hons-assoc-equal-when-keyval-alist-p-valtype-p-nil (implies (and (keyval-alist-p x) (valtype-p nil)) (valtype-p (cdr (hons-assoc-equal k x)))) :rule-classes :rewrite)
Theorem:
(defthm valtype-p-of-cdr-of-hons-assoc-equal-when-keyval-alist-p-not-valtype-p-nil (implies (and (keyval-alist-p x) (not (valtype-p nil))) (iff (valtype-p (cdr (hons-assoc-equal k x))) (hons-assoc-equal k x))) :rule-classes :rewrite)
Theorem:
(defthm valtype-p-of-cdr-of-hons-assoc-equal-when-keyval-alist-p-unknown-valtype-p-nil-negated (implies (keyval-alist-p x) (iff (non-valtype-p (cdr (hons-assoc-equal k x))) (not (or (hons-assoc-equal k x) (valtype-p nil))))) :rule-classes :rewrite)
Theorem:
(defthm valtype-p-of-cdr-of-hons-assoc-equal-when-keyval-alist-p-not-valtype-p-nil-negated (implies (and (keyval-alist-p x) (not (valtype-p nil))) (iff (non-valtype-p (cdr (hons-assoc-equal k x))) (not (hons-assoc-equal k x)))) :rule-classes :rewrite)
Theorem:
(defthm keyval-alist-p-of-hons-acons (equal (keyval-alist-p (hons-acons a n x)) (and (keytype-p a) (valtype-p n) (keyval-alist-p x))) :rule-classes :rewrite)
Theorem:
(defthm keyval-alist-p-of-hons-shrink-alist (implies (and (keyval-alist-p x) (keyval-alist-p y)) (keyval-alist-p (hons-shrink-alist x y))) :rule-classes :rewrite)
Theorem:
(defthm keyval-alist-p-of-fast-alist-clean (implies (keyval-alist-p x) (keyval-alist-p (fast-alist-clean x))) :rule-classes :rewrite)
Theorem:
(defthm alistp-of-put-assoc (implies (and (keyval-alist-p x) (not (keyval-alist-final-cdr-p t))) (iff (keyval-alist-p (put-assoc-equal name val x)) (and (keytype-p name) (valtype-p val)))) :rule-classes :rewrite)
Theorem:
(defthm valtype-p-of-cdr-of-assoc-when-keyval-alist-p-valtype-p-nil (implies (and (keyval-alist-p x) (valtype-p nil)) (valtype-p (cdr (assoc-equal k x)))) :rule-classes :rewrite)
Theorem:
(defthm alistp-of-remove-assoc (implies (keyval-alist-p x) (keyval-alist-p (remove-assoc-equal name x))) :rule-classes :rewrite)