Section TWILIGHT.
Definition twilight (sigma : hsubst) : subst L' :=
fun z : ivar => sigma (enum (isEnumerable := @sum_isEnumerable ivar Henkin_constants nat_isEnumerable nat_isEnumerable) z).
Fixpoint twilight_trm (t : trm L') : trm L' :=
match t with
| Var_trm x => Var_trm (x * 2)
| Fun_trm f ts => Fun_trm f (twilight_trms ts)
| Con_trm c =>
match c with
| inl cc => Con_trm c
| inr hc => Var_trm (hc * 2 + 1)
end
end
with twilight_trms {n : nat} (ts : trms L' n) : trms L' n :=
match ts with
| O_trms => O_trms
| S_trms n t ts => S_trms n (twilight_trm t) (twilight_trms ts)
end.

Lemma twilight_trm_lemma sigma (t : trm L')
: hsubst_trm sigma t = subst_trm (twilight sigma) (twilight_trm t)
with twilight_trms_lemma n sigma (ts : trms L' n)
: hsubst_trms sigma ts = subst_trms (twilight sigma) (twilight_trms ts).