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').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').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').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').