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.

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).