src/HOL/Library/Linear_Temporal_Logic_on_Streams.thy
changeset 64320 ba194424b895
parent 63117 acb6d72fc42e
child 64911 f0e07600de47
equal deleted inserted replaced
64319:a33bbac43359 64320:ba194424b895
   660   using sfilter_Stream[of P "shd s" "stl s"] by simp
   660   using sfilter_Stream[of P "shd s" "stl s"] by simp
   661 
   661 
   662 lemma sfilter_not_P[simp]: "\<not> P (shd s) \<Longrightarrow> sfilter P s = sfilter P (stl s)"
   662 lemma sfilter_not_P[simp]: "\<not> P (shd s) \<Longrightarrow> sfilter P s = sfilter P (stl s)"
   663   using sfilter_Stream[of P "shd s" "stl s"] by simp
   663   using sfilter_Stream[of P "shd s" "stl s"] by simp
   664 
   664 
   665 lemma sfilter_eq: 
   665 lemma sfilter_eq:
   666   assumes "ev (holds P) s"
   666   assumes "ev (holds P) s"
   667   shows "sfilter P s = x ## s' \<longleftrightarrow>
   667   shows "sfilter P s = x ## s' \<longleftrightarrow>
   668     P x \<and> (not (holds P) suntil (HLD {x} aand nxt (\<lambda>s. sfilter P s = s'))) s"
   668     P x \<and> (not (holds P) suntil (HLD {x} aand nxt (\<lambda>s. sfilter P s = s'))) s"
   669   using assms
   669   using assms
   670   by (induct rule: ev_induct_strong)
   670   by (induct rule: ev_induct_strong)
   683   assumes *: "alw (ev (holds P)) s"
   683   assumes *: "alw (ev (holds P)) s"
   684   shows "alw Q (sfilter P s) \<longleftrightarrow> alw (\<lambda>x. Q (sfilter P x)) s"
   684   shows "alw Q (sfilter P s) \<longleftrightarrow> alw (\<lambda>x. Q (sfilter P x)) s"
   685 proof
   685 proof
   686   assume "alw Q (sfilter P s)" with * show "alw (\<lambda>x. Q (sfilter P x)) s"
   686   assume "alw Q (sfilter P s)" with * show "alw (\<lambda>x. Q (sfilter P x)) s"
   687   proof (coinduction arbitrary: s rule: alw_coinduct)
   687   proof (coinduction arbitrary: s rule: alw_coinduct)
   688     case (stl s) 
   688     case (stl s)
   689     then have "ev (holds P) s"
   689     then have "ev (holds P) s"
   690       by blast
   690       by blast
   691     from this stl show ?case
   691     from this stl show ?case
   692       by (induct rule: ev_induct_strong) auto
   692       by (induct rule: ev_induct_strong) auto
   693   qed auto
   693   qed auto
   694 next
   694 next
   695   assume "alw (\<lambda>x. Q (sfilter P x)) s" with * show "alw Q (sfilter P s)"
   695   assume "alw (\<lambda>x. Q (sfilter P x)) s" with * show "alw Q (sfilter P s)"
   696   proof (coinduction arbitrary: s rule: alw_coinduct)
   696   proof (coinduction arbitrary: s rule: alw_coinduct)
   697     case (stl s) 
   697     case (stl s)
   698     then have "ev (holds P) s"
   698     then have "ev (holds P) s"
   699       by blast
   699       by blast
   700     from this stl show ?case
   700     from this stl show ?case
   701       by (induct rule: ev_induct_strong) auto
   701       by (induct rule: ev_induct_strong) auto
   702   qed auto
   702   qed auto
   765 qed (auto intro: suntil.intros)
   765 qed (auto intro: suntil.intros)
   766 
   766 
   767 lemma hld_smap': "HLD x (smap f s) = HLD (f -` x) s"
   767 lemma hld_smap': "HLD x (smap f s) = HLD (f -` x) s"
   768   by (simp add: HLD_def)
   768   by (simp add: HLD_def)
   769 
   769 
       
   770 lemma pigeonhole_stream:
       
   771   assumes "alw (HLD s) \<omega>"
       
   772   assumes "finite s"
       
   773   shows "\<exists>x\<in>s. alw (ev (HLD {x})) \<omega>"
       
   774 proof -
       
   775   have "\<forall>i\<in>UNIV. \<exists>x\<in>s. \<omega> !! i = x"
       
   776     using `alw (HLD s) \<omega>` by (simp add: alw_iff_sdrop HLD_iff)
       
   777   from pigeonhole_infinite_rel[OF infinite_UNIV_nat `finite s` this]
       
   778   show ?thesis
       
   779     by (simp add: HLD_iff infinite_iff_alw_ev[symmetric])
       
   780 qed
       
   781 
       
   782 lemma ev_eq_suntil: "ev P \<omega> \<longleftrightarrow> (not P suntil P) \<omega>"
       
   783 proof
       
   784   assume "ev P \<omega>" then show "((\<lambda>xs. \<not> P xs) suntil P) \<omega>"
       
   785     by (induction rule: ev_induct_strong) (auto intro: suntil.intros)
       
   786 qed (auto simp: ev_suntil)
       
   787 
   770 end
   788 end