End Csafe_Safety.
End SafetyEquivalence.
(*  (* ksafe_safe : forall (ST SCH : Type) (STEP : ST -> SCH -> ST -> SCH -> Prop) (valid : ST -> SCH -> Prop), (forall P : Prop, P \/ ~ P) -> True -> (forall x : ST, finite_on_x (possible_image (fun (x0 : ST) (y : SCH) (x' : ST) => exists y' : SCH, STEP x0 y x' y') valid x)) -> forall st : ST, (forall U : SCH, valid st U) -> (forall (n : nat) (U : SCH), ksafe ST SCH STEP valid st U n) -> forall U : SCH, safe ST SCH STEP valid st U *)
(** *Beggins old proofs (specific to clight and asm... *)
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)).

(* Specifications: *)
(** *First show Csafety -> Ksafety*)
Lemma Clight_csafe2ksafe:
forall ge st_ m,
(forall U n, new_valid (nil, st_, m) U ->  csafe ge (U, nil, st_) m n) ->
(forall U n, new_valid (nil, st_, m) U -> ksafe_new_step ge (U, nil, st_) m n).
Lemma init_schedule:
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) ->
fst (fst init_mach) = U.
Lemma init_trace:
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) ->
snd (fst init_mach) = nil.