\begin{lemma}[Bulk and scalar composition]
Let $s$ render decimal digits $D$ followed by $R$, every digit below ten,
and $R$ empty or headed by 46, 69, or 101. Suppose
$m+|D|+|R|\le\texttt{Usize.max}$, where $m=d.\mathit{num\_digits.val}$.
There are actual normal intermediate results of bulk loop 3 on
$(s,d.\mathit{num\_digits},d.\mathit{digits})$ and the following scalar
scan on the record with that returned count and array. The final residual
renders $R$. The final record has count $m+|D|$, the input point and sticky
flag, unchanged original cells below $\min(m,768)$, values $D[j-m]$ on
$m\le j<\min(m+|D|,768)$, and unchanged original cells on
$\min(m+|D|,768)\le j<768$.
\end{lemma}
\begin{proof}
Apply \noderef{P495_T1_BulkLoopExact} with count $m$. It supplies actual
intermediate results, a consumed $k\le|D|$, count $m+k$, a residual
rendering $\operatorname{drop}(k,D)$ followed by $R$, and the exact
array splice with value list $\operatorname{take}(k,D)$.
Its record is formed by replacing only the count and array, not point or flag.
The remaining scalar count bound follows from
$(m+k)+(|D|-k)=m+|D|\le\texttt{Usize.max}$. The inherited digit
ranges and head form of $R$ discharge all other premises of
\noderef{P495_T1_ScalarScanExact}. Apply it to this residual and record.
It returns $R$ and count $m+k+(|D|-k)=m+|D|$, with unchanged point and flag.

For $j<\min(m,768)$, scalar old-prefix preservation reduces to the bulk
array and its splice reduces to the original cell. For a written cell
$m\le j<\min(m+|D|,768)$, split at $m+k$. Below the split, scalar
preservation and the bulk written list give $D[j-m]$. At or above the
split, the scalar clause gives
$\operatorname{drop}(k,D)[j-(m+k)]$. The identity
$k+(j-(m+k))=j-m$ identifies that entry with $D[j-m]$.
For $\min(m+|D|,768)\le j<768$, scalar preservation reduces to the
bulk array. If this interval has a member then $m+|D|<768$, hence
$j\ge m+k$; the bulk suffix splice gives the original cell at $j$.
If the interval has no member, the assertion is vacuous. Thus the cell
clauses also cover $m\ge768$, no bulk writes, and cap-adjacent lengths.
The two actual call equations are retained as witnesses, not inferred from
the mathematical count equations.
\end{proof}
