Proof with eauto with renamings id_renamings val_renamings.
intros.
constructor; constructor;
eauto with id_renamings; unfold id_ren; intros;
repeat match goal with
| [H: context[valid_block_dec ?M ?B] |- _] =>
destruct (valid_block_dec M B); simpl in *
| [H: _ = Some _ |- _] => inv H; clear H
end; auto.
now apply po_refl.
destruct (ZMap.get ofs (Mem.mem_contents m) # b2) eqn:Hget;
constructor.
destruct v0; constructor.
specialize (H _ v _ _ Hget).
simpl in H.
destruct (valid_block_dec m b); simpl; tauto.
Qed.

(* Specifications: *)
Lemma mem_obs_eq_extend:
forall m1 m1' m2' f pmap pmap'
(Hlt1: permMapLt pmap (getMaxPerm m1))
(Hlt1': permMapLt pmap' (getMaxPerm m1'))
(Hlt2': permMapLt pmap' (getMaxPerm m2'))
(Hmem_obs_eq: mem_obs_eq f (restrPermMap Hlt1) (restrPermMap Hlt1'))
(Hextend': forall b, Mem.valid_block m1' b -> Mem.valid_block m2' b)
(Hstable: forall b ofs, Mem.perm (restrPermMap Hlt1') b ofs Cur Readable ->
ZMap.get ofs (Mem.mem_contents m1') # b = ZMap.get ofs (Mem.mem_contents m2') # b),
mem_obs_eq f (restrPermMap Hlt1) (restrPermMap Hlt2').
Lemma mapped_dec :
forall (f : positive -> option positive) m j
(Hdomain_invalid : forall b, ~ (b < m)%positive -> f b = None)
(Hdomain_valid : forall b, (b < m)%positive -> exists b', f b = Some b'),
(exists i, f i = Some j) \/ ~ exists i, f i = Some j.
Lemma pigeon_positive:
forall (n m: positive) (f: positive -> option positive),
(forall i, (i < n)%positive ->
exists j, (j < m)%positive /\ f i = Some j) ->
(forall i i' j j',
f i = Some j -> f i' = Some j' ->
i<>i' -> j<>j') ->
(n <= m)%positive.
(** If a memory [m] injects into a memory [m'] then [m'] is at least as big as [m] *)
Lemma weak_mem_obs_eq_nextblock:
forall f m m'
(Hobs_eq: weak_mem_obs_eq f m m'),
(Mem.nextblock m <= Mem.nextblock m')%positive.
Lemma mf_align :
forall (m : mem) (f : memren) (b1 b2 : block) (delta : Z) (chunk : memory_chunk)
(ofs : Z) (p : permission),
f b1 = Some b2 ->
Mem.range_perm m b1 ofs (ofs + size_chunk chunk) Max p ->
(align_chunk chunk | 0%Z)%Z.
Lemma memval_obs_eq_incr:
forall (mc mf : mem) (f f': memren)
(b1 b2 : block) (ofs : Z)
(Hf': f' b1 = Some b2)
(Hincr: ren_incr f f')
(Hobs_eq: memval_obs_eq f (Maps.ZMap.get ofs (Mem.mem_contents mc) # b1)
(Maps.ZMap.get ofs (Mem.mem_contents mf) # b2)),
memval_obs_eq f' (Maps.ZMap.get ofs (Mem.mem_contents mc) # b1)
(Maps.ZMap.get ofs (Mem.mem_contents mf) # b2).
(* Proof as in compcert*)
Lemma proj_bytes_obs:
forall (f : memren) (vl vl' : seq memval),
Coqlib.list_forall2 (memval_obs_eq f) vl vl' ->
forall bl : seq byte,
proj_bytes vl = Some bl -> proj_bytes vl' = Some bl.
Lemma proj_bytes_obs_none:
forall (f : memren) (vl vl' : seq memval),
Coqlib.list_forall2 (memval_obs_eq f) vl vl' ->
proj_bytes vl = None -> proj_bytes vl' = None.
Lemma val_obs_equal:
forall f v1 v1' v2 v2'
(Hinjective: forall b1 b1' b2, f b1 = Some b2 -> f b1' = Some b2 -> b1 = b1')
(Hval1: val_obs f v1 v1')
(Hval2: val_obs f v2 v2'),
Val.eq v1 v2 <-> Val.eq v1' v2'.
Lemma check_value_obs:
forall f n vl vl' v v' q
(Hf: forall b1 b1' b2, f b1 = Some b2 -> f b1' = Some b2 -> b1 = b1'),
Coqlib.list_forall2 (memval_obs_eq f) vl vl' ->
val_obs f v v' ->
check_value n v q vl = check_value n v' q vl'.
Lemma proj_value_obs:
forall f q vl1 vl2,
(forall b1 b1' b2 : block, f b1 = Some b2 -> f b1' = Some b2 -> b1 = b1') ->
Coqlib.list_forall2 (memval_obs_eq f) vl1 vl2 ->
val_obs f (proj_value q vl1) (proj_value q vl2).
Lemma load_result_obs:
forall f chunk v1 v2,
val_obs f v1 v2 ->
val_obs f (Val.load_result chunk v1) (Val.load_result chunk v2).
Lemma decode_val_obs:
forall f vl1 vl2 chunk,
(forall b1 b1' b2 : block, f b1 = Some b2 -> f b1' = Some b2 -> b1 = b1') ->
Coqlib.list_forall2 (memval_obs_eq f) vl1 vl2 ->
val_obs f (decode_val chunk vl1) (decode_val chunk vl2).
Lemma valid_access_obs_eq:
forall f m1 m2 b1 b2 chunk ofs p,
strong_mem_obs_eq f m1 m2 ->
f b1 = Some b2 ->
Mem.valid_access m1 chunk b1 ofs p ->
Mem.valid_access m2 chunk b2 ofs p.
Lemma valid_access_obs_eq':
forall f m1 m2 b1 b2 chunk ofs p,
strong_mem_obs_eq f m1 m2 ->
f b1 = Some b2 ->
Mem.valid_access m2 chunk b2 ofs p ->
Mem.valid_access m1 chunk b1 ofs p.
Lemma getN_obs:
forall f m1 m2 b1 b2,
strong_mem_obs_eq f m1 m2 ->
f b1 = Some b2 ->
forall n ofs,
Mem.range_perm m1 b1 ofs (ofs + Z_of_nat n) Cur Readable ->
list_forall2 (memval_obs_eq f)
(Mem.getN n ofs (m1.(Mem.mem_contents)#b1))
(Mem.getN n ofs (m2.(Mem.mem_contents)#b2)).