Fixpoint extendr {A} (l : list A) ls :=
match l, ls with
| x :: xs, y :: ys => (y ++ [x]) :: extendr xs ys
| _, _ => ls
end.

Lemma sublist_extend : forall {A} (l : list A) ls i j,
sublist i j (extend l ls) = extend (sublist i j l) (sublist i j ls).