Module X86Inj.
(** Injections on registers *)
Definition reg_ren f (r:PregEq.t) (rs rs' : regset) : Prop :=
val_obs f (Pregmap.get r rs) (Pregmap.get r rs').
Definition regset_ren f rs rs' : Prop :=
forall r, reg_ren f r rs rs'.
Definition core_inj f c c' :=
match c, c' with State rs _, State rs' _ => regset_ren f rs rs' end.
Include X86WD.
(* Lemma decode_longs_val_obs_list: forall f (vals vals' : seq val) tys (Hobs_eq: val_obs_list f vals vals'), val_obs_list f (val_casted.decode_longs tys vals) (val_casted.decode_longs tys vals'). *)

Lemma core_inj_init :
forall the_ge m1 m1' m2 vf vf' arg arg' c_new f fg h
(Hge_wd: ge_wd fg the_ge)
(Hfg: forall b1 b2, fg b1 = Some b2 -> b1 = b2)
(Hincr: ren_incr fg f)
(Harg: val_obs_list f arg arg')
(Hvf: val_obs f vf vf')
(Hmem_obs_eq: mem_obs_eq f m1 m1')
(Hinit: initial_core (Asm_core_sem the_ge) h m1 c_new m2 vf arg),
exists c_new' m2' f',
initial_core (Asm_core_sem the_ge) h m1' c_new' m2' vf' arg'
/\ core_inj f' c_new c_new'
/\ mem_obs_eq f' m2 m2'
/\ ren_incr f f'
/\ ren_separated f f' m1 m1'
/\ ((exists p, ((Mem.nextblock m2 = Mem.nextblock m1 + p)%positive /\
(Mem.nextblock m2' = Mem.nextblock m1' + p)%positive)))
/\ (forall b,
Mem.valid_block m2' b ->
~ Mem.valid_block m1' b ->
let bz := ((Zpos b) - ((Zpos (Mem.nextblock m1')) -
(Zpos (Mem.nextblock m1))))%Z in
f' (Z.to_pos bz) = Some b /\
f (Z.to_pos bz) = None)
/\ (Mem.nextblock m1 = Mem.nextblock m1' ->
(forall b1 b2, f b1 = Some b2 -> b1 = b2) ->
forall b1 b2, f' b1 = Some b2 -> b1 = b2)
/\ (forall b2, (~exists b1, f' b1 = Some b2) ->
forall ofs, permissions.permission_at m1' b2 ofs Cur =
permissions.permission_at m2' b2 ofs Cur).