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: genv -> state -> trace -> state -> Prop.
(** No transitions: stuck state *)
Definition nostep (ge: genv) (s: state) : Prop :=
forall t s', ~(step ge s t s').
(** Zero, one or several transitions.  Also known as Kleene closure, or reflexive transitive closure. *)
Inductive star (ge: genv): state -> trace -> state -> Prop :=
| star_refl: forall s,
star ge s E0 s
| star_step: forall s1 t1 s2 t2 s3 t,
step ge s1 t1 s2 -> star ge s2 t2 s3 -> t = t1 ** t2 ->
star ge s1 t s3.
Proof star_step.
(** One or several transitions.  Also known as the transitive closure. *)
Inductive plus (ge: genv): state -> trace -> state -> Prop :=
| plus_left: forall s1 t1 s2 t2 s3 t,
step ge s1 t1 s2 -> star ge s2 t2 s3 -> t = t1 ** t2 ->
plus ge s1 t s3.

Lemma plus_four:
forall ge s1 t1 s2 t2 s3 t3 s4 t4 s5 t,
step ge s1 t1 s2 -> step ge s2 t2 s3 ->
step ge s3 t3 s4 -> step ge s4 t4 s5 -> t = t1 ** t2 ** t3 ** t4 ->
plus ge s1 t s5.