(*This lemma is used when the compiled thread steps*)

Lemma Concur_update_compiled:
forall (st1 : ThreadPool.t) (m1 m1' : mem) (Htid : ThreadPool.containsThread st1 hb)
(st2 : ThreadPool.t) (mu : meminj) (m2 : mem) (cd0 : compiler_index),
concur_match (Some cd0) mu st1 m1 st2 m2 ->
forall (s' : Clight.state) (j1' : meminj) (cd' : Injindex compiler_sim)
(j2' : meminj) (s4' : Asm.state) (j3' : meminj) (m2' : mem)
(Htid' : containsThread st2 hb)
(mcompat1: mem_compatible st1 m1)
(mcompat2: mem_compatible st2 m2),
semantics.mem_step
(restrPermMap (proj1 (mcompat1 hb Htid))) m1' ->
semantics.mem_step
(restrPermMap (proj1 (mcompat2 hb Htid'))) m2' ->
invariant st1 ->
invariant st2 ->
match_thread_compiled cd' (compose_meminj (compose_meminj j1' j2') j3')
(Krun (SState Clight.state Asm.state s')) m1'
(Krun (TState Clight.state Asm.state s4')) m2' ->
concur_match (Some cd') (compose_meminj (compose_meminj j1' j2') j3')
(updThread Htid (Krun (SState Clight.state Asm.state s'))
(getCurPerm m1', snd (getThreadR Htid))) m1'
(updThread Htid' (Krun (TState Clight.state Asm.state s4'))
(getCurPerm m2', snd (getThreadR Htid'))) m2'.