Section Ksafety_Clight.
(* Import DryMachineSource.THE_DRY_MACHINE_SOURCE.DMS.DryConc. Import DryMachineSource.THE_DRY_MACHINE_SOURCE.SCH. Import DryMachineSource.THE_DRY_MACHINE_SOURCE.DMS.DryMachine. *)
(** *Clight setup *)
(** We define state and step to match the type of ksafe (in konig/safety) *)
Parameter machine_event:Type.
Definition new_state: Type:= list machine_event * machine_state * mem.
Definition mk_nstate (st:MachState) m:new_state:= (snd (fst st), snd st, m).
Definition ksafe_new_step (ge : G) (st : MachState) (m : mem) : nat -> Prop :=
ksafe _ _ (new_step ge) new_valid (mk_nstate st m) (fst (fst st)).
(* Lemma init_schedule_all: forall U pmap n g m p t init_mach om, (semantics.initial_core (MachineSemantics U pmap) n g m p t) = Some (init_mach, om) -> forall U'', correct_schedule (U'', snd (fst init_mach), snd init_mach) -> schedPeek U'' = Some 1  \/ schedPeek U'' = None .  Ad_itted. *)

Lemma Initial_dry_ksafety_valid:
forall (U : semax_invariant.schedule) (n : nat),
exists init_U init_tr init_st,
(semantics.initial_core (MachineSemantics U (Some ( getCurPerm (juicy_mem.m_dry (init_jmem n)), empty_map)))) 0 init_genv (juicy_mem.m_dry (init_jmem n)) init_point nil =
Some ((init_U, init_tr, init_st), None) /\
forall n' U',
new_valid  (mk_nstate (U', init_tr, init_st)
(proj1_sig (init_mem CPROOF))) U' ->
ksafe_new_step (globalenv prog) (U', init_tr, init_st)
(proj1_sig (init_mem CPROOF)) n'.