Module ext_invert (subst : ext_subst_sig) <: ext_invert_sig.
Include subst.
Set Bullet Behavior "Strict Subproofs".
Set Implicit Arguments.

(* Specifications: *)
Lemma binds_to_Typing: forall G T A, Ctx G -> binds T (Tm A) G -> Typing G A a_Star.
Lemma invert_a_Pi:
forall G rho A0 A B0,
Typing G (a_Pi rho A0 B0) A
-> DefEq G (dom G) A a_Star a_Star
/\ (exists L, forall x,
x `notin` L
-> Typing ([(x, Tm A0)] ++ G) (open_tm_wrt_tm B0 (a_Var_f x)) a_Star)
/\ Typing G A0 a_Star.
Lemma invert_a_CPi: forall G phi A B0,
Typing G (a_CPi phi B0) A ->
DefEq G (dom G) A a_Star a_Star /\ (exists L, forall c, c `notin` L -> Typing ([(c, Co phi)] ++ G) (open_tm_wrt_co B0 (g_Var_f c) ) a_Star) /\ PropWff G phi.
Lemma invert_a_Const : forall G T A,
Typing G (a_Const T) A ->
exists B, DataTy B a_Star /\ DefEq G (dom G) A B  a_Star
/\ binds T (Cs B) toplevel.
Lemma invert_a_Fam : forall G F A,
Typing G (a_Fam F) A ->
exists a B, DefEq G (dom G) A B a_Star /\
binds F (Ax a B) toplevel /\ Typing nil B a_Star.
Lemma invert_a_Star: forall A G, Typing G a_Star A -> DefEq G (dom G) A a_Star a_Star.
Lemma invert_a_Var :
forall G x A, Typing G (a_Var_f x) A -> exists A', binds x (Tm A') G /\ DefEq G (dom G) A A' a_Star.