(alists-agree keys al1 al2) determines if the alists
Function:
(defun alists-agree (keys al1 al2) "Do AL1 and AL2 agree on the value of every KEY in KEYS?" (declare (xargs :guard t)) (or (atom keys) (and (equal (hons-get (car keys) al1) (hons-get (car keys) al2)) (alists-agree (cdr keys) al1 al2))))
Theorem:
(defthm list-equiv-implies-equal-alists-agree-1 (implies (list-equiv keys keys-equiv) (equal (alists-agree keys al1 al2) (alists-agree keys-equiv al1 al2))) :rule-classes (:congruence))
Theorem:
(defthm alists-agree-hons-assoc-equal (implies (and (alists-agree keys a b) (member-equal x keys)) (equal (hons-assoc-equal x b) (hons-assoc-equal x a))))
Theorem:
(defthm alists-agree-self (alists-agree keys a a))
Theorem:
(defthm alists-agree-sym (implies (alists-agree keys a b) (alists-agree keys b a)))
Function:
(defun alists-disagree-witness (keys al1 al2) (and (consp keys) (if (not (equal (hons-get (car keys) al1) (hons-get (car keys) al2))) (car keys) (alists-disagree-witness (cdr keys) al1 al2))))
Theorem:
(defthm alists-agree-iff-witness (iff (alists-agree keys al1 al2) (let ((x (alists-disagree-witness keys al1 al2))) (implies (member-equal x keys) (equal (hons-assoc-equal x al1) (hons-assoc-equal x al2))))))
Theorem:
(defthm alists-agree-trans (implies (and (alists-agree keys x y) (alists-agree keys y z)) (alists-agree keys x z)))