Concrete implementation of strin-firstn.
Function:
(defun sin$c-firstn (n sin$c) (declare (xargs :stobjs (sin$c))) (declare (xargs :guard (and (natp n) (sin$c-okp sin$c)))) (declare (xargs :guard (<= n (sin$c-len sin$c)))) (let ((__function__ 'sin$c-firstn)) (declare (ignorable __function__)) (b* (((the string str) (sin$c-str sin$c)) ((the (unsigned-byte 60) pos) (sin$c-pos sin$c)) ((the (unsigned-byte 60) len) (length str)) ((the (unsigned-byte 60) stop) (+ pos (the (unsigned-byte 60) n)))) (the string (subseq (the string str) pos stop)))))
Theorem:
(defthm sin-firstn{correspondence} (implies (and (sin$corr sin$c sin) (natp n) (strin-p sin) (<= n (strin-len sin))) (equal (sin$c-firstn n sin$c) (strin-firstn n sin))))