(** There is no inteference in the thread pool *)
    (* Per-thread disjointness definition*)
    Definition disjoint_threads tp :=
      forall i j (cnti : containsThread tp i)
        (cntj: containsThread tp j) (Hneq: i <> j),
        joins (getThreadR(resources:=LocksAndResources) cnti)
              (getThreadR cntj).(* Per-lock disjointness definition*)
    Definition disjoint_locks tp :=
      forall loc1 loc2 r1 r2,
        lockRes tp loc1 = SSome r1 ->
        lockRes tp loc2 = SSome r2 ->
        joins r1 r2.(* lock-thread disjointness definition*)
    Definition disjoint_lock_thread tp :=
      forall i loc r (cnti : containsThread tp i),
        lockRes tp loc = SSome r ->
        joins (getThreadR cnti)r.Variant invariant' (tp:t) := True.Variant invariant' (tp:t) := True.(* The invariant has been absorbed my mem_compat*)
     (* { no_race : disjoint_threads tp
      }.*)

    Definition invariant := invariant'.

(* Specifications: *)
Lemma juice2Perm_canon: forall phi m, isCanonical (juice2Perm phi m).
Lemma juice2Perm_locks_canon: forall phi m, isCanonical (juice2Perm_locks phi m).
Lemma juice2Perm_cohere: forall phi m, access_cohere' m phi -> permMapLt (juice2Perm phi m) (getMaxPerm m).
Lemma juice2Perm_locks_cohere: forall phi m, max_access_cohere m phi -> permMapLt (juice2Perm_locks phi m) (getMaxPerm m).