(*+ Stdlib: some list functions *)
Fixpoint nth_upd {A} (l : list A) i x :=
match l with
| nil => nil
| y :: l =>
match i with
| O => x :: l
| S i => y :: nth_upd l i x
end
end.

Lemma nth_snoc {A} i (l : list A) x :
i <> List.length l ->
nth (l ++ x :: nil) i = nth l i.