Equivalence of four-valued environments (alists).
Function:
(defun 4v-env-equiv (x y) (declare (xargs :non-executable t)) (declare (xargs :guard t)) (declare (xargs :non-executable t)) (prog2$ (throw-nonexec-error '4v-env-equiv (list x y)) (let ((key (4v-env-equiv-witness x y))) (and (equal (4v-lookup key x) (4v-lookup key y))))))
Theorem:
(defthm 4v-env-equiv-necc (implies (not (and (equal (4v-lookup key x) (4v-lookup key y)))) (not (4v-env-equiv x y))))
Theorem:
(defthm 4v-env-equiv-witnessing-witness-rule-correct (implies (not ((lambda (key y x) (not (equal (4v-lookup key x) (4v-lookup key y)))) (4v-env-equiv-witness x y) y x)) (4v-env-equiv x y)) :rule-classes nil)
Theorem:
(defthm 4v-env-equiv-instancing-instance-rule-correct (implies (not (equal (4v-lookup key x) (4v-lookup key y))) (not (4v-env-equiv x y))) :rule-classes nil)
Theorem:
(defthm 4v-env-equiv-is-an-equivalence (and (booleanp (4v-env-equiv x y)) (4v-env-equiv x x) (implies (4v-env-equiv x y) (4v-env-equiv y x)) (implies (and (4v-env-equiv x y) (4v-env-equiv y z)) (4v-env-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm alist-equiv-refines-4v-env-equiv (implies (alist-equiv x y) (4v-env-equiv x y)) :rule-classes (:refinement))
Theorem:
(defthm 4v-env-equiv-implies-4v-env-equiv-cons-2 (implies (4v-env-equiv b b-equiv) (4v-env-equiv (cons a b) (cons a b-equiv))) :rule-classes (:congruence))
Theorem:
(defthm 4v-env-equiv-implies-4v-env-equiv-append-2 (implies (4v-env-equiv b b-equiv) (4v-env-equiv (append a b) (append a b-equiv))) :rule-classes (:congruence))
Theorem:
(defthm 4v-env-equiv-implies-iff-4v-alist-<=-1 (implies (4v-env-equiv a a-equiv) (iff (4v-alist-<= a b) (4v-alist-<= a-equiv b))) :rule-classes (:congruence))
Theorem:
(defthm 4v-env-equiv-implies-iff-4v-alist-<=-2 (implies (4v-env-equiv b b-equiv) (iff (4v-alist-<= a b) (4v-alist-<= a b-equiv))) :rule-classes (:congruence))
Theorem:
(defthm 4v-env-equiv-implies-equal-4v-lookup-2 (implies (4v-env-equiv al al-equiv) (equal (4v-lookup k al) (4v-lookup k al-equiv))) :rule-classes (:congruence))
Theorem:
(defthm 4v-env-equiv-implies-4v-cdr-equiv-hons-assoc-equal-2 (implies (4v-env-equiv y y-equiv) (4v-cdr-equiv (hons-assoc-equal x y) (hons-assoc-equal x y-equiv))) :rule-classes (:congruence))
Theorem:
(defthm 4v-cdr-consp-equiv-implies-4v-env-equiv-cons-1 (implies (4v-cdr-consp-equiv a a-equiv) (4v-env-equiv (cons a b) (cons a-equiv b))) :rule-classes (:congruence))
Theorem:
(defthm 4v-env-equiv-implies-equal-4v-sexpr-eval-2 (implies (4v-env-equiv env1 env2) (equal (4v-sexpr-eval x env1) (4v-sexpr-eval x env2))) :rule-classes :congruence)
Theorem:
(defthm 4v-env-equiv-implies-equal-4v-sexpr-eval-list-2 (implies (4v-env-equiv env1 env2) (equal (4v-sexpr-eval-list x env1) (4v-sexpr-eval-list x env2))) :rule-classes :congruence)
Theorem:
(defthm 4v-env-equiv-implies-equal-4v-sexpr-eval-alist-2 (implies (4v-env-equiv env env-equiv) (equal (4v-sexpr-eval-alist x env) (4v-sexpr-eval-alist x env-equiv))) :rule-classes (:congruence))
Theorem:
(defthm 4v-env-equiv-append (implies (and (set-equiv (double-rewrite (alist-keys a)) (double-rewrite (alist-keys b))) (4v-env-equiv (double-rewrite a) (double-rewrite b)) (4v-env-equiv (double-rewrite c) (double-rewrite d))) (equal (4v-env-equiv (append a c) (append b d)) t)))