(** ** Forward simulation diagrams. *)
(** Various simulation diagrams that imply forward simulation *)
Section FORWARD_SIMU_DIAGRAMS.
Variable L1: semantics.
Variable L2: semantics.
Hypothesis public_preserved:
forall id, Senv.public_symbol (symbolenv L2) id = Senv.public_symbol (symbolenv L1) id.
Variable match_states: state L1 -> state L2 -> Prop.
Hypothesis match_start_stacks:
forall s1 f arg m0, start_stack L1 m0 s1 f arg  ->
exists s2, start_stack L2 m0 s2 f arg /\ match_states s1 s2.
Hypothesis match_initial_states:
forall s1, initial_state L1 s1  ->
exists s2, initial_state L2 s2 /\ match_states s1 s2.
Hypothesis match_final_states:
forall s1 s2 r,
match_states s1 s2 ->
final_state L1 s1 r ->
final_state L2 s2 r.
(** Simulation when one transition in the first program corresponds to zero, one or several transitions in the second program. However, there is no stuttering: infinitely many transitions in the source program must correspond to infinitely many transitions in the second program. *)
Section SIMULATION_STAR_WF.
(** [order] is a well-founded ordering associated with states of the first semantics.  Stuttering steps must correspond to states that decrease w.r.t. [order]. *)
Variable order: state L1 -> state L1 -> Prop.
Hypothesis order_wf: well_founded order.
Hypothesis simulation:
forall s1 t s1', Step L1 s1 t s1' ->
forall s2, match_states s1 s2 ->
exists s2',
(Plus L2 s2 t s2' \/ (Star L2 s2 t s2' /\ order s1' s1))
/\ match_states s1' s2'.

(* Specifications: *)
Lemma forward_simulation_star_wf: forward_simulation L1 L2.
Notation match_states':=
(fun (idx s1 : state L1) (s2 : state L2) => idx = s1 /\ match_states s1 s2).
Lemma fsim_properties_star_wf:
fsim_properties L1 L2 _ order match_states'.