Section CompileNThreads.
Definition nth_index:= (list (option compiler_index)).
Definition list_lt: nth_index -> nth_index -> Prop:=
list_ord (opt_rel' (InjorderX compiler_sim)).
Local Ltac subst_sig:=
match goal with
H': existT _ _ _ = existT _ _ _ |- _ =>
eapply Eqdep.EqdepTheory.inj_pair2 in H'; subst
end.
Local Ltac inv_match0:=
match goal with
H: match_state 0 _ _ _ _ _ _ |- _ =>
inversion H; subst_sig; try clear H
end.
Admitted.

Lemma step_diagram_helper:
forall (ord: relation nth_index) tr1 tr2 m U hb cd m1' st1' tge st2 m2,
(exists (st2' : ThreadPool (Some hb)) (m2' : mem) (cd' : nth_index)
(mu' : meminj),
match_state hb cd' mu' st1' m1' st2' m2' /\
Forall2 (inject_mevent mu') tr1 tr2 /\
(machine_semantics_lemmas.thread_step_plus
(HybConcSem (Some hb) m)
tge U st2 m2 st2' m2' \/
machine_semantics_lemmas.thread_step_star
(HybConcSem (Some hb) m)
tge U st2 m2 st2' m2' /\ ord cd' cd))
<->
exists (st2' : ThreadPool (Some hb)) (m2' : mem) (cd' : nth_index)
(mu' : meminj),
match_state hb cd' mu' st1' m1' st2' m2' /\
Forall2 (inject_mevent mu') tr1 tr2 /\
(machine_semantics_lemmas.thread_step_plus
(HybConcSem (Some hb) m)
tge U st2 m2 st2' m2' \/  m2=m2' /\ st2=st2' /\ ord cd' cd).