(** Variant to prove the termination of Floyd's algorithm:
    - either [x m] has not entered the loop yet and [lambda-m] is decreasing
    - or bot [x m] and [x (2m)] are inside the loop and the distance between
      [x (2m)] and [x m] is decreasing
    Thus we use a lexicographic order. *)

Definition variant m := (lambda - m, dist_x2m_xm m).Definition lex x y := fst x < fst y \/ (fst x = fst y /\ snd x < snd y).

(* Specifications: *)
Theorem rec_call_is_wf : forall m, x m <> x (2*m) -> lex (variant (S m)) (variant m).