Proof comp_assoc_1_Out.
Section comp_assoc_2.
Variable F G H P : Ens.
Hypothesis p : IN P (COMP (COMP F G) H).
Let step1 : is_a_pair P.
Proof COMP_th1 (COMP F G) H P p.
Let X := PR1 P.
Let W := PR2 P.
Let Z := Comp_INTERp (COMP F G) H X W.
Let Y := Comp_INTERp F G X Z.
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 (COMP F G) H).
Proof
Substitute (PAIR X W) P (fun U : Ens => IN U (COMP (COMP F G) H)) step3 p.
Let step5 : IN (PAIR X Z) (COMP F G).
Proof COMP_th3p (COMP F G) H X W step4.
Let step6 : IN (PAIR Z W) H.
Proof COMP_th4p (COMP F G) H X W step4.
Let step7 : IN (PAIR X Y) F.
Proof COMP_th3p F G X Z step5.
Let step8 : IN (PAIR Y Z) G.
Proof COMP_th4p F G X Z step5.
Let step9 : IN (PAIR Y W) (COMP G H).
Proof COMP_th5 G H Y Z W step8 step6.
Let step10 : IN (PAIR X W) (COMP F (COMP G H)).
Proof COMP_th5 F (COMP G H) X Y W step7 step9.

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