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_nil: forall {A} n i (default: A),
nth i (force_lengthn n nil default) default = default.