Function:
(defun bitarr-range-set (start count bitarr) (declare (xargs :stobjs (bitarr))) (declare (xargs :guard (and (natp start) (natp count)))) (declare (xargs :guard (<= (+ start count) (bits-length bitarr)))) (let ((__function__ 'bitarr-range-set)) (declare (ignorable __function__)) (if (zp count) t (and (eql 1 (get-bit start bitarr)) (bitarr-range-set (1+ (lnfix start)) (1- count) bitarr)))))
Theorem:
(defthm bitarr-range-set-implies-nth (implies (and (bitarr-range-set start count bitarr) (<= (nfix start) (nfix n)) (< (nfix n) (+ (nfix start) (nfix count)))) (equal (nth n bitarr) 1)))
Theorem:
(defthm bitarr-range-set-of-update (implies (and (equal idx (+ -1 (nfix start) count)) (bitarr-range-set start (1- count) bitarr) (posp count)) (bitarr-range-set start count (update-nth idx 1 bitarr))))
Theorem:
(defthm bitarr-range-count-when-bitarr-range-set (implies (bitarr-range-set start count bitarr) (equal (bitarr-range-count start count bitarr) (nfix count))))
Theorem:
(defthm bitarr-range-set-of-nfix-start (equal (bitarr-range-set (nfix start) count bitarr) (bitarr-range-set start count bitarr)))
Theorem:
(defthm bitarr-range-set-nat-equiv-congruence-on-start (implies (nat-equiv start start-equiv) (equal (bitarr-range-set start count bitarr) (bitarr-range-set start-equiv count bitarr))) :rule-classes :congruence)
Theorem:
(defthm bitarr-range-set-of-nfix-count (equal (bitarr-range-set start (nfix count) bitarr) (bitarr-range-set start count bitarr)))
Theorem:
(defthm bitarr-range-set-nat-equiv-congruence-on-count (implies (nat-equiv count count-equiv) (equal (bitarr-range-set start count bitarr) (bitarr-range-set start count-equiv bitarr))) :rule-classes :congruence)