From Undecidability.L Require Import LTactics.
Fixpoint many_lam k s := match k with 0 => s | S k => lam (many_lam k s) end.
Fixpoint many_app k s (v : Vector.t term k) :=
match v with
| Vector.nil => s
| Vector.cons x _ v => many_app (L.app s x) v
end.
Definition many_vars k := (tabulate (n := k) (fun i => k - S (proj1_sig (Fin.to_nat i)))).
Fixpoint many_subst {k} s n (v : Vector.t term k) :=
match v with
| [] => s
| Vector.cons u k v => many_subst (subst s (n + k) u) n v
end.

Lemma many_subst_app (s t : term) {k} n (v : Vector.t term k) :
many_subst (s t) n v = (many_subst s n v) (many_subst t n v).