induction l1; intros.
destruct l2; simpl in L. trivial. omega.
destruct l2; simpl in L. omega.
rewrite (IHl1 l2) with (d:=d).
specialize (N O). simpl in N. rewrite N; trivial. omega.
omega.
intros. apply (N (S i)). simpl; omega.
Qed.

Lemma Znth_extensional {A} {d: Inhabitant A}(l1 l2 : list A):
Zlength l1 = Zlength l2 ->
(forall i,
(0 <= i < Zlength l1) -> Znth i l1 = Znth i l2) -> l1 = l2.