Section FineMachineInternal.
Context {initU : seq nat}
{semAx: CoreLanguage.SemAxioms}
{dilMem: DiluteMem}.
Notation fmachine_step := ((corestep (AsmContext.fine_semantics initU))).
(*TODO: maybe move to tactics *)
(** Solves absurd cases from fine-grained internal steps *)
Ltac absurd_internal Hstep :=
inversion Hstep; try inversion Htstep; subst; Tactics.pf_cleanup; simpl in *;
try match goal with
| [H: Some _ = Some _ |- _] => inversion H; subst
end; Tactics.pf_cleanup;
repeat match goal with
| [H: getThreadC ?Pf = _, Hint: ?Pf$_ @ I |- _] =>
unfold getStepType in Hint; simpl in *;
rewrite H in Hint; simpl in Hint
| [H1: match ?Expr with _ => _ end = _,
H2: ?Expr = _ |- _] => rewrite H2 in H1
end; try discriminate; try (exfalso; by auto).
Opaque getThreadC updThreadC containsThread updThread updLockSet addThread remLockSet getThreadR lockSet.
Opaque lockRes.

Lemma fmachine_step_disjoint_val :
forall tp tp' m m' i j U tr tr'
(Hneq: i <> j)
(pfi: containsThread tp i)
(pfj: containsThread tp j)
(pfj': containsThread tp' j)
(Hcomp: mem_compatible tp m)
(Hcomp': mem_compatible tp' m'),
let mrestr := restrPermMap (((compat_th _ _ Hcomp) pfi).1) in
forall (Hinternal: pfi$mrestr @ I)
(Hstep: fmachine_step (i :: U, tr, tp) m (U,tr', tp') m') b ofs
(Hreadable:
Mem.perm (restrPermMap (Hcomp _ pfj).1) b ofs Cur Readable \/
Mem.perm (restrPermMap (Hcomp _ pfj).2) b ofs Cur Readable),
Maps.ZMap.get ofs (Mem.mem_contents m) # b =
Maps.ZMap.get ofs (Mem.mem_contents m') # b.