\begin{lemma}[Retained or retry constructors after a matched continuation]
Let $s,s_1,s_2,m_0,m,i,f,D,b,e,d,\ell$ have the types in Lean:
three byte slices, two U64 scan words, three Isize counts, two I64
exponents, a decimal record and a Usize consumed length.
Suppose $|s|\le A=3458764513820540928$, $0<D.\mathit{val}\le|s|$,
$-A\le b.\mathit{val}\le A$ and
$-C\le e.\mathit{val}\le C$, where $C=5764607523034234879$.
Assume the actual integer scan from $(s,0)$ returns $(s_1,m_0)$,
its offset from $s$ returns $i$, the source optional-fraction block
returns $(s_2,m,f,b)$, and checked $i+f$ returns $D$.
The optional-fraction block is exactly the one displayed in Lean,
including split-first, scan, offset, negation and checked I64 cast.
Assume also either $s_2.\mathit{val}=[]$ and $e=0$, or an actual
split-first of $s_2$ returns a 101 or 69 marker and a slice on which
the scientific parser returns normally Some $e$ with empty residual.
If the actual partial-number parser returns normally Some $(d,\ell)$,
put $z=\texttt{count}_{48}(\texttt{takeWhile}_{48\lor46}(s.\mathit{val}))$.
Then either
\[
d.\mathit{many\_digits}=\texttt{false},\quad
d.\mathit{mantissa}=m,\quad d.\mathit{exponent}.\mathit{val}=b.\mathit{val}+e.\mathit{val},
\quad (D.\mathit{val}\le19\ \lor\ D.\mathit{val}-19-z\le0),
\]
or
\[
d.\mathit{many\_digits}=\texttt{true},\quad 0<D.\mathit{val}-19-z,
\quad\texttt{parse\_many\_digits}(s,s_1,e)
=\texttt{ok}(d.\mathit{mantissa},d.\mathit{exponent}).
\]
The displayed subtractions are integer subtractions.
\end{lemma}
\begin{proof}
Unfold \noderef{num_imp_dec2flt_parse_parse_partial_number}.
If its nonempty assertion failed, its result would fail, contradicting
the assumed normal Some result. Substitute the given integer scan,
offset, optional-fraction block and sum equations into the succeeding
binds. These all return normally by hypothesis. The zero-count
rejection test is false since $D.\mathit{val}>0$.

For the empty-continuation alternative,
\noderef{ModelSliceSplitFirst} makes the next split None. The source
leaves $b$ unchanged and passes literal I64 zero to any retry.
This is exactly $e$, by the hypothesis in this alternative.
Its retained exponent has value $b.\mathit{val}+e.\mathit{val}$.
For the marker alternative, substitute its given split. A 101 head
takes the first marker branch; a 69 head fails the 101 test and takes
the second. Substitute the given normal scientific result.
\noderef{ModelOptionBranch} makes the Some branch Continue with
precisely $e$. Apply \noderef{P367_T1_NumberHelperExponentAddA} to
$b,e$ using the assumed four bounds. Its normal checked sum has
value $b.\mathit{val}+e.\mathit{val}$. Substitute it.
Both marker branches now have the same retained fields and pass $e$
to their retry. No nonmarker case is reached under these alternatives.

Each reached branch next measures its consumed length and casts it
to Usize. Invert the assumed normal Some result to obtain normality
of both operations and their actual results; a fail or div operand
could not yield Some. Neither operation changes a scan word or an
exponent, and the consumed length is irrelevant to the conclusions.
Thus it remains to inspect the common size selection.

When $D\le19$, the retained constructor literally has mantissa $m$,
the retained exponent identified above, and many-digits false.
Scalar ordering here is ordering of values, so its condition supplies
the first disjunct of the required size condition.
Otherwise $19<D.\mathit{val}\le A$. By the selected 64-bit width
in \noderef{Assumptions}, the checked Isize subtraction of 19 is
in bounds: its value lies in $[1,A]$, a subset of
$[-2^{63},2^{63}-1]$. Denote this normal result by $n$.
Also $0\le n.\mathit{val}\le|s|$. Apply
\noderef{P367_T1_NumberHelperAdjustmentA} to $s,n$ to obtain
the actual normal adjustment with value $D.\mathit{val}-19-z$.
Substitute both normal results into the source branch.

If that value is nonpositive, its greater-than-zero test is false;
the retained constructor again has the stated fields, now with the
second size disjunct. If it is positive, the source calls
$\texttt{parse\_many\_digits}(s,s_1,e)$. Inverting the enclosing
normal Some equation forces this call to return a normal pair.
The following constructor has many-digits literally true and uses
exactly that pair as its mantissa and exponent. Injecting the normal
result, Some, and pair constructors identifies these fields with
$d$ and gives precisely the asserted retry equation and positivity.
All branches have been exhausted. The proof uses normal-result
inversion for the consumed-length operations and retry, rather than
postulating their normality for arbitrary slices.
\end{proof}
