(* The initial machine has to be redefined. Right now its build by default with empty maps, but it should be built with the correct juice, corresponding to global variables, arguments and function specs. *)
(*Lemma onePos: (0<1)%coq_nat. auto. Qed.*)
Definition initial_machine rmap c:=
mk
(mkPos (le_n 1))
(fun _ => (Krun c))
(fun _ => rmap)
(AMap.empty (option res)).
Definition init_mach rmap (m:mem) (tp:thread_pool) (m':mem) (v:val) (args:list val) : Prop :=
exists c, initial_core the_sem 0 m c m' v args /\
match rmap with Some rmap => tp = initial_machine rmap c | None => False end.
Section JuicyMachineLemmas.

Lemma compat_lockLT': forall js m,
mem_compatible js m ->
forall l r,
ThreadPool.lockRes js l = Some (Some r) ->
forall b ofs,
Mem.perm_order'' ((getMaxPerm m) !! b ofs) (perm_of_res' (r @ (b, ofs))).