(** Termination criterion. *)
Fixpoint size_worklist (w: list (positive * list positive)) : nat :=
match w with
| nil => 0%nat
| (x, succs) :: w' => (S (List.length succs) + size_worklist w')%nat
end.
Definition lt_state (s1 s2: state) : Prop :=
lex_ord lt lt (PTree_Properties.cardinal s1.(gr), size_worklist s1.(wrk))
(PTree_Properties.cardinal s2.(gr), size_worklist s2.(wrk)).

(* Specifications: *)
Lemma lt_state_wf: well_founded lt_state.
Lemma transition_decreases:
forall s s', transition s = inr _ s' -> lt_state s' s.