intros A B f g H'; try assumption.
apply comp_injective with A g; auto with algebra.
apply injective_comp with (f := Id A); auto with algebra.
Qed.

(* Specifications: *)
Lemma comp_is_id_then_surjective :
forall (A B : Setoid) (f : MAP A B) (g : MAP B A),
Equal (comp_map_map f g) (Id B) -> surjective f.