Section CLOSURES.
Variable genv: Type.
Variable state: Type.
(** A one-step transition relation has the following signature. It is parameterized by a global environment, which does not change during the transition.  It relates the initial state of the transition with its final state.  The [trace] parameter captures the observable events possibly generated during the transition. *)
Variable step: state -> trace -> state -> Prop.
(** No transitions: stuck state *)
Definition nostep (s: state) : Prop :=
forall t s', ~(step s t s').
(** Zero, one or several transitions.  Also known as Kleene closure, or reflexive transitive closure. *)
Inductive star : state -> trace -> state -> Prop :=
| star_refl: forall s,
star s E0 s
| star_step: forall s1 t1 s2 t2 s3 t,
step s1 t1 s2 -> star s2 t2 s3 -> t = t1 ** t2 ->
star s1 t s3.
Proof star_step.
(** One or several transitions.  Also known as the transitive closure. *)
Inductive plus : state -> trace -> state -> Prop :=
| plus_left: forall s1 t1 s2 t2 s3 t,
step s1 t1 s2 -> star s2 t2 s3 -> t = t1 ** t2 ->
plus s1 t s3.

Lemma star_plus_trans:
forall s1 t1 s2 t2 s3 t,
star s1 t1 s2 -> plus s2 t2 s3 -> t = t1 ** t2 -> plus s1 t s3.