Section comp_wd.
Variable F G : Ens.
Hypothesis f : well_definedness F.
Hypothesis g : well_definedness G.
Variable X Y Z : Ens.
Hypothesis i : IN (PAIR X Y) (COMP F G).
Hypothesis j : IN (PAIR X Z) (COMP F G).
Let V := Comp_INTERp F G X Y.
Let W := Comp_INTERp F G X Z.
Let step1 : IN (PAIR X V) F.
Proof COMP_th3p F G X Y i.
Let step2 : IN (PAIR V Y) G.
Proof COMP_th4p F G X Y i.
Let step3 : IN (PAIR X W) F.
Proof COMP_th3p F G X Z j.
Let step4 : IN (PAIR W Z) G.
Proof COMP_th4p F G X Z j.
Let step5 : EQ V W.
Proof f X V W step1 step3.
Let step6 : IN (PAIR V Z) G.
Proof Substitute V W (fun U : Ens => IN (PAIR U Z) G) step5 step4.
Proof g V Y Z step2 step6.
End comp_wd.
Proof comp_wd_Out.
Proof
fun (F G : Ens) (f : well_definedness F) (g : well_definedness G) =>
Build_is_a_function (COMP F G) (COMP_th1 F G)
(composition_well_definedness F G f g).

Theorem composition_th2 :
forall (F G : Ens) (f : is_a_function F) (g : is_a_function G),
is_a_function (COMP F G).