Definition CSharpMin_initial_core (ge:genv) (v: val) (args:list val): option CSharpMin_core :=
match v with
| Vptr b i =>
if Int.eq_dec i Int.zero
then match Genv.find_funct_ptr ge b with
| None => None
| Some f => Some (CSharpMin_Callstate f args Kstop)
end
else None
| _ => None
end.
(* Parameter CSharpMin_MainIdent:ident.  Definition CSharpMin_make_initial_core (ge:genv) (v: val) (args:list val): option CSharpMin_core := match Genv.find_symbol ge CSharpMin_MainIdent with None => None | Some b => match Genv.find_funct_ptr ge b with None => None | Some f => match funsig f with {| sig_args := sargs; sig_res := sres |} => match sargs, sres with nil, Some Tint => Some (CSharpMin_Callstate f nil Kstop) (*args = nil???*)
| _ , _ => None
end
end
end
end.*)
(*Original Csharpminor_semantics has this for initial states: Genv.find_symbol ge p.(prog_main) = Some b -> Genv.find_funct_ptr ge b = Some f -> funsig f = mksignature nil (Some Tint) -> initial_state p (Callstate f nil Kstop m0). ie esseantially the same as Cminor*)
Definition CSharpMin_core_sem : CoreSemantics genv CSharpMin_core mem.
eapply @Build_CoreSemantics with (at_external:=CSharpMin_at_external)
(after_external:=CSharpMin_after_external)
(corestep:=CSharpMin_corestep)
(halted:=CSharpMin_halted).
apply CSharpMin_initial_core.
apply CSharpMin_corestep_not_at_external.
apply CSharpMin_corestep_not_halted.
apply CSharpMin_at_external_halted_excl.
apply CSharpMin_after_at_external_excl.
Defined.

Lemma CSharpMin_forward : forall g c m c' m' (CS: CSharpMin_corestep g c m c' m'),
mem_lemmas.mem_forward m m'.