From Undecidability.L Require Import ComputableTactics Lproc mixedTactics Tactics.Computable ComputableTime Lrewrite.
Local Fixpoint subst' (s : term) (k : nat) (u : term) {struct s} : term :=
match s with
| # n => if Init.Nat.eqb n k then u else # n
| app s0 t => (subst' s0 k u) (subst' t k u)
| (lam s0) => (lam (subst' s0 (S k) u))
end.
revert k;induction s;intros;simpl;try congruence.
(* dec;destruct (n =? k) eqn:eq;try reflexivity. *)
(* -apply beq_nat_false in eq. tauto. *)
(* -apply beq_nat_true in eq. exfalso; tauto.  *)
Qed.

Lemma subst'_cls s : closed s -> forall x t, subst' s x t = s.