(*========================================================== VERSION AUGUST 08  TOPOLOGICAL FMAPS, HMAPS -  WITH TAGS AND EMBEDDINGS  PART 2 : SETS OF DARTS, PATHS, ORBITS  WITH NOETHERIAN INDUCTION ON A BIJECTION f WITH SIGNATURES AND MODULES  VERSION WITH set AND card: OK  NEW VERSION, COMPLETED WITH DIRECT period, REULTS ABOUT orbits AND rem: OK (August 2008) ============================================================*)
Require Export Jordan1.
Require Euclid.
Require Compare.
Require Recdef.
Require Arith.
(*========================================================= SETS OF DARTS  FOR NOETHERIAN INDUCTIVE REASONINGS ==========================================================*)
Inductive set:Set:=
Vs : set | Is : set -> dart -> set.
Fixpoint exds(s:set)(z:dart){struct s}:Prop:=
match s with
Vs => False
| Is s0 x => x=z \/ exds s0 z
end.
(* IF NO DART IS IN s, s IS Vs: *)
(* SUPPRESSION OF ALL OCCURRENCES of z: *)
Fixpoint Ds(s:set)(z:dart){struct s}:set:=
match s with
Vs => Vs
| Is s0 x =>
if eq_dart_dec x z then (Ds s0 z)
else Is (Ds s0 z) x
end.
induction s.
simpl in |- *.
tauto.
simpl in |- *.
intros x z.
elim (eq_dart_dec d x).
intro.
apply IHs.
simpl in |- *.
intros.
elim H.
intro.
rewrite <- H0.
intro.
rewrite H1 in b.
tauto.
apply IHs.
Qed.
(* "cardinal" of a (multi-)set: *)
Fixpoint card(s:set):nat:=
match s with
Vs => 0%nat
| Is s0 x =>
if exds_dec s0 x then card s0
else (1 + card s0)%nat
end.

Lemma card_Ds:forall (s:set)(z:dart),
(card (Ds s z) <= card s)%nat.