intros.
red in |- *.
inversion_clear H.
inversion_clear H0.
assert (forall i : fin n, in_part (x i) B).
intro.
simpl in H.
red in H.
generalize (H (x i)).
intros (p, q).
apply q.
simpl in |- *.
exists i; apply Refl.
exists (cast_map_to_subset H0).
split.
simpl in |- *.
red in |- *.
split; intro.
simpl in |- *.
unfold subtype_image_equal in |- *.
simpl in H; red in H; simpl in H.
generalize (H (subtype_elt x0)).
intros (p, q).
assert (in_part (subtype_elt x0) B); auto with algebra.
generalize (p H3); intro.
inversion_clear H4.
exists x1.
apply Trans with (x x1); auto with algebra.
simpl in |- *.
auto with algebra.
red in |- *; intros; red in H1; red in H1.
intro.
apply (H1 _ _ H2).
simpl in H3.
red in H3; simpl in H3.
destruct x.
simpl in H3.
simpl in |- *.
auto.
Qed.

Lemma has_zero_elements_then_empty :
forall (A : Setoid) (B : part_set A),
has_n_elements 0 B -> B =' empty A in _.