Section CoreSem_to_semantics.
Variables (F C V:Type).
Let genv  := Genv.t F V.
(*HERE we used to specialize type D to program variables Variable (Sem: CoreSemantics genv C mem (list (ident * globdef F V))). *)
Variable (Sem: CoreSemantics genv C mem).
Let state := (C * mem)%type.
Inductive step (ge:genv) : state -> trace -> state -> Prop :=
| step_corestep : forall c m c' m',
corestep Sem ge c m c' m' ->
step ge (c,m) E0 (c',m')
| step_ext_step : forall c m c' m' ef args tr ret,
at_external Sem c = Some (ef,ef_sig ef,args) ->
external_call ef ge args m tr ret m' ->
after_external Sem (Some ret) c = Some c' ->
step ge (c,m) tr (c',m').
Variable (prog:AST.program F V).
Definition main_sig : signature := mksignature (nil) (Some AST.Tint).
Definition initial_state (st:state) : Prop :=
exists b, exists vals,
Forall2 (val_inject (Mem.flat_inj (Mem.nextblock (snd st)))) vals vals /\
Forall2 Val.has_type vals (sig_args main_sig) /\
Genv.find_symbol (Genv.globalenv prog) (prog_main prog) = Some b /\
initial_core Sem (Genv.globalenv prog) (Vptr b Int.zero) vals = Some (fst st) /\
Genv.init_mem prog = Some (snd st).
(*Require that return values are int here - that's what we need below for mk_semantics*)
Definition final_state (st:state) (i:int) : Prop :=
halted Sem (fst st) = Some (Vint i).
Definition mk_semantics: semantics :=
Semantics step initial_state final_state (Genv.globalenv prog).

Lemma corestep_star_star_step: forall ge c m c' m',
corestep_star Sem ge c m c' m' -> star step ge (c, m) E0 (c', m').