Fixpoint rel_iter n :=
    match n with
      | 0   => eq
      | S n => fun x z => exists y, R x y /\ rel_iter n y z
    end.Fact rel_iter_plus n m x y : rel_iter (n+m) x y <-> exists a, rel_iter n x a /\ rel_iter m a y.Fact rel_iter_1 x y : rel_iter 1 x y <-> R x y.Fact rel_iter_S n x y : rel_iter (S n) x y <-> exists a, rel_iter n x a /\ R a y.Fact rel_iter_sequence n x y : rel_iter n x y <-> exists f, f 0 = x /\ f n = y /\ forall i, i < n -> R (f i) (f (S i)).Notation power := (mscal mult 1).Definition is_digit c q i y := y < q /\ exists a b, c = (a*q+y)*power i q+b /\ b < power i q.Fact is_digit_fun c q i x y : is_digit c q i x -> is_digit c q i y -> x = y.Definition is_seq (R : nat -> nat -> Prop) c q n := forall i, i < n -> exists y y', is_digit c q i y /\ is_digit c q (1+i) y' /\ R y y'.(** q represents a basis big enough so that all the sequence x=x0 R x1 R ... R xn = y can be
      encoded as the digits of c in base q 

      Since the growth of R is controlled by k, we can find a simple diophantine constraint
      on x n q such that q is big enough. *)

  Definition rel_iter_bound n x y := exists q c, x*power n (S k) < q /\ is_seq R c q n /\ is_digit c q 0 x /\ is_digit c q n y.

Lemma rel_iter_bound_iter n x y : rel_iter_bound n x y -> rel_iter R n x y.