Definition A2P {A} :=
 (fun (pmap : access_map) (a : address * A) =>
      let (a0, _) := a in let (b0, ofs0) := a0 in setPermBlock (Some Writable) b0 ofs0 pmap LKSIZE_nat).

(* Specifications: *)
Lemma A2P_congr A e e' a : PMap_eq e e' -> PMap_eq (A2P e a) (@A2P A e' a).
Lemma A2P_overwrite A : forall a b e, fst a = fst b -> PMap_eq (@A2P A (A2P e a) b) (@A2P A e a).
Lemma setPerm_comm b1 o1 b2 o2 e: PMap_eq (setPerm (Some Writable) b1 o1 (setPerm (Some Writable) b2 o2 e)) (setPerm (Some Writable) b2 o2 (setPerm (Some Writable) b1 o1 e)).
Lemma setPerm_congr b o e e': PMap_eq e e' -> PMap_eq (setPerm (Some Writable) b o e) (setPerm (Some Writable) b o e').
Lemma A2P_comm A e a b : PMap_eq (@A2P A (A2P e a) b) (@A2P A (A2P e b) a).
Lemma fold_right_cons : forall A B (f : A -> B -> B) (z : B) (x : A) (y : list A), fold_right f z (x :: y) = f x (fold_right f z y).
Lemma fold_right_rev_left: forall (A B: Type) (f: A -> B -> A) (l: list B) (i: A), fold_left f l i = fold_right (fun x y => f y x) i (rev l).
Lemma find_too_small A y a x l : (AddressOrdered.lt y a \/ AddressOrdered.eq y a) -> Sorted (AMap.Raw.PX.ltk (elt:=A)) l -> HdRel (AMap.Raw.PX.ltk (elt:=A)) (a, x) l -> AMap.Raw.find (elt:=A) y l = None.
Lemma sorted_find A a x l l' (sorted : Sorted (AMap.Raw.PX.ltk (elt:=A)) ((a, x) :: l)) (sorted' : Sorted (AMap.Raw.PX.ltk (elt:=A)) ((a, x) :: l')) : (forall y : AMap.key, AMap.Raw.find (elt:=A) y ((a, x) :: l) = AMap.Raw.find (elt:=A) y ((a, x) :: l')) -> forall y : AMap.key, AMap.Raw.find (elt:=A) y l = AMap.Raw.find (elt:=A) y l'.
Lemma AMap_Equal_PMap_eq {A} m m' : AMap.Equal m m' -> @A2PMap A m = @A2PMap A m'.
Lemma AMap_remove_add {A} (m : AMap.t A) x y : AMap.find x m = Some y -> AMap.Equal m (AMap.add x y (AMap.remove x m)).