I was trying to do a safe get
function for list using subset types. I tryied this definition using program
Program Fixpoint get A (l : list A) (n : {x : nat | x < length l} ) : A :=
match (n, l) with
| (O, x :: l') => x
| (S n', x :: l') => get l' n'
| _ => _
end.
The problem is that it get the following error
Found a constructor of inductive type nat while a constructor of sig
is expected.
Why does coq don't let me do a pattern matching in pair containing the subset type?