(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(** %\subsection*{ support :  finite\_subsets.v }%*)
Set Implicit Arguments.
Unset Strict Implicit.
From Algebra Require Export Diff.
From Algebra Require Export Singleton.
Require Export cast_between_subsets.
Require Export empty.
Require Export Classical_Prop.
(** - A set is finite if we can list its elements (possibly with duplicates in the list)  %\label{isfiniteset}% *)
Definition is_finite_set (A : Setoid) :=
exists n : Nat, (exists v : seq n A, full A =' seq_set v in _).
(** - For subsets, the following notion is more useful as it removes one one layer of taking subsets: *)
Definition is_finite_subset (A : Setoid) (B : part_set A) :=
exists n : Nat, (exists v : seq n A, B =' seq_set v in _).
red in |- *.
intros.
red in H0.
inversion H0.
inversion H1.
exists x.
exists x0.
apply Trans with B; auto with algebra.
Qed.
(** - There is no corresponding is_finite_set_comp, for there is no 'master' setoid wherein two Setoids can be compared. *)
Hint Resolve is_finite_subset_comp: algebra.

Lemma is_finite_subset_then_is_finite :
forall (A : Setoid) (B : part_set A), is_finite_subset B -> is_finite_set B.