I'm trying to make an Idris function of type (j : Nat) -> {auto p : So (j < n)} -> Fin n
to convert a Nat
into a Fin n
. To get the Z
case to work (and output FZ
), I'm trying to prove that a proof of 0 < n
is sufficient to be able to make FZ : Fin n
. But I can't work out how to do this.
I'm open to making a completely different function, as long as it can convert Nat
values into Fin n
values (where they exist). My goal is to have some other function that can convert any Nat
into a Mod n
value, so that, for example, 15 : Nat
is mapped to 3 : Mod 4
. My Mod
type currently has a single constructor, mkMod : Fin n -> Mod n
.