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