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