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 fstep_containsThread' :
forall tp tp' m m' i j U tr tr'
(cnti: containsThread tp i)
(cntj: containsThread tp' j)
(Hcomp: mem_compatible tp m),
let mrestr := restrPermMap (((compat_th _ _ Hcomp) cnti).1) in
forall
(Hinternal: cnti$mrestr @ I)
(Hstep: fmachine_step (i :: U, tr, tp) m (U, tr', tp') m'),
containsThread tp j.