(*One might consider variants that require Mem.inject j ma m2 on smaller injections j than as_inj mu, omething like this: core_halted : forall cd mu c1 m1 c2 m2 v1, match_state cd mu c1 m1 c2 m2 -> halted Sem1 c1 = Some v1 ->  exists v2, Mem.inject (locvisible_of mu) m1 m2 /\ val_inject (locvisible_of mu) v1 v2;  (-follows from halted_loc_check:-) /\ exists pubSrc' pubTgt' nu, (pubSrc' = fun b => (locBlocksSrc mu b) && (REACH m1 (exportedSrc mu (v1::nil)) b)) /\ (pubTgt' = fun b => (locBlocksTgt mu b) && (REACH m2 (exportedTgt mu (v2::nil)) b)) /\ (nu = replace_locals mu pubSrc' pubTgt') /\ val_inject (shared_of nu) v1 v2 /\ halted Sem2 c2 = Some v2 /\ Mem.inject (shared_of nu) m1 m2; (*/\ val_valid v2 m2*)
But this would mean to carry the invariant Mem.inject (locvisible_of mu) m1 m2
around, ie through corediagram, afterexternal etc (ie require match_state
to imply Mem.inject loc_visible ...
This maybe possible, but is maybe not required.
*)

(* Specifications: *)
Lemma halted_check_aux: forall mu m1 v1 b1 b2 delta (WD: SM_wd mu),
join (foreign_of mu)
(fun b =>
if locBlocksSrc mu b && REACH m1 (exportedSrc mu (v1 :: nil)) b
then local_of mu b
else None) b1 = Some (b2, delta) ->
as_inj mu b1= Some (b2, delta).