\begin{lemma}[Exact bounded digit scan]
Let a byte slice decompose as $s=DT$, where every byte of $D$ is an ASCII
decimal digit and the first byte of $T$, if present, is not a decimal digit.
Assume $|s|\le 2^{63}-1$.  For an initial unsigned word $a$, define
\[
 F(D,a)=\operatorname{foldl}(v,b\mapsto 10v+(b-48),a,D).
\]
If $F(D,a)\le 2^{64}-1$, then the extracted
\texttt{try\_parse\_digits} returns the suffix $T$ and an unsigned word whose
natural value is exactly $F(D,a)$.
\end{lemma}
\begin{proof}
Unfold \noderef{num_imp_dec2flt_parse_try_parse_digits}.  For its eight-byte
loop, maintain a partition $D=PR$, the live slice equation $u=RT$, and the
accumulator equation $x=F(P,a)$.  The slice length remains at most
$2^{63}-1$.  When at least eight bytes are available, the extracted read is
described by \noderef{NumberHelperReadEightBytes}.  If the eight-digit test
succeeds, \noderef{NumberHelperEightDigitWord} shows that all eight bytes are
digits.  If fewer than eight bytes remain in $R$, one of those tested bytes
would instead be the first byte of $T$, contradicting its nondigit
hypothesis.  Hence eight bytes of $R$ may be consumed.  By
\noderef{NumberHelperParseEightDigitsExact}, the parsed block is its exact
eight-digit decimal value, so the accumulator update is
$10^8F(P,a)+F(R.take(8),0)=F(P(R.take(8)),a)$.

Every decimal-fold prefix is at most the complete fold: each step maps $v$
to $10v+d\ge v$.  Thus the hypothesis $F(D,a)\le2^{64}-1$ bounds both the
intermediate multiplication and its following addition, and the extracted
wrapping operations agree with ordinary natural arithmetic.  Dropping eight
bytes strictly decreases the loop measure.  If the test fails or fewer than
eight bytes are available, the same partition and accumulator invariant are
returned unchanged.

For the scalar loop, maintain that its count $j$ is at most $|R|$ and that
the accumulator is $F(R.take(j),F(P,a))$.  At $j<|R|$, the indexed byte is a
digit in $[48,57]$; wrapping subtraction by 48 is therefore ordinary
subtraction and yields a value below 10.  The cast to 64 bits is exact.  The
same prefix bound shows that multiplication by 10 and addition of the digit
do not wrap, while the checked count increment succeeds because
$j+1\le |R|\le |s|\le2^{63}-1$.  The invariant advances to $j+1$ and the
measure $|R|-j$ strictly decreases.  At $j=|R|$, either the slice ends or the
next indexed byte is the first byte of $T$; in the latter case wrapping
subtraction is below 10 exactly for ASCII bytes 48 through 57, so the
nondigit hypothesis forces the loop to stop without consuming it.

Consequently the scalar loop finishes at count $|R|$ with accumulator
$F(R,F(P,a))=F(D,a)$.  The final guarded slice drop removes exactly $R$ and
leaves $T$.  All reads and drops are in bounds by the maintained partition
and source-length bound, proving the stated returned pair.
\end{proof}
