Section Numerals.
Definition BT := {b : nat | 0 < b}.
Variable BASE : BT.
Definition base := Inj nat (fun b : nat => 0 < b) BASE.
Definition digit := {x : nat | x < base}.
Definition val : digit -> nat := Inj nat (fun x : nat => x < base).
Definition num := list digit.
Definition inf (n : nat) := {x : nat | x < n}.
Definition val_inf (n : nat) : inf n -> nat :=
Inj nat (fun x : nat => x < n).
Let Cons := cons digit.
Let Nil := nil digit.
Fixpoint Val (n : nat) (X : num n) {struct X} : nat :=
match X with
| nil => 0
| cons p xp X' => val xp * exp base p + Val p X'
end.

Lemma Val_val : forall x : digit, Val 1 (Cons 0 x Nil) = val x.