Identify one strictly increasing segment of a vl-maybe-integer-listp.
(vl-match-contiguous-indices n x) → (mv range-end rest)
We try to consume the leading portion of
(vl-match-contiguous-indices 1 '(2 3 4 5 10 11 12)) --> (mv 5 (10 11 12))
Function:
(defun vl-match-contiguous-indices (n x) (declare (xargs :guard (and (maybe-integerp n) (vl-maybe-integer-listp x)))) (let ((__function__ 'vl-match-contiguous-indices)) (declare (ignorable __function__)) (if (or (not (integerp n)) (atom x) (not (equal (car x) (+ n 1)))) (mv n x) (vl-match-contiguous-indices (+ n 1) (cdr x)))))
Theorem:
(defthm maybe-integerp-of-vl-match-contiguous-indices.range-end (implies (and (force (acl2::maybe-integerp$inline n)) (force (vl-maybe-integer-listp x))) (b* (((mv ?range-end common-lisp::?rest) (vl-match-contiguous-indices n x))) (maybe-integerp range-end))) :rule-classes :rewrite)
Theorem:
(defthm vl-maybe-integer-listp-of-vl-match-contiguous-indices.rest (implies (and (force (acl2::maybe-integerp$inline n)) (force (vl-maybe-integer-listp x))) (b* (((mv ?range-end common-lisp::?rest) (vl-match-contiguous-indices n x))) (vl-maybe-integer-listp rest))) :rule-classes :rewrite)
Theorem:
(defthm len-of-vl-match-contiguous-indices (implies (not (equal n (mv-nth 0 (vl-match-contiguous-indices n x)))) (< (len (mv-nth 1 (vl-match-contiguous-indices n x))) (len x))) :rule-classes ((:rewrite) (:linear)))
Theorem:
(defthm vl-match-contiguous-indices-fails-on-nil (equal (mv-nth 0 (vl-match-contiguous-indices nil x)) nil))
Theorem:
(defthm vl-match-contiguous-indices-monotonic-on-success (implies (and (not (equal n (mv-nth 0 (vl-match-contiguous-indices n x)))) (force (maybe-integerp n)) (force (vl-maybe-integer-listp x))) (< n (mv-nth 0 (vl-match-contiguous-indices n x)))) :rule-classes ((:rewrite) (:linear)))
Theorem:
(defthm vl-match-contiguous-indices-exists-on-success (implies (and (not (equal n (mv-nth 0 (vl-match-contiguous-indices n x)))) (force (maybe-integerp n)) (force (vl-maybe-integer-listp x))) (integerp (mv-nth 0 (vl-match-contiguous-indices n x)))))