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.
Fixpoint twilight_frm (p : frm L') : frm L' :=
match p with
| Rel_frm R ts => Rel_frm R (twilight_trms ts)
| Eqn_frm t1 t2 => Eqn_frm (twilight_trm t1) (twilight_trm t2)
| Neg_frm p1 => Neg_frm (twilight_frm p1)
| Imp_frm p1 p2 => Imp_frm (twilight_frm p1) (twilight_frm p2)
| All_frm y p1 => All_frm (2 * y) (twilight_frm p1)
end.

Lemma untwilight_trm (t : trm L')
(HENKIN_FREE : forall c, HC_occurs_in_trm c t = false)
: twilight_trm t = subst_trm (fun z : ivar => Var_trm (z * 2)) t
with untwilight_trms n (ts : trms L' n)
(HENKIN_FREE : forall c, HC_occurs_in_trms c ts = false)
: twilight_trms ts = subst_trms (fun z : ivar => Var_trm (z * 2)) ts.