Definition restrict_sm mu (X:block -> bool) :=
match mu with
Build_SM_Injection locBSrc locBTgt pSrc pTgt local extBSrc extBTgt fSrc fTgt extern =>
Build_SM_Injection locBSrc locBTgt pSrc pTgt (restrict local X)
extBSrc extBTgt fSrc fTgt (restrict extern X)
end.

(* Specifications: *)
Lemma restrict_sm_com: forall mu X Y,
restrict_sm (restrict_sm mu X) Y = restrict_sm (restrict_sm mu Y) X.
Lemma restrict_sm_nest: forall mu X Y
(HXY: forall b, Y b = true -> X b = true),
restrict_sm (restrict_sm mu X) Y = restrict_sm mu Y.
Lemma restrict_sm_nest': forall mu X Y
(HXY: forall b, Y b = true -> X b = true),
restrict_sm (restrict_sm mu Y) X = restrict_sm mu Y.
Lemma restrict_sm_local: forall mu X,
local_of (restrict_sm mu X) = restrict (local_of mu) X.
Lemma restrict_sm_extern: forall mu X,
extern_of (restrict_sm mu X) = restrict (extern_of mu) X.
Lemma restrict_sm_all: forall mu X,
as_inj (restrict_sm mu X) = restrict (as_inj mu) X.
Lemma restrict_sm_local': forall mu (WD: SM_wd mu) X
(HX: forall b, vis mu b = true -> X b = true),
local_of (restrict_sm mu X) = local_of mu.
Lemma restrict_sm_pub': forall mu (WD: SM_wd mu) X
(HX: forall b, vis mu b = true ->
X b = true),
pub_of (restrict_sm mu X) = pub_of mu.
Lemma restrict_sm_foreign': forall mu (WD: SM_wd mu) X
(HX: forall b, vis mu b = true -> X b = true),
foreign_of (restrict_sm mu X) = foreign_of mu.
Lemma restrict_sm_locBlocksSrc: forall mu X,
locBlocksSrc (restrict_sm mu X) = locBlocksSrc mu.
Lemma replace_locals_exportedTgt:
forall (mu : SM_Injection) (pubSrc' pubTgt' : block -> bool) vals,
exportedTgt (replace_locals mu pubSrc' pubTgt') vals =
(fun b : block => getBlocks vals b || (frgnBlocksTgt mu b || pubTgt' b)).
Lemma restrict_sm_WD:
forall mu (WD: SM_wd mu) X
(HX: forall b, vis mu b = true -> X b = true),
SM_wd (restrict_sm mu X).
Lemma restrict_sm_preserves_globals: forall {F V} (ge:Genv.t F V) mu X
(PG : meminj_preserves_globals ge (as_inj mu))
(Glob : forall b, isGlobalBlock ge b = true -> X b = true),
meminj_preserves_globals ge (as_inj (restrict_sm mu X)).
Lemma restrict_sm_preserves_globals' F V (ge:Genv.t F V) mu X :
Events.meminj_preserves_globals ge (extern_of mu) ->
(forall b, isGlobalBlock ge b = true -> X b = true) ->
Events.meminj_preserves_globals ge (extern_of (restrict_sm mu X)).
Lemma restrict_sm_com: forall mu X Y,
restrict_sm (restrict_sm mu X) Y = restrict_sm (restrict_sm mu Y) X.
Lemma restrict_sm_nest: forall mu X Y
(HXY: forall b, Y b = true -> X b = true),
restrict_sm (restrict_sm mu X) Y = restrict_sm mu Y.
Lemma restrict_sm_nest': forall mu X Y
(HXY: forall b, Y b = true -> X b = true),
restrict_sm (restrict_sm mu Y) X = restrict_sm mu Y.
Lemma restrict_sm_local: forall mu X,
local_of (restrict_sm mu X) = restrict (local_of mu) X.
Lemma restrict_sm_extern: forall mu X,
extern_of (restrict_sm mu X) = restrict (extern_of mu) X.
Lemma restrict_sm_all: forall mu X,
as_inj (restrict_sm mu X) = restrict (as_inj mu) X.
Lemma restrict_sm_local': forall mu (WD: SM_wd mu) X
(HX: forall b, vis mu b = true -> X b = true),
local_of (restrict_sm mu X) = local_of mu.
Lemma restrict_sm_pub': forall mu (WD: SM_wd mu) X
(HX: forall b, vis mu b = true ->
X b = true),
pub_of (restrict_sm mu X) = pub_of mu.
Lemma restrict_sm_foreign': forall mu (WD: SM_wd mu) X
(HX: forall b, vis mu b = true -> X b = true),
foreign_of (restrict_sm mu X) = foreign_of mu.
Lemma restrict_sm_locBlocksSrc: forall mu X,
locBlocksSrc (restrict_sm mu X) = locBlocksSrc mu.
Lemma restrict_sm_preserves_globals: forall {F V} (ge:Genv.t F V) mu X
(PG : meminj_preserves_globals ge (as_inj mu))
(Glob : forall b, isGlobalBlock ge b = true -> X b = true),
meminj_preserves_globals ge (as_inj (restrict_sm mu X)).