\begin{lemma}[Normal nearest-even extraction for an arbitrary endpoint]
Let $d$ have count at most 768 and decimal retained cells.
Assume either $d.n=0$, false sticky and $X=0$, or positive exact-length
retained shape and a nonzero last retained cell.
Suppose $p<19$, $0\le X<2^{64}-1/2$ and
\[
 X=V(d)+\eta,\quad Y=V(d)+u,\quad
 0\le\eta<u,\quad d.\mathit{truncated}\iff\eta>0 .
\]
If for every natural $n$,
$n+1/2\le V(d)$ or $Y\le n+1/2$,
then the actual round call returns normally to a U64 $m$ with
\[
 X\le m+\tfrac12,\quad m\le X+\tfrac12,\quad
 (X=m+\tfrac12\ \lor\ X=m-\tfrac12)\Longrightarrow m\bmod2=0.
\]
The endpoint $Y$ need not be a fresh decimal cutoff.
\end{lemma}
\begin{proof}
Unfold \noderef{num_imp_dec2flt_decimal_seq_DecimalSeq_round}.
In the zero case it returns U64 zero, and $X=0$ proves the conclusions.
In the other case the word is nonempty and its last mapped digit is nonzero:
the physical last index is $d.n-1<768$, and exact retained length
identifies the last mapped digit with that byte.
The endpoint witnesses give $X<Y$.

If $p<0$, \noderef{P472_T1_DecimalValueBounds} gives
$V(d)<10^p\le1/10<1/2$. Separation at $n=0$ must therefore give
$Y\le1/2$, hence $0\le X<Y\le1/2$.
The negative-point branch returns zero, satisfies both distance bounds
and has no possible midpoint equality.

For $0\le p<19$, the literal threshold is 19 by
\noderef{num_imp_dec2flt_decimal_seq_DecimalSeq_MAX_DIGITS_WITHOUT_OVERFLOW}.
Its cast to I32 is exact, the saturation guard is false, and the
I32-to-Usize cast of $p$ is exact with value $q=p\le18$.
These casts use the ratified width in \noderef{Assumptions}.
Apply \noderef{DecimalSeqRoundLoopValue} at this $q$, the given count and
digit bounds. It constructs the actual normal range-loop result $N$:
it is the first-$q$ fold if $q<d.n$, and the full fold padded by
$10^{q-d.n}$ otherwise.
The normal loop and its value are supplied by that principal, so no
termination of the enclosing round is assumed.

If $d.n\le q$, then $N=V(d)$, the fractional-digit guard is false,
and the result is $N$. Separation at natural $N$ excludes
$N+1/2\le V(d)=N$, hence gives $Y\le N+1/2$.
Thus $N\le X<Y\le N+1/2$, proving both bounds without a tie.

If $q<d.n$, apply \noderef{DecimalSeqFractionalDigitInterval} to
the mapped digit word, its established nonzero last digit, and index $q$.
It gives $N\le V(d)<N+1$ and the exact trichotomy at $N+1/2$:
a first fractional digit below five is strictly below;
one above five is strictly above;
a five followed by any remaining digit is strictly above because of
terminal trimming; a terminal five is exactly equal.
The array read is safe since $q<d.n\le768$.
For a five, $q+1\le19$ makes its checked Usize addition safe.

Below the midpoint separation at $N$ forces $Y\le N+1/2$, so
$N\le X<N+1/2$ and the unchanged result has the required bounds.
Above the midpoint, or at a terminal five with true sticky,
$X>N+1/2$. Separation at $N+1$ and $V(d)<N+1$ force
$Y\le N+3/2$, hence
$N+1/2<X<Y\le N+3/2$.
The code increments in exactly these cases. The two strict inequalities
give the distance bounds for $N+1$ and exclude midpoint equality.
The increment cannot overflow: $N+1/2<X<2^{64}-1/2$ gives
$N+1<2^{64}$.

For a terminal five with false sticky, $\eta\ge0$ and the exact sticky
equivalence imply $\eta=0$, so $X=N+1/2$.
If $q=0$, the special branch keeps $N=0$, which is even.
Otherwise $q-1$ is a safe Usize subtraction and the preceding byte
read is in bounds. If that byte has value $c$, the fold identity is
$N=10P+c$, so $N\bmod2=c\bmod2$.
The unsigned-byte bitvector semantics gives
$\mathit{val}(1\mathbin{\&}c)=c\bmod2$.
The branch therefore keeps an even $N$ and increments an odd $N$ to
an even $N+1$. In the latter case the same safe-range argument
$X=N+1/2<2^{64}-1/2$ proves the increment legal.
The selected result satisfies both nearest inequalities and is even
at the only possible tie. These cases exhaust every guard and checked
operation, establishing normality and all stated output laws.
\end{proof}
