Section nat_Show.
Local Open Scope string.
Definition get_last_digit (n: nat): string :=
match n mod 10 with
| 0 => "0" | 1 => "1" | 2 => "2" | 3 => "3" | 4 => "4" | 5 => "5"
| 6 => "6" | 7 => "7" | 8 => "8" | _ => "9"
end.
Function string_of_nat_aux (acc: string) (n : nat) {measure id n}: string :=
let acc' := get_last_digit n ++ acc in
match n / 10 with
| 0 => acc'
| n' => string_of_nat_aux acc' n'
end.
intros _ n m ineq.
unfold id; simpl.
destruct n as [| n]; [simpl in *; easy |].
rewrite <- ineq; apply Nat.div_lt; lia.
Defined.
Definition string_of_nat := string_of_nat_aux "".
Ltac eq_fun H f :=
match type of H with
| ?x1 = ?x2 => assert (f x1 = f x2) by (rewrite H; reflexivity)
end.

Lemma string_of_nat_aux_inj: forall n m acc,
n <> m ->
string_of_nat_aux acc n <>
string_of_nat_aux acc m.