intros E B k H x xH. assert(K_POS:k>0).
apply (Q8 E x B k H xH).
induction k. assert(~0<0). apply (lt_irrefl 0).
elimtype False; intuition.
apply has_n_elements_comp with (n:=k) (B:=minus_part B x)
(C:=minus_part B x). 2:apply Refl. 2:induction k.
2:simpl. 2:auto. 2:simpl. 2:auto.
elim H. intros. inversion H0.
assert (HYP:Pred_fun B x). auto.
set (hx:=Build_subtype (P:=B)(subtype_elt:=x) HYP).
set (M:=Map_to_equal_subsets H1 (set_to_full B)).
assert (HASIND:exists i:fin (S k),seq_set x0 (M hx) =' x0 i).
apply has_index.
elim HASIND. intros i iH.
assert(G1:subtype_elt(x0 i)='x).
apply Trans with (subtype_elt(seq_set x0 (M hx))).
apply subtype_elt_comp. apply Sym. exact iH. simpl. apply Refl.
assert(F1:minus_part B x =' seq_set(Map_embed(omit x0 i))).
Opaque omit. simpl. unfold eq_part. intro z. split. intro zH.
simpl in zH. elim zH. intros zHa zHb.
assert(zHYP:Pred_fun B z). auto.
set(hz:=Build_subtype(P:=B)(subtype_elt:=z)zHYP).
elim(has_index(M hz)). intros k1 k1H.
assert(F2:~i =' k1). unfold not. intro F3. apply zHb.
apply Trans with (subtype_elt(x0 k1)).
apply Trans with (subtype_elt(seq_set x0(M hz))).
simpl. apply Refl. apply subtype_elt_comp. exact k1H.
apply Trans with (subtype_elt(x0 i)). apply subtype_elt_comp.
apply Map_compatible_prf. apply Sym. exact F3. exact G1.
elim(omit_removes' x0 F2). intros k2 k2H.
exists k2. simpl.
apply Trans with (subtype_elt(x0 k1)).
apply Trans with (subtype_elt(seq_set x0(M hz))).
simpl. apply Refl. apply subtype_elt_comp. exact k1H.
apply subtype_elt_comp. exact k2H.
intro zH. simpl in zH. elim zH. intros k2 k2H.
simpl. split. apply in_part_comp_l with (subtype_elt(omit x0 i k2)).
apply in_part_subtype_elt. exact k2H.
elim(omit_removes x0 i k2). intros k1 k1H.
assert(F4:~omit x0 i k2 =' x0 i). apply distinct_omit_removes_all.
exact H2. unfold not. intro F5.
assert(F6:subtype_elt(omit x0 i k2) =' subtype_elt(x0 i)).
apply Trans with z. apply Sym. exact k2H.
apply Trans with x. exact F5. apply Sym. exact G1.
apply F4. exact F6.
Transparent omit.
assert(F2:distinct(Map_embed(omit x0 i))).
apply Map_embed_preserves_distinct. apply omit_preserves_distinct.
exact H2.
apply seq_set_n_element_subset. exists(Map_embed(omit x0 i)).
split. exact F1. exact F2. Qed.

Lemma P7:forall(n:Nat)(G:Setoid)(A:part_set G)
(AH:seq(S n)A)(AH':full A =' seq_set AH)(AH'':distinct AH)
(c:Nat)(V:seq c(part_set G))
(Va:forall(i:fin c)(g:G),in_part g(V i)->in_part g A)
(Vb:forall(g:G)(H:in_part g A),exists i:fin c,in_part g(V i))
(Vc:forall(g:G)(H:in_part g A)(i i':fin c),
in_part g(V i)->in_part g(V i')->i =' i')
(V':seq c Nat)(V'a:forall(i:fin c),has_n_elements(V' i)(V i))
(i_:fin c)(i_H:in_part (subtype_elt(head AH))(V i_)),
forall(i:fin c),has_n_elements
(modify_seq V' i_ (V' i_ - 1) i)
((modify_seq V i_ (minus_part(V i_)(subtype_elt(head AH)))) i).