\begin{lemma}[Exact retained and retry accounting for rendered lexemes]
Let $s:\texttt{Slice U8}$ satisfy $|s|\le A=3458764513820540928$.
Let $x:\texttt{DecimalLexeme}$ have no leading sign, be valid numeric,
and render exactly the whole byte-value list of $s$, in the vocabulary of
\noderef{DecimalGoalVocabularyDefault}. Suppose the actual specialized
call in \noderef{P9_T1_ActualDispatchOperations} returns
$\texttt{ok (some }d\texttt{)}$.
Let $S$ be the integer digits of $x$ followed by its fractional digits
(empty when absent), let $f$ be its fractional digit count, and let
$E=\texttt{accumulatedExplicitExponent}(x)$.
Then both of the following conditional conclusions hold:
\[
d.\mathit{many\_digits}=\texttt{false}\ \Longrightarrow
d.\mathit{mantissa}.\mathit{val}=\operatorname{foldl}(a,b\mapsto10a+b,0,S)
\ \land\ d.\mathit{exponent}.\mathit{val}=E-f;
\]
\[
d.\mathit{many\_digits}=\texttt{true}\ \Longrightarrow
\exists P,Q,\quad S=P\mathbin{++}Q,\quad
d.\mathit{mantissa}.\mathit{val}=\operatorname{foldl}(a,b\mapsto10a+b,0,P),
\quad d.\mathit{exponent}.\mathit{val}=E-f+|Q|.
\]
All displayed folds are natural folds, and all exponent equations are
integer equations. The explicit exponent has the source-defined pre-update
$2^{59}$ cutoff, including its overshoot and independent sign; it is not
the unrestricted mathematical exponent. The statement does not assert
the size of the retained prefix or require the discarded suffix to be
nonzero.
\end{lemma}
\begin{proof}
Write $K(a,b)=10a+(b.\mathit{val}-48)$ for the byte-digit step,
$H(a,d)=10a+d$ for the natural-digit step, and $v(B)$ for the
zero-start $K$ fold on a byte list $B$.

First recover an actual partial-parser result. Unfold the parseNumber
field of \noderef{P9_T1_ActualDispatchOperations} and then
\noderef{num_imp_dec2flt_parse_parse_number}. A failure, divergence,
or normal None from the partial parser cannot give the assumed normal
Some $d$. A normal Some pair with a consumed length different from the
whole slice length is also rejected. Thus for some Usize $\ell$,
the actual partial parser returns normally Some $(d,\ell)$, with
the same record $d$. This uses inversion of the wrapper's Result,
option and pair constructors, not a totality assumption.

Apply \noderef{P435_T1_RenderedDigitBlocks} to the unsigned rendering
equality, with empty remainder. Obtain integer bytes $I$, fractional
bytes $F$, exponent digit bytes $J$, and the exact suffix $T$.
Let $p$ be the presence of a fraction. Then
$s.\mathit{val}=I++[46]++F++T$ if $p$, and $I++T$ otherwise;
$F=[]$ in the latter case. All three byte digit blocks lie in $[48,57]$.
The suffix is empty or starts with 69 or 101. Consequently it has a
nondigit head when nonempty, and its head is neither 48 nor 46.
Apply \noderef{P435_T1_DigitDecoding} to $I,F$ and their encoding
equations. Decoding gives exactly the integer and fractional natural
digit lists of $x$, preserves their lengths, and transports their
folds. Mapping over append therefore identifies the decoding of
$I++F$ with $S$, its natural fold with $v(I++F)$, and $|F|$ with $f$.

Apply \noderef{P435_T1_SignificandScanA} to this decomposition.
Its digit, nondigit-tail, absent-point and length hypotheses all hold
by the preceding paragraph and the assumed A-bound. Obtain actual
normal scan words $m_0,m$, saved integer-end slice $s_1$, significand-end
slice $s_2$, Isize counts $i,f_b,D$, and I64 base $b$.
The stated equations give $s_1$'s exact point-headed or point-free
tail, $s_2.\mathit{val}=T$, $b.\mathit{val}=-|F|=-f$,
and $D.\mathit{val}=|I|+|F|=|S|$.
The shape gives $|I|+|F|\le|s|\le A$ and $|F|\le A$.
Validity in \noderef{DecimalGoalVocabularyDefault} supplies a
nonempty integer or fractional digit list. Hence $D.\mathit{val}>0$.
In particular $0<D.\mathit{val}\le|s|$ and
$-A\le b.\mathit{val}\le A$.

