@@ -180,15 +180,29 @@ intros (x, s) a. case (always_Cons a); intros a1 a2. constructor.
180180 rewrite map_Cons; simpl. apply cf; assumption.
181181Qed .
182182
183+ Lemma always_map_conv_ext :
184+ forall (f: A->B) (P: infseq A->Prop) (Q: infseq B->Prop) (J : infseq A -> Prop),
185+ (forall x s, J (Cons x s) -> J s) ->
186+ (forall s, J s -> Q (map f s) -> P s) ->
187+ forall s, J s -> always Q (map f s) -> always P s.
188+ Proof .
189+ intros f J P Q inv JQP. cofix c.
190+ intros [x s] Js a.
191+ rewrite map_Cons in a. case (always_Cons a); intros a1 a2. constructor.
192+ apply JQP. assumption.
193+ rewrite map_Cons; assumption.
194+ simpl. apply c.
195+ apply (inv x). assumption.
196+ assumption.
197+ Qed .
198+
183199Lemma always_map_conv :
184200 forall (f: A->B) (P: infseq A->Prop) (Q: infseq B->Prop),
185201 (forall s, Q (map f s) -> P s) ->
186202 forall (s: infseq A), always Q (map f s) -> always P s.
187203Proof .
188- intros f P Q QP. cofix cf.
189- intros (x, s) a. rewrite map_Cons in a. case (always_Cons a); intros a1 a2. constructor.
190- apply QP. rewrite map_Cons; assumption.
191- simpl. apply cf; assumption.
204+ intros f P Q QP s.
205+ apply (always_map_conv_ext f P Q (fun _ => True)); auto.
192206Qed .
193207
194208Lemma weak_until_map :
@@ -345,10 +359,67 @@ assert (efst: eventually P (map fstAB (zip s (map f s)))).
345359 constructor 1; simpl. apply QP. assumption.
346360 rewrite map_Cons. constructor 2. apply induc_hyp.
347361genclear efst. apply extensional_eventually.
348- exact extP.
362+ exact extP.
349363 apply exteq_fst_zip.
350364Qed .
351365
366+ Lemma eventually_map_conv_ext :
367+ forall (f: A->B) (P: infseq A->Prop) (Q: infseq B->Prop) (J : infseq A -> Prop),
368+ extensional P -> extensional Q -> extensional J ->
369+ (forall x s, J (Cons x s) -> J s) ->
370+ (forall s, J s -> Q (map f s) -> eventually P s) ->
371+ forall s, J s -> eventually Q (map f s) -> eventually P s.
372+ Proof .
373+ intros f P Q J extP extQ extJ inv QP s Js ev.
374+ revert Js.
375+ assert (efst: J (map fstAB (zip s (map f s))) -> eventually P (map fstAB (zip s (map f s)))).
376+ assert (evzip : eventually (fun sc => Q (map f (map fstAB sc))) (zip s (map f s))).
377+ clear extP QP P.
378+ assert (alzip : (always (now (fun c : A * B => let (x, y) := c in y = f x)) (zip s (map f s)))).
379+ clear ev extQ. generalize s. cofix cf. intros (x, s0). constructor.
380+ simpl. reflexivity.
381+ simpl. apply cf.
382+ apply (eventually_map_conv_aux f Q extQ s (map f s) alzip ev).
383+ clear ev. induction evzip as [((a, b), sAB) QabsAB | c sAB _ induc_hyp].
384+ intros Js.
385+ apply QP; assumption.
386+ intros Js.
387+ rewrite map_Cons.
388+ apply E_next.
389+ apply induc_hyp.
390+ rewrite map_Cons in Js.
391+ apply (inv (fstAB c)).
392+ assumption.
393+ intros Js.
394+ assert (emJ: J (map fstAB (zip s (map f s)))).
395+ unfold extensional in extJ.
396+ apply (extJ s).
397+ apply exteq_sym. apply exteq_fst_zip.
398+ assumption.
399+ apply efst in emJ.
400+ genclear emJ.
401+ apply extensional_eventually.
402+ exact extP.
403+ apply exteq_fst_zip.
404+ Qed .
405+
406+ Lemma eventually_map_monotonic :
407+ forall (f: A->B) (P Q J: infseq A->Prop) (K : infseq B -> Prop),
408+ (forall x s, J (Cons x s) -> J s) ->
409+ (forall x s, K (map f (Cons x s)) -> K (map f s)) ->
410+ (forall s, J s -> K (map f s) -> Q s -> P s) ->
411+ forall s, J s -> K (map f s) -> eventually Q s -> eventually P s.
412+ Proof .
413+ intros f P Q J K Jinv Kinv JKQP s invJ invK ev.
414+ induction ev as [s Qs | x s ev IHev].
415+ apply E0.
416+ apply JKQP; assumption.
417+ apply E_next.
418+ apply IHev.
419+ apply (Jinv x); assumption.
420+ apply (Kinv x); assumption.
421+ Qed .
422+
352423Lemma inf_often_map :
353424 forall (f: A->B) (P: infseq A->Prop) (Q: infseq B->Prop),
354425 (forall s, P s -> Q (map f s)) ->
0 commit comments