Fixpoint force_lengthn {A} n (xs: list A) (default: A) :=
match n, xs with
| O, _ => nil
| S n0, nil => default :: force_lengthn n0 nil default
| S n0, hd :: tl => hd :: force_lengthn n0 tl default
end.

Lemma nth_force_lengthn: forall {A} n i (xs : list A) (default: A),
(0 <= i < n) %nat ->
nth i (force_lengthn n xs default) default = nth i xs default.