Size of an omap.
This is the number of keys in the omap.
The
Function:
(defun size (map) (declare (xargs :guard (mapp map))) (let ((__function__ 'size)) (declare (ignorable __function__)) (cond ((emptyp map) 0) (t (1+ (size (tail map)))))))
Theorem:
(defthm natp-of-size (b* ((size (size map))) (natp size)) :rule-classes :rewrite)
Theorem:
(defthm unfold-equal-size-const (implies (syntaxp (quotep c)) (equal (equal (size map) c) (if (natp c) (if (equal c 0) (emptyp map) (and (not (emptyp map)) (equal (size (tail map)) (1- c)))) nil))))
Theorem:
(defthm unfold-gteq-size-const (implies (syntaxp (quotep c)) (equal (>= (size map) c) (or (<= (fix c) 0) (and (not (emptyp map)) (>= (size (tail map)) (1- c)))))))
Theorem:
(defthm unfold-gt-size-const (implies (syntaxp (quotep c)) (equal (> (size map) c) (or (< (fix c) 0) (and (not (emptyp map)) (> (size (tail map)) (1- c)))))))
Theorem:
(defthm size-to-cardinality-of-keys (equal (size map) (cardinality (keys map))))
Theorem:
(defthm cardinality-of-keys-to-size (equal (cardinality (keys map)) (size map)))