Proof comp_ev_3_Out.
(******** associativity of composition ********)
Section comp_assoc_1.
Variable F G H P : Ens.
Hypothesis p : IN P (COMP F (COMP G H)).
Let step1 : is_a_pair P.
Proof COMP_th1 F (COMP G H) P p.
Let X := PR1 P.
Let W := PR2 P.
Let Y := Comp_INTERp F (COMP G H) X W.
Let Z := Comp_INTERp G H Y W.
Let step2 : EQ P (PAIR X W).
Proof PAIR_proj_th1 P step1.
Let step3 : EQ (PAIR X W) P.
Proof EQ_symm P (PAIR X W) step2.
Let step4 : IN (PAIR X W) (COMP F (COMP G H)).
Proof
Substitute (PAIR X W) P (fun U : Ens => IN U (COMP F (COMP G H))) step3 p.
Let step5 : IN (PAIR X Y) F.
Proof COMP_th3p F (COMP G H) X W step4.
Let step6 : IN (PAIR Y W) (COMP G H).
Proof COMP_th4p F (COMP G H) X W step4.
Let step7 : IN (PAIR Y Z) G.
Proof COMP_th3p G H Y W step6.
Let step8 : IN (PAIR Z W) H.
Proof COMP_th4p G H Y W step6.
Let step9 : IN (PAIR X Z) (COMP F G).
Proof COMP_th5 F G X Y Z step5 step7.
Let step10 : IN (PAIR X W) (COMP (COMP F G) H).
Proof COMP_th5 (COMP F G) H X Z W step9 step8.

Lemma comp_assoc_1_Out : IN P (COMP (COMP F G) H).
Proof
Substitute P (PAIR X W) (fun U : Ens => IN U (COMP (COMP F G) H)) step2
step10.