The natToFin function from the standard library has the following signature:
natToFin : Nat -> (n : Nat) -> Maybe (Fin n)
natToFin 4 5 returns Just (FS (FS (FS (FS FZ)))) : Maybe (Fin 5) , while natToFin 5 5 returns Nothing .
I need a function with the following signature:
myNatToFin : (m : Nat) -> (n : Nat) -> { auto p : n `GT` m } -> Fin n
It behaves in the same way as the standard lib function, but does not need to return Maybe , because you can always create Fin n from m , given that n greater than m .
How to implement myNatToFin ?
source share