Fixpoint all_but (i : nat) {A} (l : list A) : list A :=
match i with
O => tl l
| S i =>
match l with
nil => nil
| x :: l => x :: all_but i l
end
end.

Lemma all_but_app {A} i (l l' : list A) :
lt i (List.length l) ->
all_but i (l ++ l') = all_but i l ++ l'.