(** safety *)
Section safety.
Variable (state cont : Type).
Variable (step : state -> cont -> state -> cont -> Prop).
Notation star := (star step).
Notation stepN := (stepN step).
Definition safe s k := forall s2 k2,
star s k s2 k2 -> exists s', exists k', step s2 k2 s' k'.
Definition safeN s k := forall s2 k2 n,
stepN n s k s2 k2 -> exists s', exists k', step s2 k2 s' k'.

Lemma safety_induction R s k :
(forall s k, R s k -> exists s', exists k', step s k s' k') ->
(forall s k s' k', R s k -> step s k s' k' -> R s' k') ->
R s k -> safe s k.