induction i1; destruct i2; destruct ls; intuition; simpl in *.
destruct i1; trivial.
rewrite IHi1.
eapply nth_nil.
omega.
eapply IHi1.
omega.
Qed.

Theorem listReplace_length :
forall (A : Set)(ls : list A)(i : nat)(a def : A),
i < length ls ->
length (listReplace ls i a def) = length ls.