Definition iter T (g : T -> T -> Prop) s1 s2 := exists n, iter' g n s1 s2.(* curry the iteration *)
Definition iterc A T (g : A -> T -> A -> T -> Prop) a1 s1 a2 s2 := 
  iter (fun (a b : A * T) => g a.1 a.2 b.1 b.2) (a1, s1) (a2, s2).Implicit Type g : T -> T -> Prop.

Lemma iter_refl g s : iter g s s.