Section FORWARD_TO_BACKWARD.
Context L1 L2 index order match_states (FS: fsim_properties L1 L2 index order match_states).
Hypothesis L1_receptive: receptive L1.
Hypothesis L2_determinate: determinate L2.
(** Exploiting forward simulation *)
Inductive f2b_transitions: state L1 -> state L2 -> Prop :=
| f2b_trans_final: forall s1 s2 s1' r,
Star L1 s1 E0 s1' ->
final_state L1 s1' r ->
final_state L2 s2 r ->
f2b_transitions s1 s2
| f2b_trans_step: forall s1 s2 s1' t s1'' s2' i' i'',
Star L1 s1 E0 s1' ->
Step L1 s1' t s1'' ->
Plus L2 s2 t s2' ->
match_states i' s1' s2 ->
match_states i'' s1'' s2' ->
f2b_transitions s1 s2.
(** Exploiting determinacy *)
Remark silent_or_not_silent:
forall t, t = E0 \/ t <> E0.
Remark not_silent_length:
forall t1 t2, (length (t1 ** t2) <= 1)%nat -> t1 = E0 \/ t2 = E0.
(** Orders *)
Inductive f2b_index : Type :=
| F2BI_before (n: nat)
| F2BI_after (n: nat).
Inductive f2b_order: f2b_index -> f2b_index -> Prop :=
| f2b_order_before: forall n n',
(n' < n)%nat ->
f2b_order (F2BI_before n') (F2BI_before n)
| f2b_order_after: forall n n',
(n' < n)%nat ->
f2b_order (F2BI_after n') (F2BI_after n)
| f2b_order_switch: forall n n',
f2b_order (F2BI_before n') (F2BI_after n).
(** Constructing the backward simulation *)
Inductive f2b_match_states: f2b_index -> state L1 -> state L2 -> Prop :=
| f2b_match_at: forall i s1 s2,
match_states i s1 s2 ->
f2b_match_states (F2BI_after O) s1 s2
| f2b_match_before: forall s1 t s1' s2b s2 n s2a i,
Step L1 s1 t s1' ->  t <> E0 ->
Star L2 s2b E0 s2 ->
starN (step L2) n s2 t s2a ->
match_states i s1 s2b ->
f2b_match_states (F2BI_before n) s1 s2
| f2b_match_after: forall n s2 s2a s1 i,
starN (step L2) (S n) s2 E0 s2a ->
match_states i s1 s2a ->
f2b_match_states (F2BI_after (S n)) s1 s2.
Remark f2b_match_after':
forall n s2 s2a s1 i,
starN (step L2) n s2 E0 s2a ->
match_states i s1 s2a ->
f2b_match_states (F2BI_after n) s1 s2.
(** Backward simulation of L2 steps *)

Lemma f2b_simulation_step:
forall s2 t s2', Step L2 s2 t s2' ->
forall i s1, f2b_match_states i s1 s2 -> safe L1 s1 ->
exists i', exists s1',
(Plus L1 s1 t s1' \/ (Star L1 s1 t s1' /\ f2b_order i' i))
/\ f2b_match_states i' s1' s2'.