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.
intros. rewrite <- subst'_eq. apply H.
Qed.
Ltac redStep':=
match goal with
|- _ == _ => apply star_equiv;redStep'
| |- app (lam ?s) ?t >* _ => apply lStep;[now Lproc|reflexivity]
| |- app ?s ?t >* _ => progress (etransitivity;[apply star_step_app_proper;redStep'|]);[reflexivity]
| |- _ => reflexivity
end.
Ltac redStep2 := etransitivity;[redStep'|].
(* iLtac redSimpl' s x t:= match s with | app ?s1 ?s2 -> let s1' := resSimpl' s1 x t in let s2' := resSimpl' s2 x t in constr:(app s1' s2') | *)
Ltac Lbeta_old := cbn [subst' Init.Nat.eqb].

Lemma subst'_int (X:Set) (ty : TT X) (f:X) (H : computable f) : forall x t, subst' (ext f) x t = (ext f).