Section Maps1_2.
Comments "We define now injections, surjections and bijections.".
Variable A B : Setoid.
Definition injective (f : MAP A B) : Prop :=
forall x y : A, Equal (f x) (f y) -> Equal x y.
Definition surjective (f : MAP A B) : Prop :=
forall y : B, exists x : A, Equal y (f x).
Definition bijective (f : MAP A B) : Prop := injective f /\ surjective f.
End Maps1_2.
Comments "These definitions are coherent with equality of maps:".
unfold injective in |- *.
intros A B f f' H' H'0 x y H'1; try assumption.
apply H'.
apply Trans with (Ap f' x); auto with algebra.
apply Trans with (Ap f' y); auto with algebra.
Qed.
unfold surjective in |- *.
intros A B f f' H' H'0 y; try assumption.
elim (H' y); intros x E; try exact E.
exists x; try assumption.
apply Trans with (Ap f x); auto with algebra.
Qed.
unfold bijective in |- *.
intros A B f f' H' H'0; try assumption.
split; [ try assumption | idtac ].
elim H'; intros H'1 H'2; try exact H'1; clear H'.
apply injective_comp with (f := f); auto with algebra.
elim H'; intros H'1 H'2; try exact H'2; clear H'.
apply surjective_comp with (f := f); auto with algebra.
Qed.
Comments "Trivialities:".
intros A B f H'; red in H'; auto with algebra.
elim H'; auto with algebra.
Qed.
Hint Resolve bijective_injective: algebra.
intros A B f H'; red in H'; auto with algebra.
elim H'; auto with algebra.
Qed.
Hint Resolve bijective_surjective: algebra.
Set Strict Implicit.
Unset Implicit Arguments.
Definition surj_set_quo :
forall (E : Setoid) (R : Relation E) (p : equivalence R),
MAP E (quotient E R p).
intros E R p; try assumption.
apply (Build_Map (A:=E) (B:=quotient E R p) (Ap:=fun x : E => x)).
generalize p; clear p.
elim R.
intros Rel_fun' Rel_compatible_prf0 p; try assumption.
red in |- *.
red in Rel_compatible_prf0.
intros x y H'; try assumption.
simpl in |- *.
unfold app_rel in Rel_compatible_prf0.
apply Rel_compatible_prf0 with (x := x) (y := x); auto with algebra.
elim p.
intros H'0 H'1; try assumption.
simpl in H'0.
red in H'0.
unfold app_rel in H'0.
auto with algebra.
Defined.
Set Implicit Arguments.
Unset Strict Implicit.

Lemma surj_set_quo_surjective :
forall (E : Setoid) (R : Relation E) (p : equivalence R),
surjective (surj_set_quo E R p).