(bitset-members x) converts a bitset into an ordinary, ordered set.
(bitset-members x) → *
Reasoning note:
Performance note:
It is simple enough to convert a bitset into an ordered set: since the integer-length of
The definition below uses bits-between to do just this. However,
note that when the
Function:
(defun bitset-members (x) (declare (xargs :guard (natp x))) (let ((__function__ 'bitset-members)) (declare (ignorable __function__)) (mbe :logic (let ((x (nfix x))) (bits-between 0 (integer-length x) x)) :exec (bits-between 0 (integer-length x) x))))
Theorem:
(defthm bitset-members-default (implies (not (natp a)) (equal (bitset-members a) nil)))
Theorem:
(defthm bitset-members-of-nfix (equal (bitset-members (nfix b)) (bitset-members b)))
Theorem:
(defthm true-listp-of-bitset-members (true-listp (bitset-members x)) :rule-classes :type-prescription)
Theorem:
(defthm nat-listp-of-bitset-members (nat-listp (bitset-members x)))
Theorem:
(defthm no-duplicatesp-equal-of-bitset-members (no-duplicatesp-equal (bitset-members x)))
Theorem:
(defthm setp-of-bitset-members (setp (bitset-members x)))
Theorem:
(defthm in-of-bitset-members (equal (in a (bitset-members x)) (and (natp a) (logbitp a (nfix x)))))
Theorem:
(defthm bitset-members-under-iff (iff (bitset-members x) (posp x)))