Section StepType.
Context {Sem : Semantics}
{Sch: Scheduler}.
Existing Instance dryResources.
Existing Instance OrdinalPool.OrdinalThreadPool.
Existing Instance DryHybridMachineSig.
Inductive StepType : Type :=
Internal | Concurrent | Suspend.
Definition ctlType (code : @threadPool.ctl semC) (m : Mem.mem) (st : StepType) : Prop :=
match code with
| Kinit _ _ => st = Internal
| Krun c =>
match at_external semSem c m with
| None => (* ((exists i, halted semSem c i) /\ st = Halted) \/ *)
st = Internal
| Some _ => st = Suspend
end
| Kblocked c => st = Concurrent
| Kresume c _ => st = Internal
end.
Definition getStepType {i tp} (cnt : containsThread tp i) m st :=
ctlType (getThreadC cnt) m st.
Notation "cnt '$' m '@'  'I'" := (getStepType cnt m Internal) (at level 80).
Notation "cnt '$' m '@'  'E'" := (getStepType cnt m Concurrent) (at level 80).
Notation "cnt '$' m '@'  'S'" := (getStepType cnt m Suspend) (at level 80).
(* Notation "cnt '$' m '@'  'H'" := (getStepType cnt m Halted) (at level 80). *)

Lemma internal_step_type :
forall  i tp tp' m m' (cnt : containsThread tp i)
(Hcomp: mem_compatible tp m)
(Hstep_internal: internal_step cnt Hcomp tp' m'),
let mrestr := restrPermMap (((compat_th _ _ Hcomp) cnt).1) in
cnt$mrestr @ I.