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 beta_red s t t' : lambda t -> t' == subst s 0 t -> (lam s) t == t'.