444
|
1 |
|
|
2 |
theory ClosedFormsBounds
|
|
3 |
imports "GeneralRegexBound" "ClosedForms"
|
|
4 |
begin
|
|
5 |
|
449
|
6 |
lemma alts_ders_lambda_shape_ders:
|
|
7 |
shows "\<forall>r \<in> set (map (\<lambda>r. rders_simp r ( s)) rs ). \<exists>r1 \<in> set rs. r = rders_simp r1 s"
|
|
8 |
by (simp add: image_iff)
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
lemma rlist_bound:
|
|
13 |
shows "\<forall>r \<in> set rs. rsize r \<le> N \<Longrightarrow> sum_list (map rsize rs) \<le> N * (length rs)"
|
|
14 |
apply(induct rs)
|
|
15 |
apply simp
|
|
16 |
by simp
|
444
|
17 |
|
|
18 |
|
|
19 |
lemma alts_closed_form_bounded: shows
|
|
20 |
"\<forall>r \<in> set rs. \<forall>s. rsize(rders_simp r s ) \<le> N \<Longrightarrow>
|
449
|
21 |
rsize (rders_simp (RALTS rs ) s) \<le> max (Suc ( N * (length rs))) (rsize (RALTS rs) )"
|
444
|
22 |
apply(induct s)
|
|
23 |
apply simp
|
449
|
24 |
apply(subst alts_closed_form_variant)
|
|
25 |
apply force
|
|
26 |
apply(subgoal_tac "rsize (rsimp (RALTS (map (\<lambda>r. rders_simp r (a # s)) rs))) \<le> rsize ( (RALTS (map (\<lambda>r. rders_simp r (a # s)) rs)))")
|
447
|
27 |
prefer 2
|
449
|
28 |
using rsimp_mono apply presburger
|
|
29 |
apply(subgoal_tac "rsize (RALTS (map (\<lambda>r. rders_simp r (a # s)) rs)) =
|
|
30 |
Suc (sum_list (map rsize (map (\<lambda>r. rders_simp r (a # s)) rs)))")
|
444
|
31 |
prefer 2
|
449
|
32 |
using rsize.simps(4) apply blast
|
|
33 |
apply(subgoal_tac "sum_list (map rsize (map (\<lambda>r. rders_simp r (a # s)) rs )) \<le> N * (length rs) ")
|
|
34 |
apply linarith
|
|
35 |
apply(subgoal_tac "\<forall>r \<in> set (map (\<lambda>r. rders_simp r (a # s)) rs ). rsize r \<le> N")
|
|
36 |
prefer 2
|
|
37 |
apply(subgoal_tac "\<forall>r \<in> set (map (\<lambda>r. rders_simp r (a # s)) rs ). \<exists>r1 \<in> set rs. r = rders_simp r1 (a # s)")
|
|
38 |
prefer 2
|
|
39 |
using alts_ders_lambda_shape_ders apply presburger
|
|
40 |
apply metis
|
|
41 |
apply(frule rlist_bound)
|
|
42 |
by fastforce
|
444
|
43 |
|
|
44 |
|
447
|
45 |
lemma alts_simp_ineq_unfold:
|
|
46 |
shows "rsize (rsimp (RALTS rs)) \<le> Suc (sum_list (map rsize (rdistinct (rflts (map rsimp rs)) {})))"
|
|
47 |
using rsimp_aalts_smaller by auto
|
444
|
48 |
|
447
|
49 |
lemma flts_has_no_zero:
|
|
50 |
shows "rdistinct (rflts rs) rset = rdistinct (rflts rs) (insert RZERO rset)"
|
449
|
51 |
|
447
|
52 |
sorry
|
|
53 |
|
449
|
54 |
lemma not_mentioned_elem_distinct:
|
|
55 |
shows "r \<noteq> a \<Longrightarrow> (r \<in> set (rdistinct rs {})) = (r \<in> set (rdistinct rs {a}))"
|
|
56 |
sorry
|
|
57 |
|
|
58 |
|
|
59 |
|
447
|
60 |
lemma flts_vs_nflts:
|
|
61 |
shows "\<forall>r \<in> noalts_set. \<forall>xs. r \<noteq> RALTS xs
|
|
62 |
\<and> (\<forall>a \<in> alts_set. \<exists>xs. a = RALTS xs \<and> set xs \<subseteq> corr_set)
|
|
63 |
\<Longrightarrow> Suc (sum_list (map rsize (rdistinct ( rflts rs) (noalts_set \<union> corr_set) )))
|
|
64 |
\<le> Suc (sum_list (map rsize (rdistinct rs (noalts_set \<union> alts_set) )))"
|
|
65 |
apply(induct rs arbitrary: noalts_set)
|
|
66 |
apply simp
|
|
67 |
|
|
68 |
sorry
|
|
69 |
|
449
|
70 |
lemma distinct_simp_ineq_general:
|
|
71 |
shows "rsimp ` no_simp = has_simp \<Longrightarrow>Suc (sum_list (map rsize (rdistinct (map rsimp rs) has_simp)))
|
|
72 |
\<le> Suc (sum_list (map rsize (rdistinct rs no_simp)))"
|
|
73 |
|
|
74 |
sorry
|
|
75 |
|
447
|
76 |
|
|
77 |
lemma without_flts_ineq:
|
|
78 |
shows " Suc (sum_list (map rsize (rdistinct (rflts rs) {}) )) \<le>
|
|
79 |
Suc (sum_list (map rsize (rdistinct ( rs ) {} )))"
|
|
80 |
by (metis empty_iff flts_vs_nflts sup_bot_left)
|
|
81 |
|
|
82 |
|
448
|
83 |
|
|
84 |
|
447
|
85 |
lemma distinct_simp_ineq:
|
|
86 |
shows "Suc (sum_list (map rsize (rdistinct (map rsimp rs) {})))
|
|
87 |
\<le> Suc (sum_list (map rsize (rdistinct rs {})))"
|
448
|
88 |
|
|
89 |
using distinct_simp_ineq_general by blast
|
|
90 |
|
|
91 |
|
447
|
92 |
|
|
93 |
|
|
94 |
lemma alts_simp_control:
|
|
95 |
shows "rsize (rsimp (RALTS rs)) \<le> Suc (sum_list (map rsize (rdistinct rs {})))"
|
|
96 |
proof -
|
|
97 |
have "rsize (rsimp (RALTS rs)) \<le> Suc (sum_list (map rsize (rdistinct (rflts (map rsimp rs)) {})))"
|
|
98 |
|
|
99 |
using alts_simp_ineq_unfold by auto
|
|
100 |
then have "\<dots> \<le> Suc (sum_list (map rsize (rdistinct (map rsimp rs) {})))"
|
|
101 |
using without_flts_ineq by blast
|
|
102 |
|
|
103 |
show "rsize (rsimp (RALTS rs)) \<le> Suc (sum_list (map rsize (rdistinct rs {})))"
|
|
104 |
by (meson \<open>Suc (sum_list (map rsize (rdistinct (rflts (map rsimp rs)) {}))) \<le> Suc (sum_list (map rsize (rdistinct (map rsimp rs) {})))\<close> \<open>rsize (rsimp (RALTS rs)) \<le> Suc (sum_list (map rsize (rdistinct (rflts (map rsimp rs)) {})))\<close> distinct_simp_ineq order_trans)
|
|
105 |
qed
|
444
|
106 |
|
|
107 |
|
|
108 |
|
446
|
109 |
lemma rdistinct_equality1:
|
|
110 |
shows "a \<notin> ss \<Longrightarrow> rdistinct (a # rs) ss = a # rdistinct rs (insert a ss) "
|
|
111 |
by auto
|
|
112 |
|
|
113 |
lemma larger_acc_smaller_distinct_res0:
|
|
114 |
shows " ss \<subseteq> SS \<Longrightarrow> sum_list (map rsize (rdistinct rs SS)) \<le> sum_list (map rsize (rdistinct rs ss))"
|
|
115 |
apply(induct rs arbitrary: ss SS)
|
|
116 |
apply simp
|
|
117 |
apply(case_tac "a \<in> ss")
|
|
118 |
apply(subgoal_tac "a \<in> SS")
|
|
119 |
apply simp
|
|
120 |
apply blast
|
|
121 |
apply(case_tac "a \<in> SS")
|
|
122 |
apply simp
|
|
123 |
apply(subgoal_tac "insert a ss \<subseteq> SS")
|
|
124 |
apply simp
|
|
125 |
apply (simp add: trans_le_add2)
|
|
126 |
apply blast
|
|
127 |
apply(simp)
|
|
128 |
apply(subgoal_tac "insert a ss \<subseteq> insert a SS")
|
|
129 |
apply blast
|
|
130 |
by blast
|
|
131 |
|
|
132 |
|
|
133 |
lemma larger_acc_smaller_distinct_res:
|
|
134 |
shows " (sum_list (map rsize (rdistinct rs ss))) \<ge> (sum_list (map rsize (rdistinct rs (insert a ss))))"
|
447
|
135 |
apply(subgoal_tac "ss \<subseteq> (insert a ss)")
|
|
136 |
apply(rule larger_acc_smaller_distinct_res0)
|
|
137 |
apply simp
|
|
138 |
by (simp add: subset_insertI)
|
446
|
139 |
|
|
140 |
lemma size_list_triangle1:
|
|
141 |
shows "sum_list (map rsize (a # (rdistinct as ss))) \<ge> rsize a + sum_list (map rsize (rdistinct as (insert a ss)))"
|
|
142 |
by (simp add: larger_acc_smaller_distinct_res)
|
|
143 |
|
|
144 |
|
445
|
145 |
lemma triangle_inequality_distinct:
|
|
146 |
shows "sum_list (map rsize (rdistinct (a # rs) ss)) \<le> rsize a + (sum_list (map rsize (rdistinct rs ss)))"
|
|
147 |
apply(case_tac "a \<in> ss")
|
|
148 |
apply simp
|
446
|
149 |
apply(subst rdistinct_equality1)
|
|
150 |
apply simp
|
|
151 |
using size_list_triangle1 by auto
|
445
|
152 |
|
|
153 |
lemma same_regex_property_after_map:
|
|
154 |
shows "\<forall>s. P (f r2 s) \<Longrightarrow> \<forall>r \<in> set (map (f r2) Ss). P r"
|
|
155 |
by auto
|
|
156 |
|
|
157 |
lemma same_property_after_distinct:
|
|
158 |
shows " \<forall>r \<in> set (map (f r2) Ss). P r \<Longrightarrow> \<forall>r \<in> set (rdistinct (map (f r2) Ss) xset). P r"
|
|
159 |
apply(induct Ss arbitrary: xset)
|
|
160 |
apply simp
|
|
161 |
by auto
|
|
162 |
|
|
163 |
lemma same_regex_property_after_distinct:
|
|
164 |
shows "\<forall>s. P (f r2 s) \<Longrightarrow> \<forall>r \<in> set (rdistinct (map (f r2) Ss) xset). P r"
|
|
165 |
apply(rule same_property_after_distinct)
|
|
166 |
apply(rule same_regex_property_after_map)
|
|
167 |
by simp
|
|
168 |
|
449
|
169 |
|
|
170 |
|
|
171 |
lemma Sum_cons:
|
|
172 |
shows "distinct (a # as) \<Longrightarrow> \<Sum> (set ((a::nat) # as)) = a + \<Sum> (set as)"
|
|
173 |
by simp
|
|
174 |
|
|
175 |
|
|
176 |
lemma distinct_list_sizeNregex_bounded:
|
|
177 |
shows "distinct rs \<and> (\<forall> r \<in> (set rs). rsize r \<le> N) \<Longrightarrow> sum_list (map rsize rs) \<le> N * length rs"
|
|
178 |
apply(induct rs)
|
|
179 |
apply simp
|
|
180 |
by simp
|
|
181 |
|
|
182 |
|
|
183 |
lemma distinct_list_size_len_bounded:
|
|
184 |
shows "distinct rs \<and> (\<forall>r \<in> set rs. rsize r \<le> N) \<and> length rs \<le> lrs \<Longrightarrow> sum_list (map rsize rs) \<le> lrs * N "
|
|
185 |
by (metis distinct_list_sizeNregex_bounded dual_order.trans mult.commute mult_le_mono1)
|
|
186 |
|
|
187 |
|
|
188 |
|
|
189 |
lemma rdistinct_same_set:
|
|
190 |
shows "(r \<in> set rs) = (r \<in> set (rdistinct rs {}))"
|
|
191 |
apply(induct rs)
|
|
192 |
apply simp
|
|
193 |
apply(case_tac "a \<in> set rs")
|
|
194 |
apply(case_tac "r = a")
|
|
195 |
apply (simp)
|
|
196 |
apply (simp add: not_mentioned_elem_distinct)
|
|
197 |
using not_mentioned_elem_distinct by fastforce
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
lemma distinct_list_rexp_up_to_certain_size_bouded_by_set_enumerating_up_to_that_size:
|
|
202 |
shows "\<forall>r\<in> set rs. (rsize r ) \<le> N \<Longrightarrow> sum_list (map rsize (rdistinct rs {})) \<le>
|
|
203 |
(card (sizeNregex N))* N"
|
|
204 |
apply(subgoal_tac "distinct (rdistinct rs {})")
|
|
205 |
prefer 2
|
|
206 |
using rdistinct_does_the_job apply blast
|
|
207 |
apply(subgoal_tac "length (rdistinct rs {}) \<le> card (sizeNregex N)")
|
|
208 |
apply(rule distinct_list_size_len_bounded)
|
|
209 |
apply(rule conjI)+
|
|
210 |
apply simp
|
|
211 |
apply(rule conjI)
|
|
212 |
apply (meson rdistinct_same_set)
|
|
213 |
apply blast
|
|
214 |
apply(subgoal_tac "\<forall>r \<in> set (rdistinct rs {}). rsize r \<le> N")
|
|
215 |
prefer 2
|
|
216 |
apply (meson rdistinct_same_set)
|
|
217 |
apply(subgoal_tac "length (rdistinct rs {}) = card (set (rdistinct rs {}))")
|
|
218 |
prefer 2
|
|
219 |
using set_related_list apply blast
|
|
220 |
apply(simp only:)
|
|
221 |
by (metis card_mono finite_size_n mem_Collect_eq sizeNregex_def subset_code(1))
|
|
222 |
|
|
223 |
|
|
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
lemma star_closed_form_bounded_by_rdistinct_list_estimate:
|
|
229 |
shows "rsize (rsimp ( RALTS ( (map (\<lambda>s1. RSEQ (rders_simp r0 s1) (RSTAR r0) )
|
|
230 |
(star_updates s r0 [[c]]) ) ))) \<le>
|
|
231 |
Suc (sum_list (map rsize (rdistinct (map (\<lambda>s1. RSEQ (rders_simp r0 s1) (RSTAR r0) )
|
|
232 |
(star_updates s r0 [[c]]) ) {}) ) )"
|
|
233 |
by (metis alts_simp_control )
|
|
234 |
|
|
235 |
|
|
236 |
|
|
237 |
|
|
238 |
lemma star_lambda_form:
|
|
239 |
shows "\<forall> r \<in> set (map (\<lambda>s1. RSEQ (rders_simp r0 s1) (RSTAR r0)) ls).
|
|
240 |
\<exists>s2. r = RSEQ (rders_simp r0 s2) (RSTAR r0) "
|
|
241 |
by (meson ex_map_conv)
|
|
242 |
|
|
243 |
|
|
244 |
lemma star_lambda_ders:
|
|
245 |
shows " \<forall>s. rsize (rders_simp r0 s) \<le> N \<Longrightarrow>
|
|
246 |
\<forall>r\<in>set (map (\<lambda>s1. RSEQ (rders_simp r0 s1) (RSTAR r0)) (star_updates s r0 [[c]])).
|
|
247 |
rsize r \<le> Suc (N + rsize (RSTAR r0))"
|
|
248 |
apply(insert star_lambda_form)
|
|
249 |
apply(simp)
|
|
250 |
done
|
|
251 |
|
|
252 |
|
|
253 |
|
|
254 |
|
|
255 |
lemma star_control_bounded:
|
|
256 |
shows "\<forall>s. rsize (rders_simp r0 s) \<le> N \<Longrightarrow>
|
|
257 |
(sum_list (map rsize (rdistinct (map (\<lambda>s1. RSEQ (rders_simp r0 s1) (RSTAR r0))
|
|
258 |
(star_updates s r0 [[c]]) ) {}) ) ) \<le>
|
|
259 |
(card (sizeNregex (Suc (N + rsize (RSTAR r0))))) * (Suc (N + rsize (RSTAR r0)))
|
|
260 |
"
|
|
261 |
apply(subgoal_tac "\<forall>r \<in> set (map (\<lambda>s1. RSEQ (rders_simp r0 s1) (RSTAR r0))
|
|
262 |
(star_updates s r0 [[c]]) ). (rsize r ) \<le> Suc (N + rsize (RSTAR r0))")
|
|
263 |
prefer 2
|
|
264 |
using star_lambda_ders apply blast
|
|
265 |
using distinct_list_rexp_up_to_certain_size_bouded_by_set_enumerating_up_to_that_size by blast
|
|
266 |
|
|
267 |
|
|
268 |
lemma star_control_variant:
|
|
269 |
assumes "\<forall>s. rsize (rders_simp r0 s) \<le> N"
|
|
270 |
shows"Suc
|
|
271 |
(sum_list (map rsize (rdistinct (map (\<lambda>s1. RSEQ (rders_simp r0 s1) (RSTAR r0))
|
|
272 |
(star_updates list r0 [[a]])) {})))
|
|
273 |
\<le> (Suc (card (sizeNregex (Suc (N + rsize (RSTAR r0))))) * Suc (N + rsize (RSTAR r0))) "
|
|
274 |
apply(subgoal_tac "(sum_list (map rsize (rdistinct (map (\<lambda>s1. RSEQ (rders_simp r0 s1) (RSTAR r0))
|
|
275 |
(star_updates list r0 [[a]])) {})))
|
|
276 |
\<le> ( (card (sizeNregex (Suc (N + rsize (RSTAR r0))))) * Suc (N + rsize (RSTAR r0))) ")
|
|
277 |
prefer 2
|
|
278 |
using assms star_control_bounded apply presburger
|
|
279 |
by simp
|
|
280 |
|
|
281 |
|
|
282 |
|
|
283 |
lemma star_closed_form_bounded:
|
|
284 |
shows "\<forall>s. rsize (rders_simp r0 s) \<le> N \<Longrightarrow>
|
|
285 |
rsize (rders_simp (RSTAR r0) s) \<le>
|
|
286 |
max ( (Suc (card (sizeNregex (Suc (N + rsize (RSTAR r0))))) * (Suc (N + rsize (RSTAR r0))))) (rsize (RSTAR r0))"
|
|
287 |
apply(case_tac s)
|
|
288 |
apply simp
|
|
289 |
apply(subgoal_tac " rsize (rders_simp (RSTAR r0) (a # list)) =
|
|
290 |
rsize (rsimp ( RALTS ( (map (\<lambda>s1. RSEQ (rders_simp r0 s1) (RSTAR r0) ) (star_updates list r0 [[a]]) ) )))")
|
|
291 |
prefer 2
|
|
292 |
using star_closed_form apply presburger
|
|
293 |
apply(subgoal_tac "rsize (rsimp (
|
|
294 |
RALTS ( (map (\<lambda>s1. RSEQ (rders_simp r0 s1) (RSTAR r0) ) (star_updates list r0 [[a]]) ) )))
|
|
295 |
\<le> Suc (sum_list (map rsize (rdistinct (map (\<lambda>s1. RSEQ (rders_simp r0 s1) (RSTAR r0) )
|
|
296 |
(star_updates list r0 [[a]]) ) {}) ) )")
|
|
297 |
prefer 2
|
|
298 |
using star_closed_form_bounded_by_rdistinct_list_estimate apply presburger
|
|
299 |
apply(subgoal_tac "Suc (sum_list
|
|
300 |
(map rsize
|
|
301 |
(rdistinct (map (\<lambda>s1. RSEQ (rders_simp r0 s1) (RSTAR r0)) (star_updates list r0 [[a]])) {})))
|
|
302 |
\<le> (Suc (card (sizeNregex (Suc (N + rsize (RSTAR r0))))) * Suc (N + rsize (RSTAR r0))) ")
|
|
303 |
apply auto[1]
|
|
304 |
using star_control_variant by blast
|
|
305 |
|
|
306 |
|
|
307 |
lemma seq_list_estimate_control: shows
|
|
308 |
" rsize (rsimp (RALTS (RSEQ (rders_simp r1 s) r2 # map (rders_simp r2) (vsuf s r1))))
|
|
309 |
\<le> Suc (sum_list (map rsize (rdistinct (RSEQ (rders_simp r1 s) r2 # map (rders_simp r2) (vsuf s r1)) {})))"
|
|
310 |
by(metis alts_simp_control)
|
|
311 |
|
445
|
312 |
lemma map_ders_is_list_of_ders:
|
|
313 |
shows "\<forall>s. rsize (rders_simp r2 s) \<le> N2 \<Longrightarrow>
|
|
314 |
\<forall>r \<in> set (rdistinct (map (rders_simp r2) Ss) {}). rsize r \<le> N2"
|
|
315 |
apply(rule same_regex_property_after_distinct)
|
|
316 |
by simp
|
|
317 |
|
444
|
318 |
lemma seq_estimate_bounded:
|
|
319 |
assumes "\<forall>s. rsize (rders_simp r1 s) \<le> N1" and "\<forall>s. rsize (rders_simp r2 s) \<le> N2"
|
|
320 |
shows
|
|
321 |
"Suc (sum_list (map rsize (rdistinct (RSEQ (rders_simp r1 s) r2 # map (rders_simp r2) (vsuf s r1)) {}))) \<le>
|
|
322 |
Suc (Suc (N1 + (rsize r2)) + (N2 * card (sizeNregex N2)))"
|
445
|
323 |
apply(subgoal_tac " (sum_list (map rsize (rdistinct (RSEQ (rders_simp r1 s) r2 # map (rders_simp r2) (vsuf s r1)) {}))) \<le>
|
|
324 |
(Suc (N1 + (rsize r2)) + (N2 * card (sizeNregex N2)))")
|
|
325 |
apply force
|
|
326 |
apply(subgoal_tac " (sum_list (map rsize (rdistinct (RSEQ (rders_simp r1 s) r2 # map (rders_simp r2) (vsuf s r1)) {}))) \<le>
|
|
327 |
(rsize (RSEQ (rders_simp r1 s) r2)) + (sum_list (map rsize (rdistinct (map (rders_simp r2) (vsuf s r1)) {})) )")
|
|
328 |
prefer 2
|
|
329 |
using triangle_inequality_distinct apply blast
|
|
330 |
apply(subgoal_tac " sum_list (map rsize (rdistinct (map (rders_simp r2) (vsuf s r1)) {})) \<le> N2 * card (sizeNregex N2) ")
|
|
331 |
apply(subgoal_tac "rsize (RSEQ (rders_simp r1 s) r2) \<le> Suc (N1 + rsize r2)")
|
|
332 |
apply linarith
|
|
333 |
apply (simp add: assms(1))
|
|
334 |
apply(subgoal_tac "\<forall>r \<in> set (rdistinct (map (rders_simp r2) (vsuf s r1)) {}). rsize r \<le> N2")
|
|
335 |
apply (metis (no_types, opaque_lifting) assms(2) distinct_list_rexp_up_to_certain_size_bouded_by_set_enumerating_up_to_that_size ex_map_conv mult.commute)
|
|
336 |
using assms(2) map_ders_is_list_of_ders by blast
|
444
|
337 |
|
|
338 |
|
|
339 |
lemma seq_closed_form_bounded: shows
|
|
340 |
"\<lbrakk>\<forall>s. rsize (rders_simp r1 s) \<le> N1 ; \<forall>s. rsize (rders_simp r2 s) \<le> N2\<rbrakk> \<Longrightarrow>
|
|
341 |
rsize (rders_simp (RSEQ r1 r2) s) \<le>
|
|
342 |
max (Suc (Suc (N1 + (rsize r2)) + (N2 * card (sizeNregex N2)))) (rsize (RSEQ r1 r2)) "
|
|
343 |
apply(case_tac s)
|
|
344 |
apply simp
|
|
345 |
apply(subgoal_tac " (rders_simp (RSEQ r1 r2) s) =
|
|
346 |
rsimp (RALTS ((RSEQ (rders_simp r1 s) r2) # (map (rders_simp r2) (vsuf s r1))))")
|
|
347 |
prefer 2
|
|
348 |
using seq_closed_form_variant apply blast
|
|
349 |
apply(subgoal_tac "rsize (rsimp (RALTS (RSEQ (rders_simp r1 s) r2 # map (rders_simp r2) (vsuf s r1))))
|
|
350 |
\<le>
|
|
351 |
Suc (sum_list (map rsize (rdistinct (RSEQ (rders_simp r1 s) r2 # map (rders_simp r2) (vsuf s r1)) {})))")
|
|
352 |
apply(subgoal_tac "Suc (sum_list (map rsize (rdistinct (RSEQ (rders_simp r1 s) r2 # map (rders_simp r2) (vsuf s r1)) {})))
|
|
353 |
\<le> Suc (Suc (N1 + (rsize r2)) + (N2 * card (sizeNregex N2)))")
|
|
354 |
prefer 2
|
|
355 |
using seq_estimate_bounded apply blast
|
|
356 |
apply(subgoal_tac "rsize (rders_simp (RSEQ r1 r2) s) \<le> Suc (Suc (N1 + rsize r2) + N2 * card (sizeNregex N2))")
|
|
357 |
using le_max_iff_disj apply blast
|
|
358 |
apply auto[1]
|
|
359 |
using seq_list_estimate_control by presburger
|
|
360 |
|
|
361 |
|
|
362 |
lemma rders_simp_bounded: shows
|
|
363 |
"\<exists>N. \<forall>s. rsize (rders_simp r s) \<le> N"
|
|
364 |
apply(induct r)
|
|
365 |
apply(rule_tac x = "Suc 0 " in exI)
|
|
366 |
using three_easy_cases0 apply force
|
|
367 |
using three_easy_cases1 apply blast
|
|
368 |
using three_easy_casesC apply blast
|
|
369 |
using seq_closed_form_bounded apply blast
|
|
370 |
apply (metis alts_closed_form_bounded size_list_estimation')
|
|
371 |
using star_closed_form_bounded by blast
|
|
372 |
|
|
373 |
|
|
374 |
|
|
375 |
|
|
376 |
|
|
377 |
|
|
378 |
|
|
379 |
|
|
380 |
|
|
381 |
|
|
382 |
|
|
383 |
|
|
384 |
|
|
385 |
|
|
386 |
|
|
387 |
|
|
388 |
(*Obsolete materials*)
|
|
389 |
|
|
390 |
|
|
391 |
|
|
392 |
end
|