Section total_and_pairs_1.
Variable R : Ens.
Variable A B : Ens.
Hypothesis i : IN (PAIR A B) R.
Let step1 : IN A (First A).
Proof Singleton_pr1 A.
Let step2 : IN B (Singleton B).
Proof Singleton_pr1 B.
Let step3 : IN (Singleton B) (Second B).
Proof Doubleton_th2 Zero (Singleton B).
Let step4 : IN (First A) (PAIR A B).
Proof Doubleton_th1 (First A) (Second B).
Let step5 : IN (Second B) (PAIR A B).
Proof Doubleton_th2 (First A) (Second B).
Proof Total_th3 A (First A) (PAIR A B) R step1 step4 i.
Proof Total_th4 B (Singleton B) (Second B) (PAIR A B) R step2 step3 step5 i.
End total_and_pairs_1.
Proof total_and_pairs_1_OutA.
Proof total_and_pairs_1_OutB.
(******** ??? also prove that if m: M is a pair and M in R then PAIR_proj1 M m in Total R etc *********)
(************ Domain and Range ***************)
Definition Domain_prop (R X : Ens) := EXISTS (fun Y : Ens => IN (PAIR X Y) R).
Definition Range_prop (R Y : Ens) := EXISTS (fun X : Ens => IN (PAIR X Y) R).
(******** we use CHOICE to define evaluations ******)
Definition EV (R X : Ens) := CHOICE (fun Y : Ens => IN (PAIR X Y) R).
Proof
fun (R X : Ens) (p : Domain_prop R X) =>
CHOICE_pr (fun Y : Ens => IN (PAIR X Y) R) p.
Definition inverse_EV (R Y : Ens) := CHOICE (fun X : Ens => IN (PAIR X Y) R).

Theorem inverse_EV_pr :
forall (R Y : Ens) (p : Range_prop R Y), IN (PAIR (inverse_EV R Y) Y) R.