Semantics of repetition ranges.
(numrep-match-repeat-range-p numrep range) → yes/no
A number of repetitions (a natural number) matches a repetition range iff it is between the range's minimum and the range's maximum.
Function:
(defun numrep-match-repeat-range-p (numrep range) (declare (xargs :guard (and (natp numrep) (repeat-rangep range)))) (b* ((numrep (mbe :logic (nfix numrep) :exec numrep)) (min (repeat-range->min range)) (max (repeat-range->max range))) (and (<= min numrep) (or (nati-case max :infinity) (<= numrep (nati-finite->get max))))))
Theorem:
(defthm booleanp-of-numrep-match-repeat-range-p (b* ((yes/no (numrep-match-repeat-range-p numrep range))) (booleanp yes/no)) :rule-classes :rewrite)
Theorem:
(defthm 0-when-match-repeat-range-0 (implies (equal range (repeat-range 0 (nati-finite 0))) (equal (numrep-match-repeat-range-p n range) (equal (nfix n) 0))))
Theorem:
(defthm numrep-match-repeat-range-p-of-nfix-numrep (equal (numrep-match-repeat-range-p (nfix numrep) range) (numrep-match-repeat-range-p numrep range)))
Theorem:
(defthm numrep-match-repeat-range-p-nat-equiv-congruence-on-numrep (implies (acl2::nat-equiv numrep numrep-equiv) (equal (numrep-match-repeat-range-p numrep range) (numrep-match-repeat-range-p numrep-equiv range))) :rule-classes :congruence)
Theorem:
(defthm numrep-match-repeat-range-p-of-repeat-range-fix-range (equal (numrep-match-repeat-range-p numrep (repeat-range-fix range)) (numrep-match-repeat-range-p numrep range)))
Theorem:
(defthm numrep-match-repeat-range-p-repeat-range-equiv-congruence-on-range (implies (repeat-range-equiv range range-equiv) (equal (numrep-match-repeat-range-p numrep range) (numrep-match-repeat-range-p numrep range-equiv))) :rule-classes :congruence)