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.

(* Specifications: *)
Lemma iter_refl g s : iter g s s.
Lemma iter_trans g s1 s2 s3 : iter g s1 s2 -> iter g s2 s3 -> iter g s1 s3.
Lemma iter'_sub g g' n s1 s2 : (forall s1 s2, g s1 s2 -> g' s1 s2) -> iter' g n s1 s2 -> iter' g' n s1 s2.
Lemma iter_sub g g' s1 s2 : (forall s1 s2, g s1 s2 -> g' s1 s2) -> iter g s1 s2 -> iter g' s1 s2.
Lemma iter1 g s1 s2 : g s1 s2 -> iter g s1 s2.
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.
Lemma emptyset_eqP : Equality.axiom (fun _ _ : Empty_set => true).