Fixpoint cur_perm (l: block * Z) (T: list mem_event): option permission :=
match T with
nil => None
| (mu :: R) =>
let popt := cur_perm l R in
match mu, l with
| (Read b ofs n bytes), (b',ofs') =>
pmax (if eq_block b b' && zle ofs ofs' && zlt ofs' (ofs+n)
then Some Readable else None) popt
| (Write b ofs bytes), (b',ofs') =>
pmax (if eq_block b b' && zle ofs ofs' && zlt ofs' (ofs+ Zlength bytes)
then Some Writable else None) popt
| (Alloc b lo hi), (b',ofs') =>  (*we don't add a constraint relating lo/hi/ofs*)
if eq_block b b' then None else popt
| (Free l), (b',ofs') =>
List.fold_right (fun tr qopt => match tr with (b,lo,hi) =>
if eq_block b b' && zle lo ofs' && zlt ofs' hi
then Some Freeable else qopt
end)
popt l
end
end.

Lemma ev_elim_app: forall T1 m1 m2 (EV1:ev_elim m1 T1 m2) T2 m3  (EV2: ev_elim m2 T2 m3), ev_elim m1 (T1++T2) m3.