When redefining the natural number type in Coq and trying to use it, like so:
Inductive Nat: Type :=
| O: Nat
| S: Nat -> Nat.
Fixpoint plus (n: Nat) (m: Nat): Nat :=
match n with
| O => m
| S n' => S (plus n' m)
end.
Fixpoint mult (n: Nat) (m: Nat): Nat :=
match n with
| O => O
| S n' => plus m (mult n' m)
end.
Fixpoint factorial (n: Nat) : Nat :=
match n with
| O => 1
| (S n') => mult n (factorial n')
end.
Coq emits the error
The term "1" has type "nat" while it is expected to have type "Nat".
I understand the cause of this behaviour (the actual number '1' is still mapped to Coq's built-in natural number type) but is there a way of fixing it? TIA.