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_result_type:
forall tp m tp' m' i (cnti: containsThread tp i)
(cnti': containsThread tp' i)
(Hcomp: mem_compatible tp m)
(Hcomp': mem_compatible tp' m')
(Hinternal: internal_step cnti Hcomp tp' m'),
let mrestr := restrPermMap (((compat_th _ _ Hcomp') cnti').1) in
~ (cnti'$mrestr @ E).