Module ConcurCC_correct:= (Concurrent_correctness CC_correct Args).
(*USed to be start_stack*)
Definition Clight_init_state (p: Clight.program):=
Clight.initial_state p.
Definition Asm_init_state (p: Asm.program):=
Asm.initial_state  p.
Notation valid Sem:=
(valid dryResources Sem OrdinalPool.OrdinalThreadPool).
Definition opt_init_mem_source (p : Clight.program):=
(Genv.init_mem (Ctypes.program_of_program p)).
Definition opt_init_mem_target {F V} (tp:AST.program F V ):=
(Genv.init_mem tp).

Lemma csafety_step:
forall (p : Clight.program) (tp : Asm.program) (asm_genv_safety : Asm_core.safe_genv the_ge),
let SemSource:= (ClightSemanticsForMachines.ClightSem (Clight.globalenv p)) in
let SemTarget:= @X86Sem tp asm_genv_safety in
forall (U : schedule) (init_mem_source' : Memory.Mem.mem)
(j : Values.Val.meminj) (c : Asm.state)
(C_source : OrdinalPool.t(Sem:=SemSource))
(C_target : OrdinalPool.t) tr
(SIM : HybridMachine_simulation (ClightConcurSem (opt_init_mem_source p))
(AsmConcurSem (opt_init_mem_target tp))) (cd : index SIM),
match_state SIM cd j C_source init_mem_source' C_target
(Asm.get_mem c) ->
(forall (n : nat) U,
(valid SemSource) (tr, C_source, init_mem_source') U ->
HybridCoarseMachine.csafe(Sem:=SemSource)
(resources:=HybridMachine.DryHybridMachine.dryResources)
(ThreadPool:= threadPool.OrdinalPool.OrdinalThreadPool(Sem:=SemSource))
(machineSig:= HybridMachine.DryHybridMachine.DryHybridMachineSig)
(U, tr, C_source)
init_mem_source' n) ->
forall (n : nat) U ,
(valid SemTarget) (tr, C_target, Asm.get_mem c) U ->
HybridCoarseMachine.csafe (Sem:=SemTarget)
(resources:=HybridMachine.DryHybridMachine.dryResources)
(ThreadPool:= threadPool.OrdinalPool.OrdinalThreadPool(Sem:=SemTarget))
(machineSig:= HybridMachine.DryHybridMachine.DryHybridMachineSig)
(U, tr, C_target)
(Asm.get_mem c) n.