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.
intro temp; elim temp; clear temp.
intro application_f.
intro is_epi_f.
split.
auto.
simple induction x; clear x.
exists nil; auto.
intros x w Hyp inmonoid_F_cons.
cut (exists2 y : Word, w = wef y & inmonoid E y). (*1*)
intro temp; elim temp; clear temp.
intros y1 y1_egal inmonoid_y1.
cut (exists2 x_ant : Elt, x = f x_ant & dans x_ant E). (*2*)
intro temp; elim temp; clear temp.
intros x_ant x_egal dans_x_ant.
exists (cons x_ant y1).
unfold wef, Word_ext in |- *.
auto.
auto. (* inmonoid_cons *)
(*Cut2*)
prolog [ inmonoid_cons_inv2 ] 3.     (*Apply is_epi_f.
Apply inmonoid_cons_inv2 with w; Assumption.*)
(*Cut1*)
prolog [ inmonoid_cons_inv ] 3. (*Apply Hyp;
Apply inmonoid_cons_inv with x; Assumption.*)
Qed.
Hint Resolve is_epi_f_imp_is_epi_words.

Lemma is_iso_f_imp_is_iso_words : is_iso E F f -> is_iso_words E F wef.