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 iter2 A T (g : A -> T -> A -> T -> Prop) x1 s1 x2 s2 : g x1 s1 x2 s2 -> iterc g x1 s1 x2 s2.