(constraint-db-fix x) is an ACL2::fty alist fixing function that follows the drop-keys strategy.
(constraint-db-fix x) → fty::newx
Note that in the execution this is just an inline identity function.
Function:
(defun constraint-db-fix$inline (x) (declare (xargs :guard (constraint-db-p x))) (let ((__function__ 'constraint-db-fix)) (declare (ignorable __function__)) (mbe :logic (if (atom x) nil (let ((rest (constraint-db-fix (cdr x)))) (if (and (consp (car x)) (pseudo-fnsym-p (caar x))) (let ((fty::first-key (caar x)) (fty::first-val (constraint-tuplelist-fix (cdar x)))) (cons (cons fty::first-key fty::first-val) rest)) rest))) :exec x)))
Theorem:
(defthm constraint-db-p-of-constraint-db-fix (b* ((fty::newx (constraint-db-fix$inline x))) (constraint-db-p fty::newx)) :rule-classes :rewrite)
Theorem:
(defthm constraint-db-fix-when-constraint-db-p (implies (constraint-db-p x) (equal (constraint-db-fix x) x)))
Function:
(defun constraint-db-equiv$inline (x y) (declare (xargs :guard (and (constraint-db-p x) (constraint-db-p y)))) (equal (constraint-db-fix x) (constraint-db-fix y)))
Theorem:
(defthm constraint-db-equiv-is-an-equivalence (and (booleanp (constraint-db-equiv x y)) (constraint-db-equiv x x) (implies (constraint-db-equiv x y) (constraint-db-equiv y x)) (implies (and (constraint-db-equiv x y) (constraint-db-equiv y z)) (constraint-db-equiv x z))) :rule-classes (:equivalence))
Theorem:
(defthm constraint-db-equiv-implies-equal-constraint-db-fix-1 (implies (constraint-db-equiv x x-equiv) (equal (constraint-db-fix x) (constraint-db-fix x-equiv))) :rule-classes (:congruence))
Theorem:
(defthm constraint-db-fix-under-constraint-db-equiv (constraint-db-equiv (constraint-db-fix x) x) :rule-classes (:rewrite :rewrite-quoted-constant))
Theorem:
(defthm equal-of-constraint-db-fix-1-forward-to-constraint-db-equiv (implies (equal (constraint-db-fix x) y) (constraint-db-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm equal-of-constraint-db-fix-2-forward-to-constraint-db-equiv (implies (equal x (constraint-db-fix y)) (constraint-db-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm constraint-db-equiv-of-constraint-db-fix-1-forward (implies (constraint-db-equiv (constraint-db-fix x) y) (constraint-db-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm constraint-db-equiv-of-constraint-db-fix-2-forward (implies (constraint-db-equiv x (constraint-db-fix y)) (constraint-db-equiv x y)) :rule-classes :forward-chaining)
Theorem:
(defthm cons-of-constraint-tuplelist-fix-v-under-constraint-db-equiv (constraint-db-equiv (cons (cons k (constraint-tuplelist-fix v)) x) (cons (cons k v) x)))
Theorem:
(defthm cons-constraint-tuplelist-equiv-congruence-on-v-under-constraint-db-equiv (implies (constraint-tuplelist-equiv v v-equiv) (constraint-db-equiv (cons (cons k v) x) (cons (cons k v-equiv) x))) :rule-classes :congruence)
Theorem:
(defthm cons-of-constraint-db-fix-y-under-constraint-db-equiv (constraint-db-equiv (cons x (constraint-db-fix y)) (cons x y)))
Theorem:
(defthm cons-constraint-db-equiv-congruence-on-y-under-constraint-db-equiv (implies (constraint-db-equiv y y-equiv) (constraint-db-equiv (cons x y) (cons x y-equiv))) :rule-classes :congruence)
Theorem:
(defthm constraint-db-fix-of-acons (equal (constraint-db-fix (cons (cons a b) x)) (let ((rest (constraint-db-fix x))) (if (and (pseudo-fnsym-p a)) (let ((fty::first-key a) (fty::first-val (constraint-tuplelist-fix b))) (cons (cons fty::first-key fty::first-val) rest)) rest))))
Theorem:
(defthm hons-assoc-equal-of-constraint-db-fix (equal (hons-assoc-equal k (constraint-db-fix x)) (let ((fty::pair (hons-assoc-equal k x))) (and (pseudo-fnsym-p k) fty::pair (cons k (constraint-tuplelist-fix (cdr fty::pair)))))))
Theorem:
(defthm constraint-db-fix-of-append (equal (constraint-db-fix (append std::a std::b)) (append (constraint-db-fix std::a) (constraint-db-fix std::b))))
Theorem:
(defthm consp-car-of-constraint-db-fix (equal (consp (car (constraint-db-fix x))) (consp (constraint-db-fix x))))