\begin{lemma}[Rendered adjustment count and nonwrapping selection bounds]
Let $s$ be a byte slice with decomposition
$s.\mathit{val}=I++([46]++F++T)$ if a Boolean $p$ is true and
$s.\mathit{val}=I++T$ otherwise. Suppose $F=[]$ when $p$ is false,
all bytes of $I,F$ have values in $[48,57]$, and every nonempty $T$
has head different from both 48 and 46.
Put $S=(I++F).\texttt{map}(b\mapsto b.\mathit{val}-48)$,
$H=S.\texttt{dropWhile}(d=0)$, $D=|I|+|F|$, and let $z$ be the
number of 48 bytes in
$s.\mathit{val}.\texttt{takeWhile}(b=48\lor b=46)$.
Then $z=|S|-|H|$. Moreover, writing $v$ for the natural decimal
fold of the decoding of a byte list, we have
\[
(D\le19\ \lor\ D-19-z\le0)\ \Longrightarrow\ v(I++F)<10^{19},
\qquad
0<D-19-z\ \Longrightarrow\ 10^{19}\le v(I++F).
\]
Subtractions and comparisons in these two implications are in the
integers; list lengths and folds are natural numbers.
\end{lemma}
\begin{proof}
For a digit byte $b$, the range hypothesis gives
$0\le b.\mathit{val}-48<10$, and $b.\mathit{val}-48=0$ if and only
if $b=48$ (byte equality is equality of values). Digit bytes are never
46. Apply \noderef{P435_T1_DigitDecoding} to $I++F$ to obtain the
digit range and fold transport for $S$.
By \noderef{DecimalDigitTrimDecomposition}, there is a natural $z_0$
such that $S=\texttt{replicate}(z_0,0)++H$,
$z_0=|S|-|H|$, and $H$ is empty or has nonzero head.

We verify that the source byte count is precisely $z_0$.
If the first nonzero decoded digit lies in $I$, all preceding bytes
are 48 and that first nonzero digit is neither 48 nor 46. Thus the
raw take-while prefix stops there, counting exactly those initial
zeros. If $I$ is all zero and the first nonzero digit lies in $F$,
the prefix includes all of $I$, the point, and the initial zero
bytes of $F$, stopping at its first nonzero digit. The point passes
the test but is not counted as 48. This case necessarily has $p$ true,
since $F=[]$ when $p$ is false. If all digits are zero, the prefix
includes the entire significand and its optional point, and stops
at the start of $T$ or at end of input. It cannot include the first
byte of $T$, by its assumed stopping condition. Hence in every case
it counts exactly the leading zero digits of $S$, proving $z=z_0$.
These cases include empty $I$, empty $F$, and empty $S$.

Induction on $z_0$ shows that folding its replicated zeros from zero
leaves zero. The fold-over-append identity and fold transport therefore
give $v(I++F)=v(H)$. Also $|S|=D$ and $z+|H|=D$, by the decomposition.
If $H=[]$, its fold is zero and its length is zero. Otherwise write
$H=h::R$. Its head is nonzero, hence $1\le h$; its digits are below
ten since it is a suffix of $S$. Apply
\noderef{P804_T1_DecimalFoldBounds} to get
$10^{|H|-1}\le v(H)<10^{|H|}$.
Together with the empty case this proves $v(H)<10^{|H|}$ always.

If $D\le19$, then $|H|\le D\le19$. If $D-19-z\le0$, substitution
of $D=z+|H|$ instead gives $|H|\le19$. In either case monotonicity
of natural powers of ten gives $v(H)<10^{|H|}\le10^{19}$.
Conversely $0<D-19-z$ gives $|H|>19$, so $H$ is nonempty and
$|H|-1\ge19$. Its preceding lower bound yields
$10^{19}\le10^{|H|-1}\le v(H)$. This establishes both implications
without assuming any exactness for a machine-word scan.
\end{proof}
