Oset of the keys of an omap.
Function:
(defun keys (map) (declare (xargs :guard (mapp map))) (let ((__function__ 'keys)) (declare (ignorable __function__)) (cond ((emptyp map) nil) (t (mv-let (key val) (head map) (declare (ignore val)) (insert key (keys (tail map))))))))
Theorem:
(defthm setp-of-keys (b* ((keys (keys map))) (setp keys)) :rule-classes :rewrite)
Theorem:
(defthm keys-of-mfix (equal (keys (mfix map)) (keys map)))
Theorem:
(defthm keys-when-emptyp (implies (emptyp map) (equal (keys map) nil)) :rule-classes (:rewrite :type-prescription))
Theorem:
(defthm keys-iff-not-emptyp (iff (keys map) (not (emptyp map))))
Theorem:
(defthm consp-of-assoc-to-in-of-keys (equal (consp (assoc key map)) (set::in key (keys map))))
Theorem:
(defthm assoc-to-in-of-keys (iff (assoc key map) (set::in key (keys map))))
Theorem:
(defthm in-of-keys-to-assoc (iff (set::in key (keys map)) (assoc key map)))
Theorem:
(defthm in-keys-when-assoc-forward (implies (assoc key map) (set::in key (keys map))) :rule-classes :forward-chaining)
Theorem:
(defthm in-keys-when-assoc-is-cons (implies (equal (assoc a m) (cons a b)) (set::in a (keys m))))
Theorem:
(defthm keys-of-update (equal (keys (update key val m)) (insert key (keys m))))
Theorem:
(defthm keys-of-update* (equal (keys (update* new old)) (union (keys new) (keys old))))
Theorem:
(defthm keys-of-restrict (equal (keys (restrict keys map)) (intersect keys (keys map))))
Theorem:
(defthm head-key-not-in-keys-of-tail (not (set::in (mv-nth 0 (head map)) (keys (tail map)))))