Module aux := fc_dec_aux wf weak subst unique.
Definition fuel_at n : Type :=
(∀ a, size_tm a <= n ->  fuel_tpg a) *
(∀ phi, size_constraint phi <= n -> fuel_pwf phi) *
(∀ gamma, size_co gamma <= n -> fuel_iso gamma) *
(∀ gamma, size_co gamma <= n -> fuel_deq gamma).
Ltac wfind :=
match goal with
| [ Hind: ∀ z : nat, z < ?x → fuel_at z |- fuel_tpg ?a ] => eapply (Hind (size_tm a))
| [ Hind: ∀ z : nat, z < ?x → fuel_at z |- fuel_deq ?g ] => eapply (Hind (size_co g))
| [ Hind: ∀ z : nat, z < ?x → fuel_at z |- fuel_iso ?g ] => eapply (Hind (size_co g))
| [ Hind: ∀ z : nat, z < ?x → fuel_at z |- fuel_pwf ?g ] => eapply (Hind (size_constraint g))
end.
Definition gaspump : ∀ t : tm, fuel_tpg t.
(* TODO: as added bonus, make the function that generates context fuel and write the general function (the one accepting an arbitrary context) *)
Definition FC_typechecker : ∀ t : tm, {T : tm | AnnTyping nil t T } + {(forall T, ¬ AnnTyping nil t T)} :=
fun t => AnnTyping_dec nil t (gaspump t) An_Empty.

Theorem FC_typechecking_decidable : ∀ t : tm, (exists T : tm, AnnTyping nil t T) \/ (∀ T, ¬ AnnTyping nil t T).