(** * Matching and memory injections. *)
Definition inj_of_bc (bc: block_classification) : meminj :=
fun b => match bc b with BCinvalid => None | _ => Some(b, 0) end.

(* Specifications: *)
Lemma inj_of_bc_valid:
forall (bc: block_classification) b, bc b <> BCinvalid -> inj_of_bc bc b = Some(b, 0).
Lemma inj_of_bc_inv:
forall (bc: block_classification) b b' delta,
inj_of_bc bc b = Some(b', delta) -> bc b <> BCinvalid /\ b' = b /\ delta = 0.
Lemma pmatch_inj:
forall bc b ofs p, pmatch bc b ofs p -> inj_of_bc bc b = Some(b, 0).
Lemma vmatch_inj:
forall bc v x, vmatch bc v x -> Val.inject (inj_of_bc bc) v v.
Lemma vmatch_list_inj:
forall bc vl xl, list_forall2 (vmatch bc) vl xl -> Val.inject_list (inj_of_bc bc) vl vl.
Lemma mmatch_inj:
forall bc m am, mmatch bc m am -> bc_below bc (Mem.nextblock m) -> Mem.inject (inj_of_bc bc) m m.
Lemma inj_of_bc_preserves_globals:
forall bc ge, genv_match bc ge -> meminj_preserves_globals ge (inj_of_bc bc).
Lemma pmatch_inj_top:
forall bc b b' delta ofs, inj_of_bc bc b = Some(b', delta) -> pmatch bc b ofs Ptop.
Lemma vmatch_inj_top:
forall bc v v', Val.inject (inj_of_bc bc) v v' -> vmatch bc v Vtop.
Lemma mmatch_inj_top:
forall bc m m', Mem.inject (inj_of_bc bc) m m' -> mmatch bc m mtop.