Proof cartpairB_Out.
(********* function graphs ***********)
Section relations_in_cartesian_proof.
Variable R : Ens.
Hypothesis r : is_a_relation R.
Let A := Domain R.
Let B := Range R.
Variable U : Ens.
Hypothesis i : IN U R.
Let step1 : is_a_pair U.
Proof r U i.
Let X := PR1 U.
Let Y := PR2 U.
Let step2 : EQ U (PAIR X Y).
Proof PAIR_proj_th1 U step1.
Let step3 : EQ (PAIR X Y) U.
Proof EQ_symm U (PAIR X Y) step2.
Let step4 : IN (PAIR X Y) R.
Proof Extensionality (PAIR X Y) U R step3 i.
Let step5 : IN X A.
Proof Domain_th1 R X Y step4.
Let step6 : IN Y B.
Proof Range_th1 R X Y step4.
Let step7 : IN (PAIR X Y) (Cartesian A B).
Proof Cartesian_construction A B X Y step5 step6.

Lemma relations_in_cartesian_Out : IN U (Cartesian A B).
Proof Extensionality U (PAIR X Y) (Cartesian A B) step2 step7.