Definition REACH_closed m (X: Values.block -> bool) : Prop :=
(forall b, REACH m X b = true -> X b = true).
Definition mapped (j:meminj) b : bool :=
match j b with None => false | Some _ => true end.

(* Specifications: *)
Lemma mappedD_true : forall j b (M: mapped j b = true),
exists p, j b = Some p.
Lemma mappedD_false : forall j b (M: mapped j b = false),
j b = None.
Lemma mappedI_true : forall j b p (J: j b = Some p),
mapped j b = true.
Lemma mappedI_false : forall j b (J:j b = None),
mapped j b = false.
Lemma mapped_charT: forall j b, (mapped j b = true) <-> (exists p, j b = Some p).
Lemma mapped_charF: forall j b, (mapped j b = false) <-> (j b = None).
Lemma inject_mapped: forall j m1 m2 (Inj12: Mem.inject j m1 m2) k
(RC: REACH_closed m1 (mapped k))
(INC: inject_incr k j),
Mem.inject k m1 m2.
Lemma restrict_val_inject: forall j val1 val2
(Inj : val_inject j val1 val2)
X (HR: forall b, getBlocks (val1::nil) b = true -> X b = true),
val_inject (restrict j X) val1 val2.
Lemma restrict_forall_vals_inject: forall j vals1 vals2
(Inj : Forall2 (val_inject j) vals1 vals2)
X (HR: forall b, getBlocks vals1 b = true -> X b = true),
Forall2 (val_inject (restrict j X)) vals1 vals2.
Lemma restrict_mapped_closed: forall j m X
(RC: REACH_closed m (mapped j))
(RX: REACH_closed m X),
REACH_closed m (mapped (restrict j X)).
Lemma restrict_mapped_closed_triv: forall j m X,
REACH_closed m (fun b => mapped j b && X b) =
REACH_closed m (mapped (restrict j X)).
Lemma REACH_closed_intersection: forall m X Y
(HX: REACH_closed m X) (HY: REACH_closed m Y),
REACH_closed m (fun b => X b && Y b).
Lemma REACH_closed_union: forall m X Y
(HX: REACH_closed m X) (HY: REACH_closed m Y),
REACH_closed m (fun b => X b || Y b).
Lemma inject_REACH_closed: forall j m1 m2 (Inj: Mem.inject j m1 m2),
REACH_closed m1 (mapped j).
Lemma inject_restrict: forall j m1 m2 X
(INJ : Mem.inject j m1 m2)
(RC : REACH_closed m1 X),
Mem.inject (restrict j X) m1 m2.
Lemma mappedD_true : forall j b (M: mapped j b = true),
exists p, j b = Some p.
Lemma mappedD_false : forall j b (M: mapped j b = false),
j b = None.
Lemma mappedI_true : forall j b p (J: j b = Some p),
mapped j b = true.
Lemma mappedI_false : forall j b (J:j b = None),
mapped j b = false.
Lemma mapped_charT: forall j b, (mapped j b = true) <-> (exists p, j b = Some p).
Lemma mapped_charF: forall j b, (mapped j b = false) <-> (j b = None).
Lemma inject_mapped: forall j m1 m2 (Inj12: Mem.inject j m1 m2) k
(RC: REACH_closed m1 (mapped k))
(INC: inject_incr k j),
Mem.inject k m1 m2.
Lemma restrict_val_inject: forall j val1 val2
(Inj : val_inject j val1 val2)
X (HR: forall b, getBlocks (val1::nil) b = true -> X b = true),
val_inject (restrict j X) val1 val2.
Lemma restrict_forall_vals_inject: forall j vals1 vals2
(Inj : Forall2 (val_inject j) vals1 vals2)
X (HR: forall b, getBlocks vals1 b = true -> X b = true),
Forall2 (val_inject (restrict j X)) vals1 vals2.
Lemma restrict_mapped_closed: forall j m X
(RC: REACH_closed m (mapped j))
(RX: REACH_closed m X),
REACH_closed m (mapped (restrict j X)).
Lemma restrict_mapped_closed_triv: forall j m X,
REACH_closed m (fun b => mapped j b && X b) =
REACH_closed m (mapped (restrict j X)).
Lemma REACH_closed_intersection: forall m X Y
(HX: REACH_closed m X) (HY: REACH_closed m Y),
REACH_closed m (fun b => X b && Y b).
Lemma REACH_closed_union: forall m X Y
(HX: REACH_closed m X) (HY: REACH_closed m Y),
REACH_closed m (fun b => X b || Y b).
Lemma inject_REACH_closed: forall j m1 m2 (Inj: Mem.inject j m1 m2),
REACH_closed m1 (mapped j).
Lemma inject_restrict: forall j m1 m2 X
(INJ : Mem.inject j m1 m2)
(RC : REACH_closed m1 X),
Mem.inject (restrict j X) m1 m2.