(* End of proof of lem_equivClass_is_same                                  *)

Definition equiv_comp (r a : E) (rRel : rel_sig r a a)
  (rEqv : equivalence r a rRel) (rD : rdom r a a rRel = a) 
  (s f : E) (Afs : fun_sig f a s)
  (Pr : forall x y : E,
        In (couple x y) r ->
        App f (lem_fun_sig_is_fun f a s Afs) x =
        App f (lem_fun_sig_is_fun f a s Afs) y) :=
  subset
    (fun z : E =>
     exists x : E,
       In x a /\
       z =
       couple (equivClass r a rRel rEqv x)
         (App f (lem_fun_sig_is_fun f a s Afs) x))
    (cartesien (quotient r a rRel rEqv rD) s).

(* Specifications: *)
Lemma lem_equiv_comp_is_fun : forall (r a : E) (rRel : rel_sig r a a) (rEqv : equivalence r a rRel) (rD : rdom r a a rRel = a) (s f : E) (Afs : fun_sig f a s) (Pr : forall x y : E, In (couple x y) r -> App f (lem_fun_sig_is_fun f a s Afs) x = App f (lem_fun_sig_is_fun f a s Afs) y), fun_ (equiv_comp r a rRel rEqv rD s f Afs Pr).
Lemma lem_equiv_comp_dom : forall (r a : E) (rRel : rel_sig r a a) (rEqv : equivalence r a rRel) (rD : rdom r a a rRel = a) (s f : E) (Afs : fun_sig f a s) (Pr : forall x y : E, In (couple x y) r -> App f (lem_fun_sig_is_fun f a s Afs) x = App f (lem_fun_sig_is_fun f a s Afs) y), dom (equiv_comp r a rRel rEqv rD s f Afs Pr) = quotient r a rRel rEqv rD.
Lemma lem_equiv_comp_img : forall (r a : E) (rRel : rel_sig r a a) (rEqv : equivalence r a rRel) (rD : rdom r a a rRel = a) (s f : E) (Afs : fun_sig f a s) (Pr : forall x y : E, In (couple x y) r -> App f (lem_fun_sig_is_fun f a s Afs) x = App f (lem_fun_sig_is_fun f a s Afs) y), inc (Img (equiv_comp r a rRel rEqv rD s f Afs Pr)) s.
Lemma lem_equiv_comp_sig : forall (r a : E) (rRel : rel_sig r a a) (rEqv : equivalence r a rRel) (rD : rdom r a a rRel = a) (s f : E) (Afs : fun_sig f a s) (Pr : forall x y : E, In (couple x y) r -> App f (lem_fun_sig_is_fun f a s Afs) x = App f (lem_fun_sig_is_fun f a s Afs) y), fun_sig (equiv_comp r a rRel rEqv rD s f Afs Pr) (quotient r a rRel rEqv rD) s.
Lemma lem_equiv_comp_elem : forall (r a : E) (rRel : rel_sig r a a) (rEqv : equivalence r a rRel) (rD : rdom r a a rRel = a) (s f : E) (Afs : fun_sig f a s) (Pr : forall x y : E, In (couple x y) r -> App f (lem_fun_sig_is_fun f a s Afs) x = App f (lem_fun_sig_is_fun f a s Afs) y) (x : E), In x a -> In (couple (equivClass r a rRel rEqv x) (App f (lem_fun_sig_is_fun f a s Afs) x)) (equiv_comp r a rRel rEqv rD s f Afs Pr).
Lemma lem_equiv_comp_prop : forall (r a : E) (rRel : rel_sig r a a) (rEqv : equivalence r a rRel) (rD : rdom r a a rRel = a) (s f : E) (Afs : fun_sig f a s) (Pr : forall x y : E, In (couple x y) r -> App f (lem_fun_sig_is_fun f a s Afs) x = App f (lem_fun_sig_is_fun f a s Afs) y), f = comp (projQuotient r a rRel rEqv rD) (equiv_comp r a rRel rEqv rD s f Afs Pr) a (quotient r a rRel rEqv rD) s (lem_projQuotient_sig r a rRel rEqv rD) (lem_equiv_comp_sig r a rRel rEqv rD s f Afs Pr).
Lemma lem_equiv_comp_unicite : forall (r a : E) (rRel : rel_sig r a a) (rEqv : equivalence r a rRel) (rD : rdom r a a rRel = a) (s f : E) (Afs : fun_sig f a s) (Pr : forall x y : E, In (couple x y) r -> App f (lem_fun_sig_is_fun f a s Afs) x = App f (lem_fun_sig_is_fun f a s Afs) y) (g : E) (Ags : fun_sig g (quotient r a rRel rEqv rD) s), f = comp (projQuotient r a rRel rEqv rD) g a (quotient r a rRel rEqv rD) s (lem_projQuotient_sig r a rRel rEqv rD) Ags -> g = equiv_comp r a rRel rEqv rD s f Afs Pr.
Theorem thm_ens_quotient_fond : forall (r a : E) (rRel : rel_sig r a a) (rEqv : equivalence r a rRel) (rD : rdom r a a rRel = a) (s f : E) (Afs : fun_sig f a s) (Pr : forall x y : E, In (couple x y) r -> App f (lem_fun_sig_is_fun f a s Afs) x = App f (lem_fun_sig_is_fun f a s Afs) y), exUniq _ (fun g : E => fun_sig g (quotient r a rRel rEqv rD) s /\ f = comp2 (projQuotient r a rRel rEqv rD) g a (quotient r a rRel rEqv rD) s).
Lemma lem_equiv_comp_bij_under : forall (r a : E) (rRel : rel_sig r a a) (rEqv : equivalence r a rRel) (rD : rdom r a a rRel = a) (s f : E) (Afs : fun_surj f a s) (Pr : forall x y : E, In (couple x y) r -> App f (lem_fun_sig_is_fun f a s (lem_surj_to_sig f a s Afs)) x = App f (lem_fun_sig_is_fun f a s (lem_surj_to_sig f a s Afs)) y) (Prinv : forall x y : E, App f (lem_fun_sig_is_fun f a s (lem_surj_to_sig f a s Afs)) x = App f (lem_fun_sig_is_fun f a s (lem_surj_to_sig f a s Afs)) y -> In (couple x y) r), fun_bij (equiv_comp r a rRel rEqv rD s f (lem_surj_to_sig f a s Afs) Pr) (quotient r a rRel rEqv rD) s.