induction ls; intuition; simpl in *.
discriminate.
destruct i.
inversion H; clear H; subst.
intuition.
right.
eapply IHls.
eauto.
Qed.
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.

Theorem firstIndexOf_in_lt :
forall (A : Set)(eqd : eq_dec A)(ls : list A)(a : A)(def : nat),
In a ls ->
firstIndexOf eqd ls a def < length ls.