Section Orbit.
Variables (T : finType) (f : T -> T).
Definition order x := #|fconnect f x|.
Definition orbit x := traject f x (order x).
Definition findex x y := index y (orbit x).
Definition finv x := iter (order x).-1 f x.

(* Specifications: *)
Lemma fconnect_iter n x : fconnect f x (iter n f x).
Lemma fconnect1 x : fconnect f x (f x).
Lemma fconnect_orbit x y : fconnect f x y = (y \in orbit x).
Lemma orbit_uniq x : uniq (orbit x).
Lemma findex_max x y : fconnect f x y -> findex x y < order x.
Lemma iter_findex x y : fconnect f x y -> iter (findex x y) f x = y.
Lemma findex0 x : findex x x = 0.
Section Loop.