Section THE_JUICY_MACHINE.
Context {ge : Clight.genv}.
Instance JSem : Semantics := ClightSem ge.
Definition JMachineSem := MachineSemantics(HybridMachine := HybridCoarseMachine.HybridCoarseMachine(machineSig:=JuicyMachineShell)).
Definition jstate := ThreadPool.t(resources := LocksAndResources)(ThreadPool := OrdinalPool.OrdinalThreadPool).
Definition jmachine_state := MachState(resources := LocksAndResources)(ThreadPool := OrdinalPool.OrdinalThreadPool).
(* safety with ghost updates *)
Definition tp_update (tp : jstate) phi tp' phi' :=
level phi' = level phi /\ resource_at phi' = resource_at phi /\
join_all tp' phi' /\
exists (Hiff : forall t, containsThread tp' t <-> containsThread tp t),
(forall t (cnt : containsThread tp t), getThreadC cnt = getThreadC (proj2 (Hiff _) cnt) /\
level (getThreadR cnt) = level (getThreadR (proj2 (Hiff _) cnt)) /\
resource_at (getThreadR cnt) = resource_at (getThreadR (proj2 (Hiff _) cnt))) /\
lockGuts tp' = lockGuts tp /\ lockSet tp' = lockSet tp /\
lockRes tp' = lockRes tp /\ latestThread tp'= latestThread tp.

Lemma tp_update_refl : forall tp phi, join_all tp phi -> tp_update tp phi tp phi.