auto.
Qed.
(* Ltac impossible_defeq A B := match goal with | h0 : DefEq G A B a_Star => apply consistent_defeq in h0; eauto; apply join_consistent in h0; *)
Ltac impossible_Path :=
match goal with
[H : Path ?T (a_Pi _ _ _) |- _] => inversion H
| [H : Path ?T a_Star |- _] => inversion H
| [H : Path ?T (a_CPi _ _) |- _] => inversion H
end.
(* When we have a defeq in the context between two value types, show that it can't happen. *)
Ltac impossible_defeq :=
let h0 := fresh in
let VT := fresh in
let VT2 := fresh in
match goal with
| [ H : DefEq ?G (dom ?G) ?B ?A ?C |- _ ] =>
pose h0:= H; clearbody h0;
apply consistent_defeq in h0; eauto;
[apply join_consistent in h0;
destruct (DefEq_lc H) as (l0 & l1 & l2); inversion l0; inversion l1; subst;
have VT: value_type A; eauto;
have VT2 : value_type B; eauto;
inversion h0; subst; try impossible_Path;
eauto; try done | eapply irrelevant_Good; eauto]
end.

(* Specifications: *)
Lemma canonical_forms_Star : forall G a, irrelevant G (dom G) a ->
Typing G a a_Star -> Value a -> value_type a.
Lemma DefEq_Star: forall A G D, Good G D -> value_type A -> DefEq G D A a_Star a_Star -> A = a_Star.
Lemma canonical_forms_Pi : forall G rho a A B, irrelevant G (dom G) a ->
Typing G a (a_Pi rho A B) -> Value a ->
(exists a1, a = a_UAbs rho a1) \/ (exists T, Path T a).
Lemma canonical_forms_CPi : forall G a phi B, irrelevant G (dom G) a ->
Typing G a (a_CPi phi B) -> Value a ->
(exists a1, a = a_UCAbs a1) \/ (exists T, Path T a).