(* Theorem MS_match_callstack_function_entry: forall fn cenv tf m'  tm' sp f cs args targs, build_compilenv fn = (cenv, tf.(fn_stackspace)) -> tf.(fn_stackspace) <= Int.max_unsigned -> list_norepet (map fst (Csharpminor.fn_vars fn)) -> list_norepet (Csharpminor.fn_params fn) -> list_disjoint (Csharpminor.fn_params fn) (Csharpminor.fn_temps fn) -> alloc_variables Csharpminor.empty_env m (Csharpminor.fn_vars fn) e m' -> bind_parameters (Csharpminor.fn_params fn) args (create_undef_temps fn.(fn_temps)) = Some le -> val_list_inject f args targs -> Mem.alloc tm 0 tf.(fn_stackspace) = (tm', sp) -> match_callstack prog f m tm cs (Mem.nextblock m) (Mem.nextblock tm) -> Mem.inject f m tm -> let te := set_locals (Csharpminor.fn_temps fn) (set_params targs (Csharpminor.fn_params fn)) in exists f', match_callstack prog f' m' tm' (Frame cenv tf e le te sp (Mem.nextblock m) (Mem.nextblock m') :: cs) (Mem.nextblock m') (Mem.nextblock tm') /\ Mem.inject f' m' tm' /\ (*LENB: this clause is new in Restructured Proof*) inject_incr f f' /\ (*LENB this clause in new in coop-sim proof*) inject_separated f f' m tm. *)

Lemma structured_match_callstack_alloc_left:
forall mu1 m1 tm id cenv tf e lenv te sp lo cs sz m2 b mu2 ofs
(WD1: SM_wd mu1) (WD2: SM_wd mu2),
structured_match_callstack mu1 m1 tm
(Frame (PTree.remove id cenv) tf e lenv te sp lo (Mem.nextblock m1) :: cs)
(Mem.nextblock m1) (Mem.nextblock tm) ->
Mem.alloc m1 0 sz = (m2, b) ->
cenv!id = Some ofs ->
intern_incr mu1 mu2 ->
as_inj mu2 b = Some(sp, ofs) ->
(forall b', b' <> b -> as_inj mu2 b' = as_inj mu1 b') ->
e!id = None ->
structured_match_callstack mu2 m2 tm
(Frame cenv tf (PTree.set id (b, sz) e) lenv te sp lo (Mem.nextblock m2) :: cs)
(Mem.nextblock m2) (Mem.nextblock tm).