(vl-string-findloc-aux x n xl cline ccol tline tcol) → offset
Function:
(defun vl-string-findloc-aux (x n xl cline ccol tline tcol) (declare (xargs :guard (and (stringp x) (natp n) (posp cline) (natp ccol) (posp tline) (natp tcol) (eql xl (length x))))) (declare (xargs :guard (<= n xl))) (let ((__function__ 'vl-string-findloc-aux)) (declare (ignorable __function__)) (b* (((when (and (eql cline tline) (eql ccol tcol))) (lnfix n)) ((when (mbe :logic (zp (- (nfix xl) (nfix n))) :exec (eql n xl))) nil) (curr (char x n))) (cond ((< cline tline) (let ((new-n (+ 1 (lnfix n))) (new-cline (if (eql curr #\Newline) (+ 1 cline) cline))) (vl-string-findloc-aux x new-n xl new-cline 0 tline tcol))) ((> cline tline) nil) ((< ccol tcol) (let ((new-n (+ 1 (lnfix n))) (new-cline (if (eql curr #\Newline) (+ 1 cline) cline)) (new-ccol (if (eql curr #\Newline) 0 (+ 1 ccol)))) (vl-string-findloc-aux x new-n xl new-cline new-ccol tline tcol))) (t nil)))))
Theorem:
(defthm maybe-natp-of-vl-string-findloc-aux (b* ((offset (vl-string-findloc-aux x n xl cline ccol tline tcol))) (maybe-natp offset)) :rule-classes :type-prescription)
Theorem:
(defthm type-of-vl-string-findloc-aux (or (natp (vl-string-findloc-aux x n xl cline ccol tline tcol)) (not (vl-string-findloc-aux x n xl cline ccol tline tcol))) :rule-classes :type-prescription)
Theorem:
(defthm bounds-of-vl-string-findloc-aux-1 (implies (and (natp n) (natp xl) (<= n xl)) (and (<= 0 (vl-string-findloc-aux x n xl cline ccol tline tcol)) (<= (vl-string-findloc-aux x n xl cline ccol tline tcol) xl))) :rule-classes :linear)
Theorem:
(defthm bounds-of-vl-string-findloc-aux-2 (implies (and (vl-string-findloc-aux x n xl cline ccol tline tcol) (natp n) (natp xl) (<= n xl)) (<= n (vl-string-findloc-aux x n xl cline ccol tline tcol))) :rule-classes :linear)