Module Mf(M:Sigf)<:Sigf
with Definition f:=M.f
with Definition f_1:=M.f_1.
Definition f:=M.f.
Definition f_1:=M.f_1.
Definition exd_f:=M.exd_f.
Definition exd_f_1:=M.exd_f_1.
Definition bij_f:=M.bij_f.
Definition bij_f_1:=M.bij_f_1.
Definition f_1_f:=M.f_1_f.
Definition f_f_1:=M.f_f_1.
(*======================================================== ITERATIONS IN ORBITS: WITH NOETHERIAN INDUCTION =======================================================*)
(* REMAINING DARTS DURING f ITERATION ON z STARTING FROM A set sx: *)
(*======================================================== EXISTENCY PROPERTIES OF ITERATED DARTS, upb IN ORBITS...: WITH NOETHERIAN IND. =======================================================*)
(* FOR THE FOLLOWING LEMMA: *)
Definition P1
(m:fmap)(z:dart)(s:set):Prop:=
let sr := Iter_rem_aux m z s in
let n := Iter_upb_aux m z s in
~ exds sr (Iter (f m) n z).
(* THE upb_ITERATED DART BY f DOES NOT REMAIN: *)
(* THE upb_ITERATED DART BY f DOES NOT REMAIN: *)
(* THE upb_ITERATED DART BY f IS IN m: *)
(* THE upb_ITERATED DART BY f IS IN THE COMPLEMENTARY: *)
(* NOT REMAINING EQUIVALENT TO BEING IN THE COMPLEMENTARY: *)
Definition R3
(m:fmap)(z t:dart)(s:set):Prop:=
~ exds s t ->
let sr := Iter_rem_aux m z s in
~ exds sr t.
Definition R2
(m:fmap)(z:dart)(s:set):Prop:=
let sr := Iter_rem_aux m z s in
~ exds sr (Iter (f m) (ndN m - card s)%nat z).
(* OK!! BUT omega IS LONG... *)
Definition R1
(m:fmap)(z:dart)(i:nat)(s:set):Prop:=
let sr := Iter_rem_aux m z s in
let n := Iter_upb_aux m z s in
(ndN m - card s <= i <= n)%nat ->
~ exds sr (Iter (f m) i z).
(* VERY IMPORTANT: COROLLARIES: *)
(*======================================================== card PROPERTIES OF ORBITS: WITH NOETHERIAN INDUCTION =======================================================*)
(* card OF THE REMAINING / ndN IN THE fmap: *)
Definition P2
(m:fmap)(z:dart)(s:set):Prop:=
(card s < ndN m ->
card (Iter_rem_aux m z s) < ndN m)%nat.
Definition P2_bis
(m:fmap)(z:dart)(s:set):Prop:=
(card s <= ndN m ->
card (Iter_rem_aux m z s) <= ndN m)%nat.
(* THEN: *)
(* OK, IMPORTANT: COROLLARY*)
Definition Q1(m:fmap)(z:dart)(s:set):Prop:=
(card (Iter_rem_aux m z s) <= card s)%nat.
Definition Q2(m:fmap)(z:dart)(s:set):Prop:=
exds s (Iter (f m) (ndN m - card s)%nat z) ->
(card (Iter_rem_aux m z s) < card s)%nat.
(*========================================================== SOME LEMMAS, THEN RESULTS ABOUT PERIODICITY ===========================================================*)
(* L2 : *)
Definition PL2(m:fmap)(z t:dart)(x:set):Prop:=
inv_hmap m -> exd m z -> exds x t ->
let sr:= Iter_rem_aux m z x in
let zn0 := (Iter (f m) (ndN m - card x)%nat z) in
~exds sr t ->
exds x zn0 ->
~ exds (Iter_rem_aux m z (Ds x zn0)) t.
(* L3: *)
Definition PL3(m:fmap)(z t:dart)(x:set):Prop:=
inv_hmap m -> exd m z -> exds x t ->
let sr:= Iter_rem_aux m z x in
let zn0 := (Iter (f m) (ndN m - card x)%nat z) in
~exds sr t ->
exds x zn0.
(* EXTRACTION, OK: *)
Definition P4(m:fmap)(z t:dart)(s:set):Set:=
inv_hmap m -> exd m z -> exds s t ->
(card s <= ndN m)%nat ->
let sr:= Iter_rem_aux m z s in
let nr:= Iter_upb_aux m z s in
~ exds sr t ->
{i:nat | (i < nr)%nat /\ Iter (f m) i z = t}.
(* IF t IS REMOVED, THERE EXISTS i < nr, S.T. t IS THE ith ITERATED: OK *)
(* THIS APPLIES TO THE nr-th ITERATED *)
(* A RESULT OF PERIODICITY: *)
(* ITS INVERSE: *)
(* AND n TIMES: *)
(* PERIODICITY + n TIMES: *)
(* IMMEDIATE: USEFUL *)
(* IMMEDIATE: USEFUL *)
(*==========================================================  nr IS THE LOWEST PERIOD...  ===========================================================*)
Definition diff_int_aux
(m:fmap)(z:dart)(a b:nat)(t:dart): Prop:=
forall i : nat, (a <= i <= b)%nat ->
Iter (f m) i z <> t.
(* DIFFERENCE IN AN INTERVAL *)
Definition diff_int
(m:fmap)(z:dart)(a b:nat): Prop:=
forall i j : nat, (a <= i /\ i < j /\ j <= b)%nat ->
Iter (f m) i z <> Iter (f m) j z.
(* EXISTENCY Of THE z^i IN AN INTERVAL *)
Definition exds_int(m:fmap)(z:dart)(a b:nat)(s:set):Prop:=
forall i:nat, (a <= i <= b)%nat ->
exds s (Iter (f m) i z).
(* OK: *)
(* OK: *)
(* OK: ALL z^i FOR n0 <=i <= nr-1 EXIST IN s: *)
Definition P6(m:fmap)(z:dart)(s:set):Prop:=
inv_hmap m ->
(card s <= ndN m ->
let n0:= ndN m - card s in
let nr:= Iter_upb_aux m z s in
exds s (Iter (f m) n0 z) ->
exds_int m z n0 (nr - 1) s)%nat.
(* OK: LONG... *)
(* OK: FOR ALL n0 < j <= nr-1, z^n0 <> z^j: LENGHT: SYMPLIFY: TOO MUCH omegas... *)
Definition P7(m:fmap)(z:dart)(s:set):Prop:=
inv_hmap m ->
(card s <= ndN m ->
let n0:= ndN m - card s in
let nr:= Iter_upb_aux m z s in
exds s (Iter (f m) n0 z) ->
forall j:nat, n0 < j <= nr - 1 ->
Iter (f m) n0 z <> Iter (f m) j z)%nat.
(* OK: FOR ALL n0 <= i < j <= nr-1, z^i <> z^j: LENGHT: SYMPLIFY: TOO MUCH omegas... *)
Definition P8(m:fmap)(z:dart)(s:set):Prop:=
inv_hmap m ->
(card s <= ndN m ->
let n0:= ndN m - card s in
let nr:= Iter_upb_aux m z s in
exds s (Iter (f m) n0 z) ->
diff_int m z n0 (nr - 1))%nat.
(* ALL DARTS IN AN f-ORBIT ARE DISTINCT: *)
Definition diff_orb(m:fmap)(z:dart):Prop:=
let nr:= Iter_upb_aux m z (fmap_to_set m) in
(diff_int m z 0 (nr - 1))%nat.
intros.
unfold diff_orb in |- *.
generalize (nd_card m).
intro.
assert (ndN m - card (fmap_to_set m) = 0)%nat.
rewrite H1.
omega.
cut
(diff_int m z (ndN m - card (fmap_to_set m))
(Iter_upb_aux m z (fmap_to_set m) - 1))%nat.
rewrite H2.
tauto.
apply LP8.
tauto.
rewrite H1.
apply le_refl.
rewrite H2.
simpl in |- *.
generalize (exd_exds m z).
tauto.
Qed.
(* OK: nr IS A PERIOD OF THE f-ORBIT (IN FACT, IT IS THE LOWEST ONE, SINCE n0 = 0 AND ALL z^i DIFFER FROM z = z^n0 = z^0, FOR n0 < i <= nr-1) *)
(* WE HAVE: z^(i + n*p) = z^i FOR ALL i *)
(* WE HAVE: z^i = z^(i mod p) FOR ALL i *)
(* RECALL: modulo : forall n : nat, n > 0 -> forall m : nat, {r : nat | exists q : nat, m = q * n + r /\ n > r} *)
Export Compare.
(* ALL DARTS IN AN f-ORBIT HAVE THE SAME PERIOD: *)
(* UNICITY OF THE INDICE mod p: *)
(*=========================================================== PATHS in f-ORBITS: ==========================================================*)
(* REFLEXIVE EXISTENCE OF A PATH: *)
Definition expo(m:fmap)(z t:dart):Prop:=
exd m z /\ exists i:nat, Iter (f m) i z = t.
(* FOR THE DECIDABILITY: ... *)
Definition expo1
(m:fmap)(z t:dart):Prop:=
exd m z /\
let p:= Iter_upb m z in
exists j:nat, (j < p)%nat /\ Iter (f m) j z = t.
(* OK, GIVES THE "SMALLEST" INDICE j ST zj = zi: *)
Definition modulo(m:fmap)(z:dart)(i:dart)
(hi:inv_hmap m)(he:exd m z):nat.
(* REFLEXIVITY: *)
(* TRANSITIVITY: *)
(* SYMMETRY: OK!! *)
(* THERE EXISTS j <= n S.T. zj = t: INDUCTIVE DEF. *)
Fixpoint ex_j
(m:fmap)(z t:dart)(n:nat){struct n}:Prop:=
match n with
0%nat => z = t
| S n0 => Iter (f m) n z = t \/ ex_j m z t n0
end.
(* THERE EXISTS j <= n S.T. zj = t: COMMON DEF. EQUIVALENT TO INDUCTIVE DEF.: *)
(* t IS A ITERATED SUCC OF z IN AN ORBIT IS EQUIVALENT TO: there exists j <= p-1 s.t. zj = t: *)
(* DECIDABILITY OF expo1: *)
(* DECIDABILITY: OK!! *)
(* ALL DARTS OF AN ORBIT HAVE THE SAME period: *)
Open Scope nat_scope.
(* SUMMARY: nr IS THE LOWEST nat > 0 S.T. z^nr = z AND 0 < i < nr -> z^i <> z: OK *)
(*======================================================= COMPLEMENTS FOR cell degrees (July 08) =======================================================*)
Open Scope nat_scope.
(* FOLLOWING: *)
(* degree OF A CELL: OK! *)
Function degree_aux(m:fmap)(z:dart)(n:nat)
{measure (fun i:nat => ndN m - i) n}:nat:=
if le_lt_dec n (ndN m)
then if eq_dart_dec z (Iter (f m) n z) then n
else if eq_nat_dec n (ndN m) then (ndN m) + 1
else degree_aux m z (n+1)
else (ndN m) + 1.
Definition P_degree_diff(m:fmap)(z:dart)(n1 n2:nat):
Prop:= inv_hmap m -> exd m z -> 0 < n1 ->
forall i:nat, n1 <= i < n2 -> Iter (f m) i z <> z.
(* OK: *)
Definition P_degree_per(m:fmap)(z:dart)(n1 n2:nat):
Prop:= inv_hmap m -> exd m z -> 0 < n1 -> n2 <= ndN m ->
Iter (f m) n2 z = z.
(* SUMMARY: OK *)
(* OK!! *)
(* IMMEDIATELY, REPLACING Iter_upb by degree: *)
Open Scope R_scope.
(*=========================================================== COMPLEMENTS FOR orbits AND rem , BOUNDS (AUGUST 08) ==========================================================*)
(* ANY orbit IS INCLUDED IN THE hmap SUPPORT: OK: *)

Lemma exds_orb_exd:forall(m:fmap)(x z:dart),
inv_hmap m -> exd m x ->
exds (Iter_orb m x) z -> exd m z.