induction n.
intros.
destruct m as [| n]; simpl in |- *.
auto.
inversion_clear H0.
set (c := head x) in *.
assert (B =' empty A in _).
generalize (n_element_subset_sequence H); intro p.
inversion_clear p.
inversion_clear H0.
apply Trans with (seq_set x0); auto with algebra.
simpl in H1; red in H1.
elim (H1 (C c)).
intros.
assert (in_part (subtype_elt c) C); auto with algebra.
generalize (H4 H5).
intros.
assert (in_part (C c) (empty A)).
apply in_part_comp_r with B; auto with algebra.
simpl in H7.
contradiction.
intros B HB.
induction m.
intros.
inversion_clear HB.
set (b := head x) in *.
assert (C =' empty A in _).
generalize (n_element_subset_sequence H); intro p.
inversion_clear p.
inversion_clear H2.
apply Trans with (seq_set x0); auto with algebra.
simpl in H0; red in H0.
elim (H0 (B b)).
intros.
assert (in_part (subtype_elt b) B); auto with algebra.
generalize (H3 H5).
intros.
assert (in_part (B b) (empty A)).
apply in_part_comp_r with C; auto with algebra.
simpl in H7.
contradiction.
generalize (n_element_subset_sequence HB); intro p.
inversion_clear p.
set (B' := seq_set (Seqtl x)) in *.
assert (distinct (Seqtl x)).
inversion_clear H.
apply Seqtl_preserves_distinct; auto with algebra.
assert (has_n_elements n B').
apply seq_set_n_element_subset.
exists (Seqtl x); auto with algebra.
intros.
simpl in H3.
red in H3.
elim (H3 (head x)).
intros.
assert (in_part (head x) B).
clear H3 H4 H5; inversion_clear H.
simpl in H3.
red in H3.
simpl in H3.
elim (H3 (head x)); intros.
unfold head in |- *.
apply H5; auto with algebra.
exists (Build_finiteT (lt_O_Sn n)).
unfold head in |- *; auto with algebra.
generalize (H4 H6).
intro.
clear H4 H5 H6.
rename H3 into HBC.
generalize (n_element_subset_sequence H2).
intro p; inversion_clear p.
inversion_clear H3.
assert (in_part (head x) (seq_set x0)).
apply in_part_comp_r with C; auto with algebra.
simpl in H3.
inversion_clear H3.
set (C' := seq_set (omit x0 x1)) in *.
assert (has_n_elements m C').
apply seq_set_n_element_subset.
exists (omit x0 x1); split; auto with algebra.
generalize omit_preserves_distinct.
intro p.
apply (p _ _ x0 H5 x1).
simpl in |- *.
apply f_equal with (f := S); auto with algebra.
apply (IHn _ H1 _ _ H3).
assert (seq_set x =' seq_set x0 in _).
inversion_clear H.
apply Trans with B; auto with algebra.
apply Trans with C; auto with algebra.
unfold B', C' in |- *.
inversion_clear H.
clear H3 C' H4 HBC H7 H2 C H1 H0 B' H9 IHm HB B IHn.
move H10 after x1.
rename x1 into i.
change (eq_part (seq_set (Seqtl x)) (seq_set (omit x0 i))) in |- *.
red in |- *.
intro a; split; intros.
assert (~ a =' x0 i in _).
assert (~ a =' head x in _).
simpl in H.
inversion_clear H.
destruct x1.
intro.
unfold head in H.
assert
(x (Build_finiteT (lt_O_Sn n)) ='
x (Build_finiteT (lt_n_S index n in_range_prf)) in _).
apply Trans with a; auto with algebra.
red in H10.
red in H10.
apply
H10
with
(Build_finiteT (lt_O_Sn n))
(Build_finiteT (lt_n_S index n in_range_prf));
auto with algebra.
simpl in |- *.
auto.
intro; red in H0; (apply H0; auto with algebra).
apply Trans with (x0 i); auto with algebra.
assert (in_part a (seq_set x0)).
assert (in_part a (seq_set x)).
simpl in H.
inversion_clear H.
destruct x1.
apply in_part_comp_l with (x (Build_finiteT (lt_n_S index n in_range_prf)));
auto with algebra.
simpl in |- *.
exists (Build_finiteT (lt_n_S index n in_range_prf)); auto with algebra.
apply in_part_comp_r with (seq_set x); auto with algebra.
simpl in H1.
inversion_clear H1.
rename x1 into q.
assert (~ i =' q in fin _).
intro; red in H0; apply H0.
apply Trans with (x0 q); auto with algebra.
elim (omit_removes' x0 H1).
intros.
apply in_part_comp_l with (x0 q); auto with algebra.
apply in_part_comp_l with (omit x0 i x1); auto with algebra.
simpl in |- *; exists x1; auto with algebra.
Opaque omit.
simpl in H.
inversion_clear H.
rename x1 into q.
assert (~ a =' x0 i in _).
intro.
generalize (distinct_omit_removes_all H5 (i:=i) (j:=q)); intro p; red in p.
apply p.
apply Trans with a; auto with algebra.
assert (~ a =' head x in _).
red in H; intro; apply H.
apply Trans with (head x); auto with algebra.
assert (in_part a (seq_set x0)).
apply in_part_comp_l with (omit x0 i q); auto with algebra.
apply omit_seq_in_seq_set; auto with algebra.
assert (in_part a (seq_set x)).
apply in_part_comp_r with (seq_set x0); auto with algebra.
simpl in H3; simpl in |- *.
inversion_clear H3.
destruct x1.
destruct index as [| n0].
apply False_ind; auto with algebra.
red in H1; apply H1.
unfold head in |- *;
(apply Trans with (x (Build_finiteT in_range_prf)); auto with algebra);
simpl in |- *.
exists (Build_finiteT (lt_S_n _ _ in_range_prf)).
apply Trans with (x (Build_finiteT in_range_prf)); auto with algebra.
Qed.

(* Specifications: *)
Lemma has_extra_element :
forall (A : Setoid) (B C : part_set A) (m n : Nat),
has_n_elements n B ->
has_n_elements m C -> m < n -> exists a : A, in_part a B /\ ~ in_part a C.