Section ListEnumerabilitySystems.
Variable (X: Const).
Hypothesis (enumX: enumT X).
Fixpoint L_sys (n: nat) : list (sysuni X) :=
match n with
| 0 => nil
| S n => L_sys n
++ [Build_sysuni (eqs_typing_nil X Gamma) | Gamma ∈ L_T n]
++ [Build_sysuni (eqs_typing_cons H1 H2 (@cast _ (fun f => eqs_typing f E L) Gamma Gamma' H EQ)) |
(@Build_sysuni _ Gamma E L H, @Build_uni _ Gamma' s t A H1 H2)
∈ (L_sys n × L_T n) where EQ: Gamma = Gamma']
end.
Scheme eqs_typing_strong_ind := Induction for eqs_typing Sort Prop.
Global Instance enumT_sys:
enumT (sysuni X).
Proof with eauto using cum_ge'.
exists L_sys.
- eauto.
- intros [Gamma E L H]. induction H using eqs_typing_strong_ind.
+ destruct (el_T Gamma) as [x]; exists (S x); cbn; in_app 2.
now in_collect Gamma.
+ destruct (el_T (Build_uni Gamma s t A t0 t1)) as [x1].
destruct IHeqs_typing as [x2]. exists (1 + x1 + x2).
cbn; in_app 3. eapply in_flat_map. exists (Build_sysuni H, Build_uni Gamma s t A t0 t1).
split. eapply in_prod...
destruct dec; intuition.
subst. left. f_equal. f_equal.
unfold cast. rewrite <-Eqdep_dec.eq_rect_eq_dec; eauto.
eapply eq_dec.
Qed.
End ListEnumerabilitySystems.

Theorem enumerable_systemunification (X: Const): enumerable__T X -> enumerable (@SU X).