author | nipkow |
Mon, 12 Sep 2011 07:55:43 +0200 | |
changeset 44890 | 22f665a2e91c |
parent 44019 | ee784502aed5 |
child 49521 | 06cb12198b92 |
permissions | -rw-r--r-- |
42151 | 1 |
(* Title: HOL/HOLCF/Library/Stream.thy |
17291 | 2 |
Author: Franz Regensburger, David von Oheimb, Borislav Gajanovic |
2570 | 3 |
*) |
4 |
||
17291 | 5 |
header {* General Stream domain *} |
6 |
||
7 |
theory Stream |
|
43919 | 8 |
imports HOLCF "~~/src/HOL/Library/Extended_Nat" |
17291 | 9 |
begin |
2570 | 10 |
|
40329
73f2b99b549d
change default_sort of HOLCF from pcpo to bifinite; rename command 'new_domain' to 'domain'; rename 'domain' to 'domain (unsafe)'
huffman
parents:
40327
diff
changeset
|
11 |
default_sort pcpo |
73f2b99b549d
change default_sort of HOLCF from pcpo to bifinite; rename command 'new_domain' to 'domain'; rename 'domain' to 'domain (unsafe)'
huffman
parents:
40327
diff
changeset
|
12 |
|
73f2b99b549d
change default_sort of HOLCF from pcpo to bifinite; rename command 'new_domain' to 'domain'; rename 'domain' to 'domain (unsafe)'
huffman
parents:
40327
diff
changeset
|
13 |
domain (unsafe) 'a stream = scons (ft::'a) (lazy rt::"'a stream") (infixr "&&" 65) |
2570 | 14 |
|
19763 | 15 |
definition |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
19763
diff
changeset
|
16 |
smap :: "('a \<rightarrow> 'b) \<rightarrow> 'a stream \<rightarrow> 'b stream" where |
19763 | 17 |
"smap = fix\<cdot>(\<Lambda> h f s. case s of x && xs \<Rightarrow> f\<cdot>x && h\<cdot>f\<cdot>xs)" |
11348 | 18 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
19763
diff
changeset
|
19 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
19763
diff
changeset
|
20 |
sfilter :: "('a \<rightarrow> tr) \<rightarrow> 'a stream \<rightarrow> 'a stream" where |
19763 | 21 |
"sfilter = fix\<cdot>(\<Lambda> h p s. case s of x && xs \<Rightarrow> |
40322
707eb30e8a53
make syntax of continuous if-then-else consistent with HOL if-then-else
huffman
parents:
40213
diff
changeset
|
22 |
If p\<cdot>x then x && h\<cdot>p\<cdot>xs else h\<cdot>p\<cdot>xs)" |
11348 | 23 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
19763
diff
changeset
|
24 |
definition |
43919 | 25 |
slen :: "'a stream \<Rightarrow> enat" ("#_" [1000] 1000) where |
43924 | 26 |
"#s = (if stream_finite s then enat (LEAST n. stream_take n\<cdot>s = s) else \<infinity>)" |
19763 | 27 |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
28 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
29 |
(* concatenation *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
30 |
|
19763 | 31 |
definition |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
19763
diff
changeset
|
32 |
i_rt :: "nat => 'a stream => 'a stream" where (* chops the first i elements *) |
19763 | 33 |
"i_rt = (%i s. iterate i$rt$s)" |
17291 | 34 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
19763
diff
changeset
|
35 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
19763
diff
changeset
|
36 |
i_th :: "nat => 'a stream => 'a" where (* the i-th element *) |
19763 | 37 |
"i_th = (%i s. ft$(i_rt i s))" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
38 |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
19763
diff
changeset
|
39 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
19763
diff
changeset
|
40 |
sconc :: "'a stream => 'a stream => 'a stream" (infixr "ooo" 65) where |
19763 | 41 |
"s1 ooo s2 = (case #s1 of |
43924 | 42 |
enat n \<Rightarrow> (SOME s. (stream_take n$s=s1) & (i_rt n s = s2)) |
19763 | 43 |
| \<infinity> \<Rightarrow> s1)" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
44 |
|
27361 | 45 |
primrec constr_sconc' :: "nat => 'a stream => 'a stream => 'a stream" |
46 |
where |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
47 |
constr_sconc'_0: "constr_sconc' 0 s1 s2 = s2" |
27361 | 48 |
| constr_sconc'_Suc: "constr_sconc' (Suc n) s1 s2 = ft$s1 && |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
49 |
constr_sconc' n (rt$s1) s2" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
50 |
|
19763 | 51 |
definition |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
19763
diff
changeset
|
52 |
constr_sconc :: "'a stream => 'a stream => 'a stream" where (* constructive *) |
19763 | 53 |
"constr_sconc s1 s2 = (case #s1 of |
43924 | 54 |
enat n \<Rightarrow> constr_sconc' n s1 s2 |
19763 | 55 |
| \<infinity> \<Rightarrow> s1)" |
56 |
||
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
57 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
58 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
59 |
(* theorems about scons *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
60 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
61 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
62 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
63 |
section "scons" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
64 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
65 |
lemma scons_eq_UU: "(a && s = UU) = (a = UU)" |
30913
10b26965a08f
domain package now generates iff rules for definedness of constructors
huffman
parents:
30807
diff
changeset
|
66 |
by simp |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
67 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
68 |
lemma scons_not_empty: "[| a && x = UU; a ~= UU |] ==> R" |
30913
10b26965a08f
domain package now generates iff rules for definedness of constructors
huffman
parents:
30807
diff
changeset
|
69 |
by simp |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
70 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
71 |
lemma stream_exhaust_eq: "(x ~= UU) = (EX a y. a ~= UU & x = a && y)" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
72 |
by (cases x, auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
73 |
|
18109 | 74 |
lemma stream_neq_UU: "x~=UU ==> EX a a_s. x=a&&a_s & a~=UU" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
75 |
by (simp add: stream_exhaust_eq,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
76 |
|
17291 | 77 |
lemma stream_prefix: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
78 |
"[| a && s << t; a ~= UU |] ==> EX b tt. t = b && tt & b ~= UU & s << tt" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
79 |
by (cases t, auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
80 |
|
17291 | 81 |
lemma stream_prefix': |
82 |
"b ~= UU ==> x << b && z = |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
83 |
(x = UU | (EX a y. x = a && y & a ~= UU & a << b & y << z))" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
84 |
by (cases x, auto) |
19550
ae77a20f6995
update to reflect changes in inverts/injects lemmas
huffman
parents:
19440
diff
changeset
|
85 |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
86 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
87 |
(* |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
88 |
lemma stream_prefix1: "[| x<<y; xs<<ys |] ==> x&&xs << y&&ys" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
89 |
by (insert stream_prefix' [of y "x&&xs" ys],force) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
90 |
*) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
91 |
|
17291 | 92 |
lemma stream_flat_prefix: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
93 |
"[| x && xs << y && ys; (x::'a::flat) ~= UU|] ==> x = y & xs << ys" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
94 |
apply (case_tac "y=UU",auto) |
25920 | 95 |
by (drule ax_flat,simp) |
19550
ae77a20f6995
update to reflect changes in inverts/injects lemmas
huffman
parents:
19440
diff
changeset
|
96 |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
97 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
98 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
99 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
100 |
(* ----------------------------------------------------------------------- *) |
40213
b63e966564da
rename case combinators generated by domain package to 'foo_case' instead of 'foo_when'
huffman
parents:
40025
diff
changeset
|
101 |
(* theorems about stream_case *) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
102 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
103 |
|
40213
b63e966564da
rename case combinators generated by domain package to 'foo_case' instead of 'foo_when'
huffman
parents:
40025
diff
changeset
|
104 |
section "stream_case" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
105 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
106 |
|
40213
b63e966564da
rename case combinators generated by domain package to 'foo_case' instead of 'foo_when'
huffman
parents:
40025
diff
changeset
|
107 |
lemma stream_case_strictf: "stream_case$UU$s=UU" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
108 |
by (cases s, auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
109 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
110 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
111 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
112 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
113 |
(* theorems about ft and rt *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
114 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
115 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
116 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
117 |
section "ft & rt" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
118 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
119 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
120 |
lemma ft_defin: "s~=UU ==> ft$s~=UU" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
121 |
by simp |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
122 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
123 |
lemma rt_strict_rev: "rt$s~=UU ==> s~=UU" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
124 |
by auto |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
125 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
126 |
lemma surjectiv_scons: "(ft$s)&&(rt$s)=s" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
127 |
by (cases s, auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
128 |
|
18075 | 129 |
lemma monofun_rt_mult: "x << s ==> iterate i$rt$x << iterate i$rt$s" |
130 |
by (rule monofun_cfun_arg) |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
131 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
132 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
133 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
134 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
135 |
(* theorems about stream_take *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
136 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
137 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
138 |
|
17291 | 139 |
section "stream_take" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
140 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
141 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
142 |
lemma stream_reach2: "(LUB i. stream_take i$s) = s" |
35494
45c9a8278faf
domain package no longer generates copy functions; all proofs use take functions instead
huffman
parents:
35444
diff
changeset
|
143 |
by (rule stream.reach) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
144 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
145 |
lemma chain_stream_take: "chain (%i. stream_take i$s)" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
146 |
by simp |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
147 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
148 |
lemma stream_take_prefix [simp]: "stream_take n$s << s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
149 |
apply (insert stream_reach2 [of s]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
150 |
apply (erule subst) back |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
151 |
apply (rule is_ub_thelub) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
152 |
by (simp only: chain_stream_take) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
153 |
|
17291 | 154 |
lemma stream_take_more [rule_format]: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
155 |
"ALL x. stream_take n$x = x --> stream_take (Suc n)$x = x" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
156 |
apply (induct_tac n,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
157 |
apply (case_tac "x=UU",auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
158 |
by (drule stream_exhaust_eq [THEN iffD1],auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
159 |
|
17291 | 160 |
lemma stream_take_lemma3 [rule_format]: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
161 |
"ALL x xs. x~=UU --> stream_take n$(x && xs) = x && xs --> stream_take n$xs=xs" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
162 |
apply (induct_tac n,clarsimp) |
16745 | 163 |
(*apply (drule sym, erule scons_not_empty, simp)*) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
164 |
apply (clarify, rule stream_take_more) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
165 |
apply (erule_tac x="x" in allE) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
166 |
by (erule_tac x="xs" in allE,simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
167 |
|
17291 | 168 |
lemma stream_take_lemma4: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
169 |
"ALL x xs. stream_take n$xs=xs --> stream_take (Suc n)$(x && xs) = x && xs" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
170 |
by auto |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
171 |
|
17291 | 172 |
lemma stream_take_idempotent [rule_format, simp]: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
173 |
"ALL s. stream_take n$(stream_take n$s) = stream_take n$s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
174 |
apply (induct_tac n, auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
175 |
apply (case_tac "s=UU", auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
176 |
by (drule stream_exhaust_eq [THEN iffD1], auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
177 |
|
17291 | 178 |
lemma stream_take_take_Suc [rule_format, simp]: |
179 |
"ALL s. stream_take n$(stream_take (Suc n)$s) = |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
180 |
stream_take n$s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
181 |
apply (induct_tac n, auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
182 |
apply (case_tac "s=UU", auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
183 |
by (drule stream_exhaust_eq [THEN iffD1], auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
184 |
|
17291 | 185 |
lemma mono_stream_take_pred: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
186 |
"stream_take (Suc n)$s1 << stream_take (Suc n)$s2 ==> |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
187 |
stream_take n$s1 << stream_take n$s2" |
17291 | 188 |
by (insert monofun_cfun_arg [of "stream_take (Suc n)$s1" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
189 |
"stream_take (Suc n)$s2" "stream_take n"], auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
190 |
(* |
17291 | 191 |
lemma mono_stream_take_pred: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
192 |
"stream_take (Suc n)$s1 << stream_take (Suc n)$s2 ==> |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
193 |
stream_take n$s1 << stream_take n$s2" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
194 |
by (drule mono_stream_take [of _ _ n],simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
195 |
*) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
196 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
197 |
lemma stream_take_lemma10 [rule_format]: |
17291 | 198 |
"ALL k<=n. stream_take n$s1 << stream_take n$s2 |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
199 |
--> stream_take k$s1 << stream_take k$s2" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
200 |
apply (induct_tac n,simp,clarsimp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
201 |
apply (case_tac "k=Suc n",blast) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
202 |
apply (erule_tac x="k" in allE) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
203 |
by (drule mono_stream_take_pred,simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
204 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
205 |
lemma stream_take_le_mono : "k<=n ==> stream_take k$s1 << stream_take n$s1" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
206 |
apply (insert chain_stream_take [of s1]) |
25922
cb04d05e95fb
rename lemma chain_mono3 -> chain_mono, chain_mono -> chain_mono_less
huffman
parents:
25920
diff
changeset
|
207 |
by (drule chain_mono,auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
208 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
209 |
lemma mono_stream_take: "s1 << s2 ==> stream_take n$s1 << stream_take n$s2" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
210 |
by (simp add: monofun_cfun_arg) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
211 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
212 |
(* |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
213 |
lemma stream_take_prefix [simp]: "stream_take n$s << s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
214 |
apply (subgoal_tac "s=(LUB n. stream_take n$s)") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
215 |
apply (erule ssubst, rule is_ub_thelub) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
216 |
apply (simp only: chain_stream_take) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
217 |
by (simp only: stream_reach2) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
218 |
*) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
219 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
220 |
lemma stream_take_take_less:"stream_take k$(stream_take n$s) << stream_take k$s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
221 |
by (rule monofun_cfun_arg,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
222 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
223 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
224 |
(* ------------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
225 |
(* special induction rules *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
226 |
(* ------------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
227 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
228 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
229 |
section "induction" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
230 |
|
17291 | 231 |
lemma stream_finite_ind: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
232 |
"[| stream_finite x; P UU; !!a s. [| a ~= UU; P s |] ==> P (a && s) |] ==> P x" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
233 |
apply (simp add: stream.finite_def,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
234 |
apply (erule subst) |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
235 |
by (drule stream.finite_induct [of P _ x], auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
236 |
|
17291 | 237 |
lemma stream_finite_ind2: |
238 |
"[| P UU; !! x. x ~= UU ==> P (x && UU); !! y z s. [| y ~= UU; z ~= UU; P s |] ==> P (y && z && s )|] ==> |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
239 |
!s. P (stream_take n$s)" |
29855
e0ab6cf95539
Repaired a proof that did, after all, refer to the theorem nat_induct2.
paulson
parents:
29530
diff
changeset
|
240 |
apply (rule nat_less_induct [of _ n],auto) |
e0ab6cf95539
Repaired a proof that did, after all, refer to the theorem nat_induct2.
paulson
parents:
29530
diff
changeset
|
241 |
apply (case_tac n, auto) |
e0ab6cf95539
Repaired a proof that did, after all, refer to the theorem nat_induct2.
paulson
parents:
29530
diff
changeset
|
242 |
apply (case_tac nat, auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
243 |
apply (case_tac "s=UU",clarsimp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
244 |
apply (drule stream_exhaust_eq [THEN iffD1],clarsimp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
245 |
apply (case_tac "s=UU",clarsimp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
246 |
apply (drule stream_exhaust_eq [THEN iffD1],clarsimp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
247 |
apply (case_tac "y=UU",clarsimp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
248 |
by (drule stream_exhaust_eq [THEN iffD1],clarsimp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
249 |
|
17291 | 250 |
lemma stream_ind2: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
251 |
"[| adm P; P UU; !!a. a ~= UU ==> P (a && UU); !!a b s. [| a ~= UU; b ~= UU; P s |] ==> P (a && b && s) |] ==> P x" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
252 |
apply (insert stream.reach [of x],erule subst) |
35494
45c9a8278faf
domain package no longer generates copy functions; all proofs use take functions instead
huffman
parents:
35444
diff
changeset
|
253 |
apply (erule admD, rule chain_stream_take) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
254 |
apply (insert stream_finite_ind2 [of P]) |
35494
45c9a8278faf
domain package no longer generates copy functions; all proofs use take functions instead
huffman
parents:
35444
diff
changeset
|
255 |
by simp |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
256 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
257 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
258 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
259 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
260 |
(* simplify use of coinduction *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
261 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
262 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
263 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
264 |
section "coinduction" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
265 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
266 |
lemma stream_coind_lemma2: "!s1 s2. R s1 s2 --> ft$s1 = ft$s2 & R (rt$s1) (rt$s2) ==> stream_bisim R" |
30807 | 267 |
apply (simp add: stream.bisim_def,clarsimp) |
35497 | 268 |
apply (drule spec, drule spec, drule (1) mp) |
269 |
apply (case_tac "x", simp) |
|
40025 | 270 |
apply (case_tac "y", simp) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
271 |
by auto |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
272 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
273 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
274 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
275 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
276 |
(* theorems about stream_finite *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
277 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
278 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
279 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
280 |
section "stream_finite" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
281 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
282 |
lemma stream_finite_UU [simp]: "stream_finite UU" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
283 |
by (simp add: stream.finite_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
284 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
285 |
lemma stream_finite_UU_rev: "~ stream_finite s ==> s ~= UU" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
286 |
by (auto simp add: stream.finite_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
287 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
288 |
lemma stream_finite_lemma1: "stream_finite xs ==> stream_finite (x && xs)" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
289 |
apply (simp add: stream.finite_def,auto) |
35557
5da670d57118
uniformly use variable names m and n in take-related lemmas; use export_without_context where appropriate
huffman
parents:
35524
diff
changeset
|
290 |
apply (rule_tac x="Suc n" in exI) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
291 |
by (simp add: stream_take_lemma4) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
292 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
293 |
lemma stream_finite_lemma2: "[| x ~= UU; stream_finite (x && xs) |] ==> stream_finite xs" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
294 |
apply (simp add: stream.finite_def, auto) |
35557
5da670d57118
uniformly use variable names m and n in take-related lemmas; use export_without_context where appropriate
huffman
parents:
35524
diff
changeset
|
295 |
apply (rule_tac x="n" in exI) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
296 |
by (erule stream_take_lemma3,simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
297 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
298 |
lemma stream_finite_rt_eq: "stream_finite (rt$s) = stream_finite s" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
299 |
apply (cases s, auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
300 |
apply (rule stream_finite_lemma1, simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
301 |
by (rule stream_finite_lemma2,simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
302 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
303 |
lemma stream_finite_less: "stream_finite s ==> !t. t<<s --> stream_finite t" |
19440 | 304 |
apply (erule stream_finite_ind [of s], auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
305 |
apply (case_tac "t=UU", auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
306 |
apply (drule stream_exhaust_eq [THEN iffD1],auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
307 |
apply (erule_tac x="y" in allE, simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
308 |
by (rule stream_finite_lemma1, simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
309 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
310 |
lemma stream_take_finite [simp]: "stream_finite (stream_take n$s)" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
311 |
apply (simp add: stream.finite_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
312 |
by (rule_tac x="n" in exI,simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
313 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
314 |
lemma adm_not_stream_finite: "adm (%x. ~ stream_finite x)" |
25833 | 315 |
apply (rule adm_upward) |
316 |
apply (erule contrapos_nn) |
|
317 |
apply (erule (1) stream_finite_less [rule_format]) |
|
318 |
done |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
319 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
320 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
321 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
322 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
323 |
(* theorems about stream length *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
324 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
325 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
326 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
327 |
section "slen" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
328 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
329 |
lemma slen_empty [simp]: "#\<bottom> = 0" |
43919 | 330 |
by (simp add: slen_def stream.finite_def zero_enat_def Least_equality) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
331 |
|
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
332 |
lemma slen_scons [simp]: "x ~= \<bottom> ==> #(x&&xs) = eSuc (#xs)" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
333 |
apply (case_tac "stream_finite (x && xs)") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
334 |
apply (simp add: slen_def, auto) |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
335 |
apply (simp add: stream.finite_def, auto simp add: eSuc_enat) |
27111 | 336 |
apply (rule Least_Suc2, auto) |
16745 | 337 |
(*apply (drule sym)*) |
338 |
(*apply (drule sym scons_eq_UU [THEN iffD1],simp)*) |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
339 |
apply (erule stream_finite_lemma2, simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
340 |
apply (simp add: slen_def, auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
341 |
by (drule stream_finite_lemma1,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
342 |
|
43924 | 343 |
lemma slen_less_1_eq: "(#x < enat (Suc 0)) = (x = \<bottom>)" |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
344 |
by (cases x, auto simp add: enat_0 eSuc_enat[THEN sym]) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
345 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
346 |
lemma slen_empty_eq: "(#x = 0) = (x = \<bottom>)" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
347 |
by (cases x, auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
348 |
|
43924 | 349 |
lemma slen_scons_eq: "(enat (Suc n) < #x) = (? a y. x = a && y & a ~= \<bottom> & enat n < #y)" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
350 |
apply (auto, case_tac "x=UU",auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
351 |
apply (drule stream_exhaust_eq [THEN iffD1], auto) |
27111 | 352 |
apply (case_tac "#y") apply simp_all |
353 |
apply (case_tac "#y") apply simp_all |
|
354 |
done |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
355 |
|
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
356 |
lemma slen_eSuc: "#x = eSuc n --> (? a y. x = a&&y & a ~= \<bottom> & #y = n)" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
357 |
by (cases x, auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
358 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
359 |
lemma slen_stream_take_finite [simp]: "#(stream_take n$s) ~= \<infinity>" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
360 |
by (simp add: slen_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
361 |
|
43924 | 362 |
lemma slen_scons_eq_rev: "(#x < enat (Suc (Suc n))) = (!a y. x ~= a && y | a = \<bottom> | #y < enat (Suc n))" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
363 |
apply (cases x, auto) |
43919 | 364 |
apply (simp add: zero_enat_def) |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
365 |
apply (case_tac "#stream") apply (simp_all add: eSuc_enat) |
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
366 |
apply (case_tac "#stream") apply (simp_all add: eSuc_enat) |
27111 | 367 |
done |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
368 |
|
17291 | 369 |
lemma slen_take_lemma4 [rule_format]: |
43924 | 370 |
"!s. stream_take n$s ~= s --> #(stream_take n$s) = enat n" |
371 |
apply (induct n, auto simp add: enat_0) |
|
27111 | 372 |
apply (case_tac "s=UU", simp) |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
373 |
by (drule stream_exhaust_eq [THEN iffD1], auto simp add: eSuc_enat) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
374 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
375 |
(* |
17291 | 376 |
lemma stream_take_idempotent [simp]: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
377 |
"stream_take n$(stream_take n$s) = stream_take n$s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
378 |
apply (case_tac "stream_take n$s = s") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
379 |
apply (auto,insert slen_take_lemma4 [of n s]); |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
380 |
by (auto,insert slen_take_lemma1 [of "stream_take n$s" n],simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
381 |
|
17291 | 382 |
lemma stream_take_take_Suc [simp]: "stream_take n$(stream_take (Suc n)$s) = |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
383 |
stream_take n$s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
384 |
apply (simp add: po_eq_conv,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
385 |
apply (simp add: stream_take_take_less) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
386 |
apply (subgoal_tac "stream_take n$s = stream_take n$(stream_take n$s)") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
387 |
apply (erule ssubst) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
388 |
apply (rule_tac monofun_cfun_arg) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
389 |
apply (insert chain_stream_take [of s]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
390 |
by (simp add: chain_def,simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
391 |
*) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
392 |
|
43924 | 393 |
lemma slen_take_eq: "ALL x. (enat n < #x) = (stream_take n\<cdot>x ~= x)" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
394 |
apply (induct_tac n, auto) |
43924 | 395 |
apply (simp add: enat_0, clarsimp) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
396 |
apply (drule not_sym) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
397 |
apply (drule slen_empty_eq [THEN iffD1], simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
398 |
apply (case_tac "x=UU", simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
399 |
apply (drule stream_exhaust_eq [THEN iffD1], clarsimp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
400 |
apply (erule_tac x="y" in allE, auto) |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
401 |
apply (simp_all add: not_less eSuc_enat) |
27111 | 402 |
apply (case_tac "#y") apply simp_all |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
403 |
apply (case_tac "x=UU", simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
404 |
apply (drule stream_exhaust_eq [THEN iffD1], clarsimp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
405 |
apply (erule_tac x="y" in allE, simp) |
27111 | 406 |
apply (case_tac "#y") by simp_all |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
407 |
|
43924 | 408 |
lemma slen_take_eq_rev: "(#x <= enat n) = (stream_take n\<cdot>x = x)" |
26102 | 409 |
by (simp add: linorder_not_less [symmetric] slen_take_eq) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
410 |
|
43924 | 411 |
lemma slen_take_lemma1: "#x = enat n ==> stream_take n\<cdot>x = x" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
412 |
by (rule slen_take_eq_rev [THEN iffD1], auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
413 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
414 |
lemma slen_rt_mono: "#s2 <= #s1 ==> #(rt$s2) <= #(rt$s1)" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
415 |
apply (cases s1) |
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
416 |
by (cases s2, simp+)+ |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
417 |
|
43924 | 418 |
lemma slen_take_lemma5: "#(stream_take n$s) <= enat n" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
419 |
apply (case_tac "stream_take n$s = s") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
420 |
apply (simp add: slen_take_eq_rev) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
421 |
by (simp add: slen_take_lemma4) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
422 |
|
43924 | 423 |
lemma slen_take_lemma2: "!x. ~stream_finite x --> #(stream_take i\<cdot>x) = enat i" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
424 |
apply (simp add: stream.finite_def, auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
425 |
by (simp add: slen_take_lemma4) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
426 |
|
43921 | 427 |
lemma slen_infinite: "stream_finite x = (#x ~= \<infinity>)" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
428 |
by (simp add: slen_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
429 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
430 |
lemma slen_mono_lemma: "stream_finite s ==> ALL t. s << t --> #s <= #t" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
431 |
apply (erule stream_finite_ind [of s], auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
432 |
apply (case_tac "t=UU", auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
433 |
apply (drule stream_exhaust_eq [THEN iffD1], auto) |
30807 | 434 |
done |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
435 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
436 |
lemma slen_mono: "s << t ==> #s <= #t" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
437 |
apply (case_tac "stream_finite t") |
17291 | 438 |
apply (frule stream_finite_less) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
439 |
apply (erule_tac x="s" in allE, simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
440 |
apply (drule slen_mono_lemma, auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
441 |
by (simp add: slen_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
442 |
|
18075 | 443 |
lemma iterate_lemma: "F$(iterate n$F$x) = iterate n$F$(F$x)" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
444 |
by (insert iterate_Suc2 [of n F x], auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
445 |
|
43924 | 446 |
lemma slen_rt_mult [rule_format]: "!x. enat (i + j) <= #x --> enat j <= #(iterate i$rt$x)" |
27111 | 447 |
apply (induct i, auto) |
43919 | 448 |
apply (case_tac "x=UU", auto simp add: zero_enat_def) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
449 |
apply (drule stream_exhaust_eq [THEN iffD1], auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
450 |
apply (erule_tac x="y" in allE, auto) |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
451 |
apply (simp add: not_le) apply (case_tac "#y") apply (simp_all add: eSuc_enat) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
452 |
by (simp add: iterate_lemma) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
453 |
|
17291 | 454 |
lemma slen_take_lemma3 [rule_format]: |
43924 | 455 |
"!(x::'a::flat stream) y. enat n <= #x --> x << y --> stream_take n\<cdot>x = stream_take n\<cdot>y" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
456 |
apply (induct_tac n, auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
457 |
apply (case_tac "x=UU", auto) |
43919 | 458 |
apply (simp add: zero_enat_def) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
459 |
apply (simp add: Suc_ile_eq) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
460 |
apply (case_tac "y=UU", clarsimp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
461 |
apply (drule stream_exhaust_eq [THEN iffD1], clarsimp)+ |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
462 |
apply (erule_tac x="ya" in allE, simp) |
25920 | 463 |
by (drule ax_flat, simp) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
464 |
|
17291 | 465 |
lemma slen_strict_mono_lemma: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
466 |
"stream_finite t ==> !s. #(s::'a::flat stream) = #t & s << t --> s = t" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
467 |
apply (erule stream_finite_ind, auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
468 |
apply (case_tac "sa=UU", auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
469 |
apply (drule stream_exhaust_eq [THEN iffD1], clarsimp) |
25920 | 470 |
by (drule ax_flat, simp) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
471 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
472 |
lemma slen_strict_mono: "[|stream_finite t; s ~= t; s << (t::'a::flat stream) |] ==> #s < #t" |
27111 | 473 |
by (auto simp add: slen_mono less_le dest: slen_strict_mono_lemma) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
474 |
|
17291 | 475 |
lemma stream_take_Suc_neq: "stream_take (Suc n)$s ~=s ==> |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
476 |
stream_take n$s ~= stream_take (Suc n)$s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
477 |
apply auto |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
478 |
apply (subgoal_tac "stream_take n$s ~=s") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
479 |
apply (insert slen_take_lemma4 [of n s],auto) |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
480 |
apply (cases s, simp) |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
481 |
by (simp add: slen_take_lemma4 eSuc_enat) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
482 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
483 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
484 |
(* theorems about smap *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
485 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
486 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
487 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
488 |
section "smap" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
489 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
490 |
lemma smap_unfold: "smap = (\<Lambda> f t. case t of x&&xs \<Rightarrow> f$x && smap$f$xs)" |
29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
27361
diff
changeset
|
491 |
by (insert smap_def [where 'a='a and 'b='b, THEN eq_reflection, THEN fix_eq2], auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
492 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
493 |
lemma smap_empty [simp]: "smap\<cdot>f\<cdot>\<bottom> = \<bottom>" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
494 |
by (subst smap_unfold, simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
495 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
496 |
lemma smap_scons [simp]: "x~=\<bottom> ==> smap\<cdot>f\<cdot>(x&&xs) = (f\<cdot>x)&&(smap\<cdot>f\<cdot>xs)" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
497 |
by (subst smap_unfold, force) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
498 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
499 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
500 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
501 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
502 |
(* theorems about sfilter *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
503 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
504 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
505 |
section "sfilter" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
506 |
|
17291 | 507 |
lemma sfilter_unfold: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
508 |
"sfilter = (\<Lambda> p s. case s of x && xs \<Rightarrow> |
40322
707eb30e8a53
make syntax of continuous if-then-else consistent with HOL if-then-else
huffman
parents:
40213
diff
changeset
|
509 |
If p\<cdot>x then x && sfilter\<cdot>p\<cdot>xs else sfilter\<cdot>p\<cdot>xs)" |
29530
9905b660612b
change to simpler, more extensible continuity simproc
huffman
parents:
27361
diff
changeset
|
510 |
by (insert sfilter_def [where 'a='a, THEN eq_reflection, THEN fix_eq2], auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
511 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
512 |
lemma strict_sfilter: "sfilter\<cdot>\<bottom> = \<bottom>" |
40002
c5b5f7a3a3b1
new theorem names: fun_below_iff, fun_belowI, cfun_eq_iff, cfun_eqI, cfun_below_iff, cfun_belowI
huffman
parents:
37110
diff
changeset
|
513 |
apply (rule cfun_eqI) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
514 |
apply (subst sfilter_unfold, auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
515 |
apply (case_tac "x=UU", auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
516 |
by (drule stream_exhaust_eq [THEN iffD1], auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
517 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
518 |
lemma sfilter_empty [simp]: "sfilter\<cdot>f\<cdot>\<bottom> = \<bottom>" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
519 |
by (subst sfilter_unfold, force) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
520 |
|
17291 | 521 |
lemma sfilter_scons [simp]: |
522 |
"x ~= \<bottom> ==> sfilter\<cdot>f\<cdot>(x && xs) = |
|
40322
707eb30e8a53
make syntax of continuous if-then-else consistent with HOL if-then-else
huffman
parents:
40213
diff
changeset
|
523 |
If f\<cdot>x then x && sfilter\<cdot>f\<cdot>xs else sfilter\<cdot>f\<cdot>xs" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
524 |
by (subst sfilter_unfold, force) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
525 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
526 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
527 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
528 |
section "i_rt" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
529 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
530 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
531 |
lemma i_rt_UU [simp]: "i_rt n UU = UU" |
34941 | 532 |
by (induct n) (simp_all add: i_rt_def) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
533 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
534 |
lemma i_rt_0 [simp]: "i_rt 0 s = s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
535 |
by (simp add: i_rt_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
536 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
537 |
lemma i_rt_Suc [simp]: "a ~= UU ==> i_rt (Suc n) (a&&s) = i_rt n s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
538 |
by (simp add: i_rt_def iterate_Suc2 del: iterate_Suc) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
539 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
540 |
lemma i_rt_Suc_forw: "i_rt (Suc n) s = i_rt n (rt$s)" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
541 |
by (simp only: i_rt_def iterate_Suc2) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
542 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
543 |
lemma i_rt_Suc_back:"i_rt (Suc n) s = rt$(i_rt n s)" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
544 |
by (simp only: i_rt_def,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
545 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
546 |
lemma i_rt_mono: "x << s ==> i_rt n x << i_rt n s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
547 |
by (simp add: i_rt_def monofun_rt_mult) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
548 |
|
43924 | 549 |
lemma i_rt_ij_lemma: "enat (i + j) <= #x ==> enat j <= #(i_rt i x)" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
550 |
by (simp add: i_rt_def slen_rt_mult) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
551 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
552 |
lemma slen_i_rt_mono: "#s2 <= #s1 ==> #(i_rt n s2) <= #(i_rt n s1)" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
553 |
apply (induct_tac n,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
554 |
apply (simp add: i_rt_Suc_back) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
555 |
by (drule slen_rt_mono,simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
556 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
557 |
lemma i_rt_take_lemma1 [rule_format]: "ALL s. i_rt n (stream_take n$s) = UU" |
17291 | 558 |
apply (induct_tac n) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
559 |
apply (simp add: i_rt_Suc_back,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
560 |
apply (case_tac "s=UU",auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
561 |
by (drule stream_exhaust_eq [THEN iffD1],auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
562 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
563 |
lemma i_rt_slen: "(i_rt n s = UU) = (stream_take n$s = s)" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
564 |
apply auto |
17291 | 565 |
apply (insert i_rt_ij_lemma [of n "Suc 0" s]) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
566 |
apply (subgoal_tac "#(i_rt n s)=0") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
567 |
apply (case_tac "stream_take n$s = s",simp+) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
568 |
apply (insert slen_take_eq [rule_format,of n s],simp) |
43919 | 569 |
apply (cases "#s") apply (simp_all add: zero_enat_def) |
27111 | 570 |
apply (simp add: slen_take_eq) |
571 |
apply (cases "#s") |
|
572 |
using i_rt_take_lemma1 [of n s] |
|
43919 | 573 |
apply (simp_all add: zero_enat_def) |
27111 | 574 |
done |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
575 |
|
43924 | 576 |
lemma i_rt_lemma_slen: "#s=enat n ==> i_rt n s = UU" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
577 |
by (simp add: i_rt_slen slen_take_lemma1) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
578 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
579 |
lemma stream_finite_i_rt [simp]: "stream_finite (i_rt n s) = stream_finite s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
580 |
apply (induct_tac n, auto) |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
581 |
apply (cases s, auto simp del: i_rt_Suc) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
582 |
by (simp add: i_rt_Suc_back stream_finite_rt_eq)+ |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
583 |
|
43924 | 584 |
lemma take_i_rt_len_lemma: "ALL sl x j t. enat sl = #x & n <= sl & |
585 |
#(stream_take n$x) = enat t & #(i_rt n x)= enat j |
|
586 |
--> enat (j + t) = #x" |
|
27111 | 587 |
apply (induct n, auto) |
43919 | 588 |
apply (simp add: zero_enat_def) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
589 |
apply (case_tac "x=UU",auto) |
43919 | 590 |
apply (simp add: zero_enat_def) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
591 |
apply (drule stream_exhaust_eq [THEN iffD1],clarsimp) |
43924 | 592 |
apply (subgoal_tac "EX k. enat k = #y",clarify) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
593 |
apply (erule_tac x="k" in allE) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
594 |
apply (erule_tac x="y" in allE,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
595 |
apply (erule_tac x="THE p. Suc p = t" in allE,auto) |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
596 |
apply (simp add: eSuc_def split: enat.splits) |
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
597 |
apply (simp add: eSuc_def split: enat.splits) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
598 |
apply (simp only: the_equality) |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
599 |
apply (simp add: eSuc_def split: enat.splits) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
600 |
apply force |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
601 |
apply (simp add: eSuc_def split: enat.splits) |
27111 | 602 |
done |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
603 |
|
17291 | 604 |
lemma take_i_rt_len: |
43924 | 605 |
"[| enat sl = #x; n <= sl; #(stream_take n$x) = enat t; #(i_rt n x) = enat j |] ==> |
606 |
enat (j + t) = #x" |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
607 |
by (blast intro: take_i_rt_len_lemma [rule_format]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
608 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
609 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
610 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
611 |
section "i_th" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
612 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
613 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
614 |
lemma i_th_i_rt_step: |
17291 | 615 |
"[| i_th n s1 << i_th n s2; i_rt (Suc n) s1 << i_rt (Suc n) s2 |] ==> |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
616 |
i_rt n s1 << i_rt n s2" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
617 |
apply (simp add: i_th_def i_rt_Suc_back) |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
618 |
apply (cases "i_rt n s1", simp) |
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
619 |
apply (cases "i_rt n s2", auto) |
30807 | 620 |
done |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
621 |
|
17291 | 622 |
lemma i_th_stream_take_Suc [rule_format]: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
623 |
"ALL s. i_th n (stream_take (Suc n)$s) = i_th n s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
624 |
apply (induct_tac n,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
625 |
apply (simp add: i_th_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
626 |
apply (case_tac "s=UU",auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
627 |
apply (drule stream_exhaust_eq [THEN iffD1],auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
628 |
apply (case_tac "s=UU",simp add: i_th_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
629 |
apply (drule stream_exhaust_eq [THEN iffD1],auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
630 |
by (simp add: i_th_def i_rt_Suc_forw) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
631 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
632 |
lemma i_th_last: "i_th n s && UU = i_rt n (stream_take (Suc n)$s)" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
633 |
apply (insert surjectiv_scons [of "i_rt n (stream_take (Suc n)$s)"]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
634 |
apply (rule i_th_stream_take_Suc [THEN subst]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
635 |
apply (simp add: i_th_def i_rt_Suc_back [symmetric]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
636 |
by (simp add: i_rt_take_lemma1) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
637 |
|
17291 | 638 |
lemma i_th_last_eq: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
639 |
"i_th n s1 = i_th n s2 ==> i_rt n (stream_take (Suc n)$s1) = i_rt n (stream_take (Suc n)$s2)" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
640 |
apply (insert i_th_last [of n s1]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
641 |
apply (insert i_th_last [of n s2]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
642 |
by auto |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
643 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
644 |
lemma i_th_prefix_lemma: |
17291 | 645 |
"[| k <= n; stream_take (Suc n)$s1 << stream_take (Suc n)$s2 |] ==> |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
646 |
i_th k s1 << i_th k s2" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
647 |
apply (insert i_th_stream_take_Suc [of k s1, THEN sym]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
648 |
apply (insert i_th_stream_take_Suc [of k s2, THEN sym],auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
649 |
apply (simp add: i_th_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
650 |
apply (rule monofun_cfun, auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
651 |
apply (rule i_rt_mono) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
652 |
by (blast intro: stream_take_lemma10) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
653 |
|
17291 | 654 |
lemma take_i_rt_prefix_lemma1: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
655 |
"stream_take (Suc n)$s1 << stream_take (Suc n)$s2 ==> |
17291 | 656 |
i_rt (Suc n) s1 << i_rt (Suc n) s2 ==> |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
657 |
i_rt n s1 << i_rt n s2 & stream_take n$s1 << stream_take n$s2" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
658 |
apply auto |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
659 |
apply (insert i_th_prefix_lemma [of n n s1 s2]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
660 |
apply (rule i_th_i_rt_step,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
661 |
by (drule mono_stream_take_pred,simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
662 |
|
17291 | 663 |
lemma take_i_rt_prefix_lemma: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
664 |
"[| stream_take n$s1 << stream_take n$s2; i_rt n s1 << i_rt n s2 |] ==> s1 << s2" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
665 |
apply (case_tac "n=0",simp) |
25161 | 666 |
apply (auto) |
17291 | 667 |
apply (subgoal_tac "stream_take 0$s1 << stream_take 0$s2 & |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
668 |
i_rt 0 s1 << i_rt 0 s2") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
669 |
defer 1 |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
670 |
apply (rule zero_induct,blast) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
671 |
apply (blast dest: take_i_rt_prefix_lemma1) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
672 |
by simp |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
673 |
|
17291 | 674 |
lemma streams_prefix_lemma: "(s1 << s2) = |
675 |
(stream_take n$s1 << stream_take n$s2 & i_rt n s1 << i_rt n s2)" |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
676 |
apply auto |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
677 |
apply (simp add: monofun_cfun_arg) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
678 |
apply (simp add: i_rt_mono) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
679 |
by (erule take_i_rt_prefix_lemma,simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
680 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
681 |
lemma streams_prefix_lemma1: |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
682 |
"[| stream_take n$s1 = stream_take n$s2; i_rt n s1 = i_rt n s2 |] ==> s1 = s2" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
683 |
apply (simp add: po_eq_conv,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
684 |
apply (insert streams_prefix_lemma) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
685 |
by blast+ |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
686 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
687 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
688 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
689 |
section "sconc" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
690 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
691 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
692 |
lemma UU_sconc [simp]: " UU ooo s = s " |
43919 | 693 |
by (simp add: sconc_def zero_enat_def) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
694 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
695 |
lemma scons_neq_UU: "a~=UU ==> a && s ~=UU" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
696 |
by auto |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
697 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
698 |
lemma singleton_sconc [rule_format, simp]: "x~=UU --> (x && UU) ooo y = x && y" |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
699 |
apply (simp add: sconc_def zero_enat_def eSuc_def split: enat.splits, auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
700 |
apply (rule someI2_ex,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
701 |
apply (rule_tac x="x && y" in exI,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
702 |
apply (simp add: i_rt_Suc_forw) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
703 |
apply (case_tac "xa=UU",simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
704 |
by (drule stream_exhaust_eq [THEN iffD1],auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
705 |
|
17291 | 706 |
lemma ex_sconc [rule_format]: |
43924 | 707 |
"ALL k y. #x = enat k --> (EX w. stream_take k$w = x & i_rt k w = y)" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
708 |
apply (case_tac "#x") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
709 |
apply (rule stream_finite_ind [of x],auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
710 |
apply (simp add: stream.finite_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
711 |
apply (drule slen_take_lemma1,blast) |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
712 |
apply (simp_all add: zero_enat_def eSuc_def split: enat.splits) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
713 |
apply (erule_tac x="y" in allE,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
714 |
by (rule_tac x="a && w" in exI,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
715 |
|
43924 | 716 |
lemma rt_sconc1: "enat n = #x ==> i_rt n (x ooo y) = y" |
43919 | 717 |
apply (simp add: sconc_def split: enat.splits, arith?,auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
718 |
apply (rule someI2_ex,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
719 |
by (drule ex_sconc,simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
720 |
|
43924 | 721 |
lemma sconc_inj2: "\<lbrakk>enat n = #x; x ooo y = x ooo z\<rbrakk> \<Longrightarrow> y = z" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
722 |
apply (frule_tac y=y in rt_sconc1) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
723 |
by (auto elim: rt_sconc1) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
724 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
725 |
lemma sconc_UU [simp]:"s ooo UU = s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
726 |
apply (case_tac "#s") |
27111 | 727 |
apply (simp add: sconc_def) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
728 |
apply (rule someI2_ex) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
729 |
apply (rule_tac x="s" in exI) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
730 |
apply auto |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
731 |
apply (drule slen_take_lemma1,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
732 |
apply (simp add: i_rt_lemma_slen) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
733 |
apply (drule slen_take_lemma1,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
734 |
apply (simp add: i_rt_slen) |
27111 | 735 |
by (simp add: sconc_def) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
736 |
|
43924 | 737 |
lemma stream_take_sconc [simp]: "enat n = #x ==> stream_take n$(x ooo y) = x" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
738 |
apply (simp add: sconc_def) |
27111 | 739 |
apply (cases "#x") |
740 |
apply auto |
|
741 |
apply (rule someI2_ex, auto) |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
742 |
by (drule ex_sconc,simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
743 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
744 |
lemma scons_sconc [rule_format,simp]: "a~=UU --> (a && x) ooo y = a && x ooo y" |
27111 | 745 |
apply (cases "#x",auto) |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
746 |
apply (simp add: sconc_def eSuc_enat) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
747 |
apply (rule someI2_ex) |
27111 | 748 |
apply (drule ex_sconc, simp) |
749 |
apply (rule someI2_ex, auto) |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
750 |
apply (simp add: i_rt_Suc_forw) |
27111 | 751 |
apply (rule_tac x="a && x" in exI, auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
752 |
apply (case_tac "xa=UU",auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
753 |
apply (drule stream_exhaust_eq [THEN iffD1],auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
754 |
apply (drule streams_prefix_lemma1,simp+) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
755 |
by (simp add: sconc_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
756 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
757 |
lemma ft_sconc: "x ~= UU ==> ft$(x ooo y) = ft$x" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
758 |
by (cases x, auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
759 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
760 |
lemma sconc_assoc: "(x ooo y) ooo z = x ooo y ooo z" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
761 |
apply (case_tac "#x") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
762 |
apply (rule stream_finite_ind [of x],auto simp del: scons_sconc) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
763 |
apply (simp add: stream.finite_def del: scons_sconc) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
764 |
apply (drule slen_take_lemma1,auto simp del: scons_sconc) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
765 |
apply (case_tac "a = UU", auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
766 |
by (simp add: sconc_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
767 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
768 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
769 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
770 |
|
25833 | 771 |
lemma cont_sconc_lemma1: "stream_finite x \<Longrightarrow> cont (\<lambda>y. x ooo y)" |
772 |
by (erule stream_finite_ind, simp_all) |
|
773 |
||
774 |
lemma cont_sconc_lemma2: "\<not> stream_finite x \<Longrightarrow> cont (\<lambda>y. x ooo y)" |
|
775 |
by (simp add: sconc_def slen_def) |
|
776 |
||
777 |
lemma cont_sconc: "cont (\<lambda>y. x ooo y)" |
|
778 |
apply (cases "stream_finite x") |
|
779 |
apply (erule cont_sconc_lemma1) |
|
780 |
apply (erule cont_sconc_lemma2) |
|
781 |
done |
|
782 |
||
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
783 |
lemma sconc_mono: "y << y' ==> x ooo y << x ooo y'" |
25833 | 784 |
by (rule cont_sconc [THEN cont2mono, THEN monofunE]) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
785 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
786 |
lemma sconc_mono1 [simp]: "x << x ooo y" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
787 |
by (rule sconc_mono [of UU, simplified]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
788 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
789 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
790 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
791 |
lemma empty_sconc [simp]: "(x ooo y = UU) = (x = UU & y = UU)" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
792 |
apply (case_tac "#x",auto) |
17291 | 793 |
apply (insert sconc_mono1 [of x y]) |
19440 | 794 |
by auto |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
795 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
796 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
797 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
798 |
lemma rt_sconc [rule_format, simp]: "s~=UU --> rt$(s ooo x) = rt$s ooo x" |
35781
b7738ab762b1
renamed some lemmas generated by the domain package
huffman
parents:
35642
diff
changeset
|
799 |
by (cases s, auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
800 |
|
17291 | 801 |
lemma i_th_sconc_lemma [rule_format]: |
43924 | 802 |
"ALL x y. enat n < #x --> i_th n (x ooo y) = i_th n x" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
803 |
apply (induct_tac n, auto) |
43924 | 804 |
apply (simp add: enat_0 i_th_def) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
805 |
apply (simp add: slen_empty_eq ft_sconc) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
806 |
apply (simp add: i_th_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
807 |
apply (case_tac "x=UU",auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
808 |
apply (drule stream_exhaust_eq [THEN iffD1], auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
809 |
apply (erule_tac x="ya" in allE) |
27111 | 810 |
apply (case_tac "#ya") by simp_all |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
811 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
812 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
813 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
814 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
815 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
816 |
lemma sconc_lemma [rule_format, simp]: "ALL s. stream_take n$s ooo i_rt n s = s" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
817 |
apply (induct_tac n,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
818 |
apply (case_tac "s=UU",auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
819 |
by (drule stream_exhaust_eq [THEN iffD1],auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
820 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
821 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
822 |
subsection "pointwise equality" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
823 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
824 |
|
17291 | 825 |
lemma ex_last_stream_take_scons: "stream_take (Suc n)$s = |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
826 |
stream_take n$s ooo i_rt n (stream_take (Suc n)$s)" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
827 |
by (insert sconc_lemma [of n "stream_take (Suc n)$s"],simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
828 |
|
17291 | 829 |
lemma i_th_stream_take_eq: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
830 |
"!!n. ALL n. i_th n s1 = i_th n s2 ==> stream_take n$s1 = stream_take n$s2" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
831 |
apply (induct_tac n,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
832 |
apply (subgoal_tac "stream_take (Suc na)$s1 = |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
833 |
stream_take na$s1 ooo i_rt na (stream_take (Suc na)$s1)") |
17291 | 834 |
apply (subgoal_tac "i_rt na (stream_take (Suc na)$s1) = |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
835 |
i_rt na (stream_take (Suc na)$s2)") |
17291 | 836 |
apply (subgoal_tac "stream_take (Suc na)$s2 = |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
837 |
stream_take na$s2 ooo i_rt na (stream_take (Suc na)$s2)") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
838 |
apply (insert ex_last_stream_take_scons,simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
839 |
apply blast |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
840 |
apply (erule_tac x="na" in allE) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
841 |
apply (insert i_th_last_eq [of _ s1 s2]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
842 |
by blast+ |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
843 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
844 |
lemma pointwise_eq_lemma[rule_format]: "ALL n. i_th n s1 = i_th n s2 ==> s1 = s2" |
35642
f478d5a9d238
generate separate qualified theorem name for each type's reach and take_lemma
huffman
parents:
35557
diff
changeset
|
845 |
by (insert i_th_stream_take_eq [THEN stream.take_lemma],blast) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
846 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
847 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
848 |
subsection "finiteness" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
849 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
850 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
851 |
lemma slen_sconc_finite1: |
43924 | 852 |
"[| #(x ooo y) = \<infinity>; enat n = #x |] ==> #y = \<infinity>" |
43921 | 853 |
apply (case_tac "#y ~= \<infinity>",auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
854 |
apply (drule_tac y=y in rt_sconc1) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
855 |
apply (insert stream_finite_i_rt [of n "x ooo y"]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
856 |
by (simp add: slen_infinite) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
857 |
|
43921 | 858 |
lemma slen_sconc_infinite1: "#x=\<infinity> ==> #(x ooo y) = \<infinity>" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
859 |
by (simp add: sconc_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
860 |
|
43921 | 861 |
lemma slen_sconc_infinite2: "#y=\<infinity> ==> #(x ooo y) = \<infinity>" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
862 |
apply (case_tac "#x") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
863 |
apply (simp add: sconc_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
864 |
apply (rule someI2_ex) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
865 |
apply (drule ex_sconc,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
866 |
apply (erule contrapos_pp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
867 |
apply (insert stream_finite_i_rt) |
44890
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
nipkow
parents:
44019
diff
changeset
|
868 |
apply (fastforce simp add: slen_infinite,auto) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
869 |
by (simp add: sconc_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
870 |
|
43921 | 871 |
lemma sconc_finite: "(#x~=\<infinity> & #y~=\<infinity>) = (#(x ooo y)~=\<infinity>)" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
872 |
apply auto |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
873 |
apply (metis not_infinity_eq slen_sconc_finite1) |
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
874 |
apply (metis not_infinity_eq slen_sconc_infinite1) |
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
875 |
apply (metis not_infinity_eq slen_sconc_infinite2) |
31084 | 876 |
done |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
877 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
878 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
879 |
|
43924 | 880 |
lemma slen_sconc_mono3: "[| enat n = #x; enat k = #(x ooo y) |] ==> n <= k" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
881 |
apply (insert slen_mono [of "x" "x ooo y"]) |
27111 | 882 |
apply (cases "#x") apply simp_all |
883 |
apply (cases "#(x ooo y)") apply simp_all |
|
884 |
done |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
885 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
886 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
887 |
subsection "finite slen" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
888 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
889 |
|
43924 | 890 |
lemma slen_sconc: "[| enat n = #x; enat m = #y |] ==> #(x ooo y) = enat (n + m)" |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
891 |
apply (case_tac "#(x ooo y)") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
892 |
apply (frule_tac y=y in rt_sconc1) |
43924 | 893 |
apply (insert take_i_rt_len [of "THE j. enat j = #(x ooo y)" "x ooo y" n n m],simp) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
894 |
apply (insert slen_sconc_mono3 [of n x _ y],simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
895 |
by (insert sconc_finite [of x y],auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
896 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
897 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
898 |
subsection "flat prefix" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
899 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
900 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
901 |
lemma sconc_prefix: "(s1::'a::flat stream) << s2 ==> EX t. s1 ooo t = s2" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
902 |
apply (case_tac "#s1") |
17291 | 903 |
apply (subgoal_tac "stream_take nat$s1 = stream_take nat$s2") |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
904 |
apply (rule_tac x="i_rt nat s2" in exI) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
905 |
apply (simp add: sconc_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
906 |
apply (rule someI2_ex) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
907 |
apply (drule ex_sconc) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
908 |
apply (simp,clarsimp,drule streams_prefix_lemma1) |
17291 | 909 |
apply (simp+,rule slen_take_lemma3 [of _ s1 s2]) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
910 |
apply (simp+,rule_tac x="UU" in exI) |
17291 | 911 |
apply (insert slen_take_lemma3 [of _ s1 s2]) |
35642
f478d5a9d238
generate separate qualified theorem name for each type's reach and take_lemma
huffman
parents:
35557
diff
changeset
|
912 |
by (rule stream.take_lemma,simp) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
913 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
914 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
915 |
subsection "continuity" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
916 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
917 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
918 |
lemma chain_sconc: "chain S ==> chain (%i. (x ooo S i))" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
919 |
by (simp add: chain_def,auto simp add: sconc_mono) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
920 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
921 |
lemma chain_scons: "chain S ==> chain (%i. a && S i)" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
922 |
apply (simp add: chain_def,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
923 |
by (rule monofun_cfun_arg,simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
924 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
925 |
lemma contlub_scons_lemma: "chain S ==> (LUB i. a && S i) = a && (LUB i. S i)" |
40327 | 926 |
by (rule cont2contlubE [OF cont_Rep_cfun2, symmetric]) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
927 |
|
17291 | 928 |
lemma finite_lub_sconc: "chain Y ==> (stream_finite x) ==> |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
929 |
(LUB i. x ooo Y i) = (x ooo (LUB i. Y i))" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
930 |
apply (rule stream_finite_ind [of x]) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
931 |
apply (auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
932 |
apply (subgoal_tac "(LUB i. a && (s ooo Y i)) = a && (LUB i. s ooo Y i)") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
933 |
by (force,blast dest: contlub_scons_lemma chain_sconc) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
934 |
|
17291 | 935 |
lemma contlub_sconc_lemma: |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
936 |
"chain Y ==> (LUB i. x ooo Y i) = (x ooo (LUB i. Y i))" |
43921 | 937 |
apply (case_tac "#x=\<infinity>") |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
938 |
apply (simp add: sconc_def) |
18075 | 939 |
apply (drule finite_lub_sconc,auto simp add: slen_infinite) |
940 |
done |
|
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
941 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
942 |
lemma monofun_sconc: "monofun (%y. x ooo y)" |
16218 | 943 |
by (simp add: monofun_def sconc_mono) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
944 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
945 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
946 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
947 |
section "constr_sconc" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
948 |
(* ----------------------------------------------------------------------- *) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
949 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
950 |
lemma constr_sconc_UUs [simp]: "constr_sconc UU s = s" |
43919 | 951 |
by (simp add: constr_sconc_def zero_enat_def) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
952 |
|
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
953 |
lemma "x ooo y = constr_sconc x y" |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
954 |
apply (case_tac "#x") |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
955 |
apply (rule stream_finite_ind [of x],auto simp del: scons_sconc) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
956 |
defer 1 |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
957 |
apply (simp add: constr_sconc_def del: scons_sconc) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
958 |
apply (case_tac "#s") |
44019
ee784502aed5
Extended_Nat.thy: renamed iSuc to eSuc, standardized theorem names
huffman
parents:
43924
diff
changeset
|
959 |
apply (simp add: eSuc_enat) |
15188
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
960 |
apply (case_tac "a=UU",auto simp del: scons_sconc) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
961 |
apply (simp) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
962 |
apply (simp add: sconc_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
963 |
apply (simp add: constr_sconc_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
964 |
apply (simp add: stream.finite_def) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
965 |
by (drule slen_take_lemma1,auto) |
9d57263faf9e
integrated Streams with ex/Stream.*; added FOCUS/Fstreams.thy
oheimb
parents:
14981
diff
changeset
|
966 |
|
2570 | 967 |
end |