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 *)

Lemma Iter_f_Si:forall(m:fmap)(i:nat)(z:dart),
inv_hmap m -> exd m z ->
Iter (f m) (S i) z = Iter (f m) i (f m z).