intros. unfold has_n_elements. elim H. intros v vH. elim vH.
clear H vH. intros vH1 vH2.
assert(H:forall i:fin n,in_part(v i)(full G)). simpl. auto.
exists(cast_map_to_subset H). split. simpl. unfold eq_part.
intro g. split. simpl. intro T. clear T.
elim(has_index(Map_to_equal_subsets vH1(Id(full G))g)).
intros i iH. exists i. unfold subtype_image_equal.
apply Trans with(seq_set v(Map_to_equal_subsets vH1
(Id(full G))g)). simpl.
apply Sym. apply subtype_elt_eats_map_between_equal_subsets.
apply Trans with(v i). exact iH. apply Sym.
apply cast_doesn't_change. simpl. auto.
unfold distinct. intros i j H1. unfold distinct in vH2.
unfold not. intro H2. apply(vH2 i j). exact H1.
apply Trans with(subtype_elt(cast_map_to_subset H i)).
simpl. apply Sym. apply cast_doesn't_change.
apply Trans with(subtype_elt(cast_map_to_subset H j)).
exact H2. simpl. apply cast_doesn't_change. Qed.
Definition Hx_s(G:group)(S:Setoid)(f:Map(cart G S)S)
(LA1:forall(s:S),f(couple(monoid_unit G)s)=' s)
(LA2:forall(g1 g2:G)(s:S),
f(couple(g1+' g2)s)=' f(couple g1(f(couple g2 s))))
(p:S)(x:Orb7_s G S f LA1 LA2 p):part_set G.
intros. apply(Build_Predicate(Pred_fun:=
fun g':G=>f(couple g' p)=' subtype_elt x)).
unfold pred_compatible. intros g1 g2 H H1.
apply Trans with(f(couple g1 p)). apply Map_compatible_prf.
apply couple_comp. exact H1. apply Refl. exact H. Defined.

Lemma Hxcomp(G:group)(S:Setoid)(f:Map(cart G S)S)
(LA1:forall(s:S),f(couple(monoid_unit G)s)=' s)
(LA2:forall(g1 g2:G)(s:S),
f(couple(g1+' g2)s)=' f(couple g1(f(couple g2 s))))
(p:S)(x1 x2:Orb7_s G S f LA1 LA2 p)(H:x1=' x2):
Hx_s G S f LA1 LA2 p x1 =' Hx_s G S f LA1 LA2 p x2.