src/HOLCF/ex/Stream.thy
changeset 16218 ea49a9c7ff7c
parent 15188 9d57263faf9e
child 16417 9bc16273c2d4
equal deleted inserted replaced
16217:96f0c8546265 16218:ea49a9c7ff7c
    26 (* concatenation *)
    26 (* concatenation *)
    27 
    27 
    28 consts
    28 consts
    29  
    29  
    30   i_rt :: "nat => 'a stream => 'a stream" (* chops the first i elements *)
    30   i_rt :: "nat => 'a stream => 'a stream" (* chops the first i elements *)
    31   i_th :: "nat => 'a stream => 'a"        (* the i-th element ä*)
    31   i_th :: "nat => 'a stream => 'a"        (* the i-th element *)
    32 
    32 
    33   sconc         :: "'a stream => 'a stream => 'a stream" (infixr "ooo" 65) 
    33   sconc         :: "'a stream => 'a stream => 'a stream" (infixr "ooo" 65) 
    34   constr_sconc  :: "'a stream => 'a stream => 'a stream" (* constructive *)
    34   constr_sconc  :: "'a stream => 'a stream => 'a stream" (* constructive *)
    35   constr_sconc' :: "nat => 'a stream => 'a stream => 'a stream" 
    35   constr_sconc' :: "nat => 'a stream => 'a stream => 'a stream" 
    36 
    36 
   133 
   133 
   134 lemma surjectiv_scons: "(ft$s)&&(rt$s)=s"
   134 lemma surjectiv_scons: "(ft$s)&&(rt$s)=s"
   135 by (rule stream.casedist [of s], auto)
   135 by (rule stream.casedist [of s], auto)
   136 
   136 
   137 lemma monofun_rt_mult: "x << s ==> iterate i rt x << iterate i rt s"
   137 lemma monofun_rt_mult: "x << s ==> iterate i rt x << iterate i rt s"
   138 by (insert monofun_iterate2 [of i "rt"], simp add: monofun, auto)
   138 by (insert monofun_iterate2 [of i "rt"], simp add: monofun_def, auto)
   139 
   139 
   140 
   140 
   141 
   141 
   142 (* ----------------------------------------------------------------------- *)
   142 (* ----------------------------------------------------------------------- *)
   143 (* theorems about stream_take                                              *)
   143 (* theorems about stream_take                                              *)
   953 lemma contlub_scons: "contlub (%x. a && x)"
   953 lemma contlub_scons: "contlub (%x. a && x)"
   954 by (simp add: contlub_Rep_CFun2)
   954 by (simp add: contlub_Rep_CFun2)
   955 
   955 
   956 lemma contlub_scons_lemma: "chain S ==> (LUB i. a && S i) = a && (LUB i. S i)"
   956 lemma contlub_scons_lemma: "chain S ==> (LUB i. a && S i) = a && (LUB i. S i)"
   957 apply (insert contlub_scons [of a])
   957 apply (insert contlub_scons [of a])
   958 by (simp only: contlub)
   958 by (simp only: contlub_def)
   959 
   959 
   960 lemma finite_lub_sconc: "chain Y ==> (stream_finite x) ==> 
   960 lemma finite_lub_sconc: "chain Y ==> (stream_finite x) ==> 
   961                         (LUB i. x ooo Y i) = (x ooo (LUB i. Y i))"
   961                         (LUB i. x ooo Y i) = (x ooo (LUB i. Y i))"
   962 apply (rule stream_finite_ind [of x])
   962 apply (rule stream_finite_ind [of x])
   963  apply (auto)
   963  apply (auto)
   976 
   976 
   977 lemma contlub_sconc: "contlub (%y. x ooo y)"; 
   977 lemma contlub_sconc: "contlub (%y. x ooo y)"; 
   978 by (rule contlubI, insert contlub_sconc_lemma [of _ x], simp);
   978 by (rule contlubI, insert contlub_sconc_lemma [of _ x], simp);
   979 
   979 
   980 lemma monofun_sconc: "monofun (%y. x ooo y)"
   980 lemma monofun_sconc: "monofun (%y. x ooo y)"
   981 by (simp add: monofun sconc_mono)
   981 by (simp add: monofun_def sconc_mono)
   982 
   982 
   983 lemma cont_sconc: "cont (%y. x ooo y)"
   983 lemma cont_sconc: "cont (%y. x ooo y)"
   984 apply (rule  monocontlub2cont)
   984 apply (rule  monocontlub2cont)
   985  apply (rule monofunI, simp add: sconc_mono)
   985  apply (rule monofunI, simp add: sconc_mono)
   986 by (rule contlub_sconc);
   986 by (rule contlub_sconc);