Section fonctions2.
Variable E : Ensf.
Variable F : Ensf.
Variable f : Elt -> Elt.
Hint Unfold application.
split.
auto.
intros.
cut (exists y : Elt, dans y E /\ x = f y :>Elt).
intro temp; elim temp; clear temp.
intro. intuition.
prolog [ ex_intro2 ] 4.
(*Intros y temp; Elim temp; Clear temp ; Intros dans_y egal_y. Exists y;Auto.*)
auto.
Qed.
Hint Resolve is_epi_f_over_image.
auto.
Qed.
Let invf := inv E F f.
Hint Unfold invf.
intros.
red in |- *.
intros x y dans_x dans_y egal_inv.
replace x with (f (inv E F f x)).
replace y with (f (inv E F f y)).
apply (f_equal (A:=Elt) (B:=Elt)); assumption.
auto.
auto.
Qed.
unfold invf in |- *.
intro is_iso_f.
split.
auto. (* Hint : dans_inv_f*)
(* Hints Resolve inv1 .*)
intros x dans_x.
exists (f x); [ apply sym_equal; auto | elim is_iso_f ].
intros is_epi_f. elim is_epi_f.
auto.
Qed.
Let wef := Word_ext f.
intro Hyp.
red in |- *.
intros x inmon; elim inmon; clear inmon.
auto.
intros.
replace (wef (cons e w)) with (cons (f e) (wef w)); auto.
Qed.
Hint Resolve application_imp_application_words.
intro Hyp.
red in |- *.
simple induction x.
intros.
apply sym_equal.
apply wef_nil with f.
auto.
intros x0 w0. intros.
cut
(exists x : Elt,
(exists2 w : Word, cons x w = y & f x = f x0 /\ wef w = wef w0)).
intro temp; elim temp; clear temp.
intro e.
intro temp; elim temp; clear temp.
intro r.
intros y_egal temp.
elim temp; clear temp.
intros.
rewrite <- y_egal.
apply cons_cons.
apply Hyp. (*; Auto.*)
apply inmonoid_cons_inv2 with w0; assumption.
apply inmonoid_cons_inv2 with r; rewrite y_egal; assumption.
auto.
apply H.
apply (inmonoid_cons_inv E w0 x0); assumption.
apply (inmonoid_cons_inv E r e); rewrite y_egal; assumption.
auto.
(*Resolution du Cut*)
unfold wef in |- *.
(*	Apply wef_cons.*)
auto.
Qed.
Hint Resolve is_mono_f_imp_is_mono_words.

Lemma is_epi_f_imp_is_epi_words : is_epi E F f -> is_epi_words E F wef.