@@ -57,9 +57,13 @@ CoInductive always1 (P: T->Prop) : infseq T -> Prop :=
5757CoInductive always (P: infseq T->Prop ) : infseq T -> Prop :=
5858 | Always : forall s, P s -> always P (tl s) -> always P s.
5959
60- CoInductive until (J P: infseq T->Prop ) : infseq T -> Prop :=
61- | Until0 : forall s, P s -> until J P s
62- | Until_tl : forall s, J s -> until J P (tl s) -> until J P s.
60+ CoInductive weak_until (J P: infseq T->Prop ) : infseq T -> Prop :=
61+ | W0 : forall s, P s -> weak_until J P s
62+ | W_tl : forall s, J s -> weak_until J P (tl s) -> weak_until J P s.
63+
64+ Inductive until (J P: infseq T->Prop ) : infseq T -> Prop :=
65+ | U0 : forall s, P s -> until J P s
66+ | U_next : forall x s, J (Cons x s) -> until J P s -> until J P (Cons x s).
6367
6468Inductive eventually (P: infseq T->Prop ) : infseq T -> Prop :=
6569 | E0 : forall s, P s -> eventually P s
@@ -89,6 +93,7 @@ Implicit Arguments consecutive [T].
8993Implicit Arguments always [T].
9094Implicit Arguments always1 [T].
9195Implicit Arguments eventually [T].
96+ Implicit Arguments weak_until [T].
9297Implicit Arguments until [T].
9398Implicit Arguments inf_often [T].
9499Implicit Arguments continuously [T].
@@ -190,14 +195,14 @@ apply E0.
190195assumption.
191196Qed .
192197
193- (* until and eventually facts *)
198+ (* weak_until and eventually facts *)
194199
195- Lemma until_Cons :
200+ Lemma weak_until_Cons :
196201 forall (x: T) (s: infseq T) J P,
197- until J P (Cons x s) -> P (Cons x s) \/ (J (Cons x s) /\ until J P s).
202+ weak_until J P (Cons x s) -> P (Cons x s) \/ (J (Cons x s) /\ weak_until J P s).
198203Proof .
199204intros x s J P un.
200- change (P (Cons x s) \/ (J (Cons x s) /\ until J P (tl (Cons x s)))).
205+ change (P (Cons x s) \/ (J (Cons x s) /\ weak_until J P (tl (Cons x s)))).
201206destruct un; intuition.
202207Qed .
203208
@@ -246,37 +251,57 @@ induction 1 as [s Ps | x s evPs induc_hyp].
246251 intro al. constructor 2. apply induc_hyp. apply (always_invar _ _ _ al).
247252Qed .
248253
249- Lemma eventually_until_cumul :
254+ Lemma eventually_weak_until_cumul :
250255 forall (s: infseq T) P J,
251- eventually P s -> until J P s -> eventually (P /\_ until J P) s.
256+ eventually P s -> weak_until J P s -> eventually (P /\_ weak_until J P) s.
252257Proof .
253258intros s P J ev. induction ev as [s Ps | x s evPs induc_hyp].
254259 intro un. constructor 1. split; assumption.
255- intro unxs. case (until_Cons _ _ _ _ unxs).
256- intro Pxs. constructor 1; split; assumption.
257- intros (_, uns). constructor 2. apply induc_hyp. exact uns.
260+ intro unxs. case (weak_until_Cons _ _ _ _ unxs).
261+ intro Pxs. constructor 1; split; assumption.
262+ intros (_, uns). constructor 2. apply induc_hyp. exact uns.
258263Qed .
259264
260- Lemma until_eventually :
265+ Lemma weak_until_eventually :
261266 forall (P Q J: infseq T -> Prop),
262267 (forall s, J s -> P s -> Q s) ->
263- forall s, J s -> until J Q s -> eventually P s -> eventually Q s.
268+ forall s, J s -> weak_until J Q s -> eventually P s -> eventually Q s.
264269Proof .
265- intros P Q J impl s Js J_until_Q ev.
266- genclear J_until_Q ; genclear Js.
270+ intros P Q J impl s Js J_weak_until_Q ev.
271+ genclear J_weak_until_Q ; genclear Js.
267272induction ev as [s Ps | x s ev induc_hyp].
268- intros Js J_until_Q . constructor 1. apply impl; assumption.
269- intros _ J_until_Q . cut (s = tl (Cons x s)); [idtac | reflexivity].
270- case J_until_Q ; clear J_until_Q x.
273+ intros Js J_weak_until_Q . constructor 1. apply impl; assumption.
274+ intros _ J_weak_until_Q . cut (s = tl (Cons x s)); [idtac | reflexivity].
275+ case J_weak_until_Q ; clear J_weak_until_Q x.
271276 constructor 1; assumption.
272- intros (x, s1) _ J_until_Q e; simpl in *.
273- constructor 2. generalize e J_until_Q ; clear e x. (* trick: keep J_until_Q !! *)
274- case J_until_Q ; clear J_until_Q s1.
277+ intros (x, s1) _ J_weak_until_Q e; simpl in *.
278+ constructor 2. generalize e J_weak_until_Q ; clear e x. (* trick: keep J_weak_until_Q !! *)
279+ case J_weak_until_Q ; clear J_weak_until_Q s1.
275280 clearall. constructor 1; assumption.
276- intros s2 Js2 _ e J_until_Q2 . rewrite e in induc_hyp; clear e.
281+ intros s2 Js2 _ e J_weak_until_Q2 . rewrite e in induc_hyp; clear e.
277282 apply induc_hyp; assumption.
278283Qed .
279284
285+ (* until facts *)
286+
287+ Lemma until_Cons :
288+ forall (x: T) (s: infseq T) J P,
289+ until J P (Cons x s) -> P (Cons x s) \/ (J (Cons x s) /\ until J P s).
290+ Proof .
291+ intros x s J P ul.
292+ change (P (Cons x s) \/ (J (Cons x s) /\ until J P (tl (Cons x s)))). case ul; auto.
293+ Qed .
294+
295+ Lemma until_eventually :
296+ forall (P J: infseq T -> Prop),
297+ forall s, until J P s -> eventually P s.
298+ Proof .
299+ intros P J s unP.
300+ induction unP.
301+ apply E0; assumption.
302+ apply E_next; assumption.
303+ Qed .
304+
280305(* inf_often and continuously facts *)
281306
282307Lemma inf_often_invar :
@@ -348,15 +373,28 @@ generalize (always_Cons x s P a); simpl; intros (a1, a2). constructor; simpl.
348373 apply cf. assumption.
349374Qed .
350375
376+ Lemma weak_until_monotonic :
377+ forall (P Q J K: infseq T -> Prop),
378+ (forall s, P s -> Q s) -> (forall s, J s -> K s) ->
379+ forall s, weak_until J P s -> weak_until K Q s.
380+ Proof .
381+ intros P Q J K PQ JK. cofix cf. intros(x, s) un.
382+ generalize (weak_until_Cons x s J P un); simpl. intros [Pxs | (Jxs, uns)].
383+ constructor 1; simpl; auto.
384+ constructor 2; simpl; auto.
385+ Qed .
386+
351387Lemma until_monotonic :
352388 forall (P Q J K: infseq T -> Prop),
353- (forall s, P s -> Q s) -> (forall s, J s -> K s) ->
389+ (forall s, P s -> Q s) -> (forall s, J s -> K s) ->
354390 forall s, until J P s -> until K Q s.
355391Proof .
356- intros P Q J K PQ JK. cofix cf. intros(x, s) un.
357- generalize (until_Cons x s J P un); simpl. intros [Pxs | (Jxs, uns)].
358- constructor 1; simpl; auto.
359- constructor 2; simpl; auto.
392+ intros P Q J K PQ JK s unJP.
393+ induction unJP.
394+ apply U0, PQ; assumption.
395+ apply U_next.
396+ apply JK; assumption.
397+ assumption.
360398Qed .
361399
362400Lemma eventually_monotonic :
@@ -452,15 +490,15 @@ contradict IHeP.
452490assumption.
453491Qed .
454492
455- Lemma until_always_not_always :
493+ Lemma weak_until_always_not_always :
456494 forall (J P : infseq T -> Prop) (s : infseq T),
457- until J P s -> always (~_ P) s -> always J s.
495+ weak_until J P s -> always (~_ P) s -> always J s.
458496Proof .
459497intros J P.
460498cofix c.
461499intros s unJP alP.
462500destruct s as [e s].
463- apply until_Cons in unJP.
501+ apply weak_until_Cons in unJP.
464502case unJP.
465503 intro PC.
466504 apply always_Cons in alP.
@@ -596,14 +634,17 @@ Implicit Arguments always_always1 [T s P].
596634Implicit Arguments always_inf_often [T s P].
597635Implicit Arguments always_continuously [T s P].
598636
599- Implicit Arguments until_Cons [T x s J P].
637+ Implicit Arguments weak_until_Cons [T x s J P].
600638Implicit Arguments eventually_Cons [T x s P].
601639Implicit Arguments eventually_trans [T P Q inv s].
602640Implicit Arguments not_eventually [T P x s].
603641Implicit Arguments eventually_next [T P s].
604642Implicit Arguments eventually_always_cumul [T s P Q].
605- Implicit Arguments eventually_until_cumul [T s P J].
606- Implicit Arguments until_eventually [T P Q s J].
643+ Implicit Arguments eventually_weak_until_cumul [T s P J].
644+ Implicit Arguments weak_until_eventually [T P Q s J].
645+
646+ Implicit Arguments until_Cons [T x s J P].
647+ Implicit Arguments until_eventually [T s J P].
607648
608649Implicit Arguments inf_often_invar [T x s P].
609650Implicit Arguments continuously_invar [T x s P].
@@ -613,6 +654,7 @@ Implicit Arguments now_monotonic [T P Q s].
613654Implicit Arguments next_monotonic [T P Q s].
614655Implicit Arguments consecutive_monotonic [T P Q s].
615656Implicit Arguments always_monotonic [T P Q s].
657+ Implicit Arguments weak_until_monotonic [T P Q J K s].
616658Implicit Arguments until_monotonic [T P Q J K s].
617659Implicit Arguments eventually_monotonic [T P Q s].
618660Implicit Arguments eventually_monotonic_simple [T P Q s].
@@ -621,7 +663,7 @@ Implicit Arguments continuously_monotonic [T P Q s].
621663
622664Implicit Arguments not_eventually_always_not [T P s].
623665Implicit Arguments eventually_not_always [T P s].
624- Implicit Arguments until_always_not_always [T J P s].
666+ Implicit Arguments weak_until_always_not_always [T J P s].
625667Implicit Arguments always_not_eventually_not [T P s].
626668Implicit Arguments continuously_not_inf_often [T P s].
627669Implicit Arguments inf_often_not_continuously [T P s].
@@ -640,9 +682,10 @@ Ltac monotony :=
640682 | [ |- consecutive ?P ?s -> consecutive ?Q ?s ] =>
641683 apply consecutive_monotonic
642684 | [ |- always ?P ?s -> always ?Q ?s ] => apply always_monotonic
685+ | [ |- weak_until ?J ?P ?s -> weak_until ?K ?Q ?s ] => apply weak_until_monotonic
686+ | [ |- until ?J ?P ?s -> until ?K ?Q ?s ] => apply until_monotonic
643687 | [ |- ?J ?s -> eventually ?P ?s -> eventually ?Q ?s ] =>
644688 apply eventually_monotonic
645- | [ |- until ?J ?P ?s -> until ?K ?Q ?s ] => apply until_monotonic
646689 | [ |- continuously ?P ?s -> continuously ?Q ?s ] =>
647690 apply continuously_monotonic
648691 | [ |- inf_often ?P ?s -> inf_often ?Q ?s ] =>
0 commit comments