(** [True] whenever some resource in [tp] has above [Readable] lock-permission on [laddr]*)
(* I could not prove the stronger version, where quantification happens inside each case*)
Definition isLock tp laddr :=
forall ofs, Intv.In ofs (laddr.2, laddr.2 + lksize.LKSIZE)%Z ->
(exists i (cnti: containsThread tp i),
Mem.perm_order'' ((getThreadR cnti).2 !! (laddr.1) ofs) (Some Readable)) \/
(exists laddr' rmap, lockRes tp laddr' = Some rmap /\
Mem.perm_order'' (rmap.2 !! (laddr.1) ofs) (Some Readable)).

(** *** Properties of internal steps*)
(** Permissions of addresses that are valid and not freeable do not change by internal steps*)
Lemma ev_elim_stable:
forall m m' b ofs es
(Hvalid: Mem.valid_block m b)
(Hperm: Mem.perm_order'' (Some Writable)
(permission_at m b ofs Cur))
(Helim: ev_elim m es m'),
permission_at m b ofs Cur = permission_at m' b ofs Cur.