Fixpoint firstIndexOf(A : Set)(eqd : eq_dec A)(ls : list A)(a : A)(def : nat) :=
  match ls with
      | nil => def
      | a' :: ls' =>
        if (eqd a a') then O else (S (firstIndexOf eqd ls' a def))
  end.

Lemma not_in_nth_option : forall (A : Set)(ls : list A)(a : A)(i : nat), (~In a ls) -> nth_option ls i = Some a -> False.