Apply \noderef{P789_T1_RenderedExponentContinuation} to $x,s_2,J$.
Its value-map and byte-range premises are those of the rendered
blocks, and its suffix premise is $s_2.\mathit{val}=T$.
It gives an actual I64 explicit word $e$, with
$e.\mathit{val}=E$ and $-C\le e.\mathit{val}\le C$,
$C=5764607523034234879$. It also gives either the empty suffix
with $e=0$, or an actual marker split followed by a normal scientific
Some $e$ and empty residual. Thus it identifies the exact source
continuation, including the accumulated exponent's cutoff and sign.

Apply \noderef{P789_T1_PartialNumberBranches} using these continuation
facts, the normal scans, offset, fraction block and count sum, the
bounds just established, and the actual partial-parser result.
Put $z=\texttt{count}_{48}(\texttt{takeWhile}_{48\lor46}(s.\mathit{val}))$.
Its alternatives are:
a retained record with many-digits false, mantissa $m$ and exponent
value $b.\mathit{val}+e.\mathit{val}=E-f$, satisfying
$D.\mathit{val}\le19$ or $D.\mathit{val}-19-z\le0$; or a retry
record with many-digits true, $0<D.\mathit{val}-19-z$, and the actual
retry call on $(s,s_1,e)$ equal to
$\texttt{ok}(d.\mathit{mantissa},d.\mathit{exponent})$.

For the size implications apply \noderef{P789_T1_RenderedSignificantBounds}
to $I,F,T,p$ and the exact source shape. Its hypotheses hold because
the digit ranges are known and $T$ is empty or marker-headed.
This lemma identifies the raw source zero count with the natural
leading-zero count even when that prefix crosses the point.
It gives $v(I++F)<10^{19}$ in the retained alternative and
$v(I++F)\ge10^{19}$ in the retry alternative.
These are natural fold bounds established without using exactness
of either wrapping scan.

If $d.\mathit{many\_digits}$ is false, the retry alternative is impossible.
In the retained alternative the bound just proved implies
$v(I++F)\le\texttt{U64.max}$, since
$10^{19}-1<2^{64}-1$.
Apply \noderef{P789_T1_SignificandNonwrapping} with the actual scan
and fraction-block equations, saved integer-end shape and the same
digit and stopping facts. Its source-length bound holds since
$A<2^{63}-1$. It yields $m.\mathit{val}=v(I++F)$.
The retained record's mantissa is $m$, and decoding transports this
value to the natural fold on $S$. Its exponent value is $E-f$,
as already identified. This proves the first conditional conclusion.

If $d.\mathit{many\_digits}$ is true, the retained alternative is
impossible. In the retry alternative consider point presence.
If $p$ is true, the actual start and saved end have contents
$I++[46]++F++T$ and $[46]++F++T$.
Apply \noderef{P367_T1_NumberHelperFractionalRetryA} with explicit word
$e$. Its digit, tail-head and A-bound premises hold, and its exponent
bounds were obtained above. It gives a normal retry pair $(m',q)$
and byte lists $P_b,Q_b$ with $I++F=P_b++Q_b$,
$m'.\mathit{val}=v(P_b)$ and
$q.\mathit{val}=E-|F|+|Q_b|$.

If $p$ is false, $F=[]$, and the independent retry fold bound gives
$v(I)\ge10^{19}\ge10^{18}$. The start and saved end now have contents
$I++T$ and $T$. Apply \noderef{P367_T1_NumberHelperIntegralRetryA}
using this value bound and the same digit, tail, A-bound and explicit
exponent bounds. It returns a normal retry pair $(m',q)$ and
$I=P_b++Q_b$, with $m'.\mathit{val}=v(P_b)$ and
$q.\mathit{val}=E+|Q_b|=E-|F|+|Q_b|$.
Thus both point cases supply the same partition and accounting form.

In either case compare this normal retry result with the actual
retry equation supplied by the branch lemma. Injectivity of Result
and pairs identifies $m'=d.\mathit{mantissa}$ and
$q=d.\mathit{exponent}$. Take $P,Q$ to be the decodings of $P_b,Q_b$.
Mapping the partition over append gives $S=P++Q$; map preserves
$|Q_b|=|Q|$, and the fold-map identity gives the natural fold of $P$
as $v(P_b)$. Since $|F|=f$, the exponent becomes exactly
$E-f+|Q|$. This proves the second conditional conclusion.
\end{proof}
