\begin{lemma}[Decimal lexicographic comparison as a scaled integer comparison]
Let $x$ and $y$ be finite lists of natural-number decimal digits.  Assume
every entry of both lists is less than ten and, when $y$ is nonempty, its
last entry is nonzero.  If $E(z)$ denotes the base-ten left fold of a list
$z$, then
\[
 \operatorname{Lex}(\operatorname{take}_{|y|}(x),y)
 \quad\Longleftrightarrow\quad
 E(x)10^{|y|}<E(y)10^{|x|}.
\]
Here \(\operatorname{Lex}\) uses the strict order on natural numbers.
\end{lemma}
\begin{proof}
For a list $z$ and initial accumulator $a$, induction on $z$ gives
\[
 \operatorname{fold}_{10}(z,a)=a10^{|z|}+E(z).       \tag{1}
\]
The same induction, using that each digit is below ten, gives
$E(z)<10^{|z|}$.  If $z$ is nonempty and its last digit is nonzero, a
second induction using (1) gives $E(z)>0$: for a singleton this is exactly
the last-digit hypothesis, and after a nonempty tail it follows from the
positive value of that tail.

We prove the displayed equivalence by induction on $y$.  For $y=[]$, both
sides are false.  If $y=b::y'$ and $x=[]$, the lexicographic relation holds
by the empty-list rule and the numerical inequality holds because the
preceding positivity result gives $E(y)>0$.

It remains to take $x=a::x'$.  Formula (1) writes
$E(x)=a10^{|x'|}+E(x')$ and $E(y)=b10^{|y'|}+E(y')$, with each remainder
strictly below its corresponding power of ten.  If $a<b$, these strict
remainder bounds show the scaled value of $x$ is smaller, and the
lexicographic relation holds at its first digit.  If $a=b$, cancellation of
the equal leading terms reduces the numerical inequality exactly to the
induction hypothesis for $x'$ and $y'$; the nonzero-last-digit hypothesis
passes to $y'$ whenever it is nonempty.  If $b<a$, the same strict bounds
make the scaled inequality impossible.  A lexicographic proof in this last
case also cannot start at the heads, and if it continues to the tails the
induction hypothesis contradicts the inequality forced by $b<a$.  These
three cases exhaust the natural-number order and prove the equivalence.
\end{proof}
