intros.
unfold has_at_least_n_elements in H.
unfold has_at_most_n_elements in |- *.
induction n.
exists 0; split; auto.
red in |- *.
exists (empty_seq A).
split.
simpl in |- *.
red in |- *.
intro a; split; simpl in |- *; auto.
intros _.
apply False_ind; auto with algebra.
apply H.
exists (const_seq 1 a).
intros; intro.
auto with algebra.
red in |- *.
intros.
auto with algebra.
case
(classic
(exists v : seq (S n) A,
(forall i j : fin (S n), ~ i =' j in _ -> ~ v i =' v j in _))).
intro; exists (S n).
split; auto.
red in |- *.
inversion_clear H0.
rename x into aa.
exists aa.
split; auto.
simpl in |- *; red in |- *; simpl in |- *.
intro a; split; auto; intros _.
apply NNPP; intro; apply H.
exists (a;; aa).
red in |- *.
destruct i; destruct j.
destruct index as [| n0];
[ destruct index0 as [| n0] | destruct index0 as [| n1] ].
simpl in |- *.
intuition.
simpl in |- *.
intros _.
intro; apply H0.
exists (Build_finiteT (lt_S_n n0 (S n) in_range_prf0)); auto with algebra.
simpl in |- *.
intros _.
intro; apply H0.
exists (Build_finiteT (lt_S_n n0 (S n) in_range_prf)).
apply Sym; auto with algebra.
simpl in |- *.
intro.
apply
(H1 (Build_finiteT (lt_S_n n0 (S n) in_range_prf))
(Build_finiteT (lt_S_n n1 (S n) in_range_prf0)));
auto with algebra.
intro.
generalize (IHn H0); intro p; inversion_clear p.
exists x.
inversion_clear H1; split; auto.
Qed.

Lemma has_n_elements_by_at_least_at_most :
forall (A : Setoid) (n : Nat),
has_at_least_n_elements n A ->
has_at_most_n_elements n A -> has_n_elements n A.