(** - 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).(** %\label{castmaptosubset}% *)
Definition cast_map_to_subset :
  forall (A B : Setoid) (v : MAP B A) (W : part_set A),
  (forall i : B, in_part (v i) W) -> MAP B W.

(* Specifications: *)
Lemma cast_seq_nice : forall (A B : Setoid) (v : MAP B A) (W : part_set A) (H : forall i : B, in_part (v i) W) (P : Predicate (MAP B A)), Pred_fun P v -> Pred_fun P (Map_embed (cast_map_to_subset H)).
Lemma cast_subset_seq_nice : forall (A D : Setoid) (B C : part_set A) (v : MAP D B) (H : forall i : D, in_part (Map_embed v i) C) (P : Predicate (MAP D A)), Pred_fun P (Map_embed v) -> Pred_fun P (Map_embed (cast_map_to_subset H)).
Lemma cast_respects_predicates_per_elt : forall (A D : Setoid) (B C : part_set A) (v : MAP D B) (P : Predicate A) (H : forall i : D, in_part (Map_embed v i) C) (i : D), Pred_fun P (Map_embed v i) -> Pred_fun P (Map_embed (cast_map_to_subset H) i).
Lemma cast_respects_all_elt_predicates : forall (A D : Setoid) (B C : part_set A) (v : MAP D B) (P : Predicate A) (H : forall i : D, in_part (Map_embed v i) C), (forall i : D, Pred_fun P (Map_embed v i)) -> forall j : D, Pred_fun P (Map_embed (cast_map_to_subset H) j).