Section step.
Variable (state cont : Type).
Variable (step : state -> cont -> state -> cont -> Prop).
Inductive star : state -> cont -> state -> cont -> Prop :=
| star_refl s k : star s k s k
| star_step s k s2 k2 s' k' :
step s k s2 k2 -> star s2 k2 s' k' -> star s k s' k'.
Inductive stepN : nat -> state -> cont -> state -> cont -> Prop :=
| stepO s k : stepN O s k s k
| stepS s k s2 k2 s' k' n :
step s k s2 k2 -> stepN n s2 k2 s' k' ->
stepN (S n) s k s' k'.
Inductive plus : state -> cont -> state -> cont -> Prop :=
| plus_left : forall s k s2 k2 s' k',
step s k s2 k2 -> star s2 k2 s' k' -> plus s k s' k'.
End step.
Implicit Arguments stepS [state step cont s k s' k' n].
Inductive prog_star : state -> prog -> state -> cont -> Prop :=
| star_prog : forall P s k s' k',
P 0%N = Some k -> star (step P) s k s' k' ->
prog_star s P s' k'.
(** interpreter is sound *)

Lemma eval_sound n k P s h s' h' :
eval n k P s h = Some (State s' h') ->
exists k', star (step P) (State s h) k (State s' h') k'.