unfold Map_to_equal_subsets in |- *; simpl in |- *; unfold Map_eq in |- *;
simpl in |- *; unfold subtype_image_equal in |- *;
simpl in |- *.
intros.
apply subtype_elt_comp.
apply map_between_equal_subsets_inj with Y H H'; auto with algebra.
simpl in |- *; red in |- *; simpl in |- *.
auto.
Qed.
(** - if $\forall b\in B, f(b)\in W\subset A$ for $f:B\to A$ then $f$ can be seen as $f:B\to W$. This is done by cast_map_to_subset. *)
Definition cast_to_subset_fun :
forall (A B : Setoid) (v : MAP B A) (W : part_set A),
(forall i : B, in_part (v i) W) -> (B -> W:Type).
intros A B v.
elim v.
intros vseq vprf; intros.
generalize X; clear X.
simpl in |- *.
exact (fun i : B => Build_subtype (H i)).
Defined.

Lemma cast_doesn't_change :
forall (A B : Setoid) (v : MAP B A) (W : part_set A)
(H : forall i : B, in_part (v i) W) (i : B),
subtype_elt (cast_to_subset_fun H i) =' v i in _.