Section TemporalOperators_TCTL.
(*** operators TCTL with co-inductives types: definitions and properties ***)
Variable Label : Set.               (* labels: dicrete transitions *)
Variable S : Set.               (* states                      *)
Variable tr : S -> Label -> S -> Prop. (* transitions                 *)
Variable inv : S -> Prop.         (* location invariants         *)
Variable inc : S -> Instant -> S. (* increase clocks of states   *)
Variable bound : Instant -> Prop.     (* Belonging to temporal intervals *)
Notation State_T := (S * Instant)%type (only parsing).
Notation SPath_T := (Stream (S * Instant)) (only parsing).
(* Ejecution traces *)
CoInductive isTrace_T : Stream (S * Instant) -> Prop :=
| isTraceTick_T :
forall (x : Stream (S * Instant)) (s : S) (t : Instant),
inv (inc s tick) ->
isTrace_T ((inc s tick, Inc t) ^ x) ->
isTrace_T ((s, t) ^ (inc s tick, Inc t) ^ x)
| isTraceDisc_T :
forall (x : Stream (S * Instant)) (s1 s2 : S)
(t : Instant) (l : Label),
tr s1 l s2 ->
inv s2 ->
isTrace_T ((s2, t) ^ x) -> isTrace_T ((s1, t) ^ (s2, t) ^ x).
Definition isTraceFrom_T (Sini : S * Instant) (x : Stream (S * Instant)) :=
Sini = hd x /\ isTrace_T x.
(* operator Until *)
Inductive Until_bound (P Q : Stream (S * Instant) -> Prop) :
Stream (S * Instant) -> Prop :=
| UntilFurther_bound :
forall (s : S * Instant) (x : Stream (S * Instant)),
P (s ^ x) -> Until_bound P Q x -> Until_bound P Q (s ^ x)
| UntilHere_bound :
forall (s : S) (t : Instant) (x : Stream (S * Instant)),
bound t -> Q ((s, t) ^ x) -> Until_bound P Q ((s, t) ^ x).
Inductive EX_Until_bound (Sini : S * Instant)
(P Q : Stream (S * Instant) -> Prop) : Prop :=
ExUntil_bound :
forall x : Stream (S * Instant),
isTraceFrom_T Sini x -> Until_bound P Q x -> EX_Until_bound Sini P Q.
Definition FA_Until_bound (Sini : S * Instant)
(P Q : Stream (S * Instant) -> Prop) :=
forall x : Stream (S * Instant),
isTraceFrom_T Sini x -> Until_bound P Q x.
(* Init => FA[](bound t) P *)
Definition Always_T (Sini : S * Instant)
(P : Stream (S * Instant) -> Prop) :=
forall x : Stream (S * Instant),
isTraceFrom_T Sini x ->
ForAllS (fun s : Stream (S * Instant) => bound (snd (hd s)) -> P s) x.
(* Init => FA<>(bound t) P *)
Definition Inevitable_T (Sini : S * Instant)
(P : Stream (S * Instant) -> Prop) :=
forall x : Stream (S * Instant),
isTraceFrom_T Sini x ->
ExistsS (fun s : Stream (S * Instant) => bound (snd (hd s)) /\ P s) x.
(* Init => EX<>(bound t) P *)
Inductive Posible_T (Sini : S * Instant) (P : Stream (S * Instant) -> Prop)
: Prop :=
posible_T :
forall x : Stream (S * Instant),
isTraceFrom_T Sini x ->
ExistsS (fun s : Stream (S * Instant) => bound (snd (hd s)) /\ P s) x ->
Posible_T Sini P.
(* Init => EX[](bound t) P *)
Inductive SafePath_T (Sini : S * Instant)
(P : Stream (S * Instant) -> Prop) : Prop :=
safePath_T :
forall x : Stream (S * Instant),
isTraceFrom_T Sini x ->
ForAllS (fun s : Stream (S * Instant) => bound (snd (hd s)) -> P s) x ->
SafePath_T Sini P.
(**************************************************************************)
(*                            Some Properties                             *)
(**************************************************************************)

Theorem Equiv2_T :
forall (Sini : S * Instant) (P : Stream (S * Instant) -> Prop),
Inevitable_T Sini P <->
FA_Until_bound Sini (fun _ : Stream (S * Instant) => True) P.