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.

Lemma fmachine_step_compatible:
forall (tp tp' : t) m m' (i : nat) (pf : containsThread tp i) U tr tr'
(Hcomp: mem_compatible tp m),
let mrestr := restrPermMap (((compat_th _ _ Hcomp) pf).1) in
forall (Hinternal: pf$mrestr @ I)
(Hstep: fmachine_step (i :: U,tr, tp) m (U, tr',tp') m'),
mem_compatible tp' m'.