Section ConstantSubstitution.
Implicit Types (X Y Z : Const).
Fixpoint subst_consts {X Y} (kappa: X -> exp Y) s :=
match s with
| var x => var x
| const c => kappa c
| lambda s => lambda (subst_consts (kappa >> ren shift) s)
| app s t => (subst_consts kappa s) (subst_consts kappa t)
end.
Global Instance step_subst_consts X Y:
Proper (Logic.eq ++> step ++> step) (@subst_consts X Y).
Global Instance steps_subst_consts X Y:
Proper (Logic.eq ++> star step ++> star step) (@subst_consts X Y).
Global Instance equiv_subst_consts X Y:
Proper (Logic.eq ++> equiv step ++> equiv step) (@subst_consts X Y).

Lemma subst_consts_up Y Z (zeta: Y -> exp Z) (sigma: fin -> exp Y):
up (sigma >> subst_consts zeta) = up sigma >> subst_consts (zeta >> ren shift).