Ltac jmstep_inv :=
match goal with
| H : JuicyMachine.start_thread _ _ _ _  |- _ => inversion H
| H : JuicyMachine.resume_thread _ _ _   |- _ => inversion H
| H : JuicyMachine.threadStep _ _ _ _ _           |- _ => inversion H
| H : JuicyMachine.suspend_thread _ _ _ |- _ => inversion H
| H : JuicyMachine.syncStep _ _ _ _ _ _           |- _ => inversion H
(*  | H : JuicyMachine.threadHalted _                   |- _ => inversion H*)
| H : JuicyMachine.schedfail _         |- _ => inversion H
end; try subst.
Ltac getThread_inv :=
match goal with
| [ H : getThreadC ?i _ _ = _ ,
H2 : getThreadC ?i _ _ = _ |- _ ] =>
pose proof (getThreadC_fun _ _ _ _ _ _ _ H H2)
| [ H : getThreadR ?i _ _ = _ ,
H2 : getThreadR ?i _ _ = _ |- _ ] =>
pose proof (getThreadR_fun _ _ _ _ _ _ _ H H2)
end.
Ltac substwith x y := assert (x = y) by apply proof_irr; subst x.

Lemma load_restrPermMap ge m (tp : jstate ge) Phi b ofs m_any
(compat : mem_compatible_with tp m Phi) :
lock_coherence (lset tp) Phi m_any ->
AMap.find (elt:=option rmap) (b, ofs) (lset tp) <> None ->
Mem.load
Mint32
(restrPermMap (mem_compatible_locks_ltwritable (mem_compatible_forget compat)))
b ofs =
Some (decode_val Mint32 (Mem.getN (size_chunk_nat Mint32) ofs (Mem.mem_contents m) !! b)).