13 "EClass x R \<equiv> R `` {x}" |
13 "EClass x R \<equiv> R `` {x}" |
14 |
14 |
15 abbreviation |
15 abbreviation |
16 "Append_rexp2 r_itm r == Append_rexp r r_itm" |
16 "Append_rexp2 r_itm r == Append_rexp r r_itm" |
17 |
17 |
|
18 abbreviation |
|
19 "pow" (infixl "\<up>" 100) |
|
20 where |
|
21 "A \<up> n \<equiv> A ^^ n" |
|
22 |
|
23 |
|
24 abbreviation "NULL \<equiv> Zero" |
|
25 abbreviation "EMPTY \<equiv> One" |
|
26 abbreviation "CHAR \<equiv> Atom" |
|
27 abbreviation "ALT \<equiv> Plus" |
|
28 abbreviation "SEQ \<equiv> Times" |
|
29 abbreviation "STAR \<equiv> Star" |
|
30 |
|
31 |
|
32 ML {* @{term "op ^^"} *} |
|
33 |
18 notation (latex output) |
34 notation (latex output) |
19 str_eq_rel ("\<approx>\<^bsub>_\<^esub>") and |
35 str_eq_rel ("\<approx>\<^bsub>_\<^esub>") and |
20 str_eq ("_ \<approx>\<^bsub>_\<^esub> _") and |
36 str_eq ("_ \<approx>\<^bsub>_\<^esub> _") and |
21 Seq (infixr "\<cdot>" 100) and |
37 conc (infixr "\<cdot>" 100) and |
22 Star ("_\<^bsup>\<star>\<^esup>") and |
38 star ("_\<^bsup>\<star>\<^esup>") and |
23 pow ("_\<^bsup>_\<^esup>" [100, 100] 100) and |
39 pow ("_\<^bsup>_\<^esup>" [100, 100] 100) and |
24 Suc ("_+1" [100] 100) and |
40 Suc ("_+1" [100] 100) and |
25 quotient ("_ \<^raw:\ensuremath{\!\sslash\!}> _" [90, 90] 90) and |
41 quotient ("_ \<^raw:\ensuremath{\!\sslash\!}> _" [90, 90] 90) and |
26 REL ("\<approx>") and |
42 REL ("\<approx>") and |
27 UPLUS ("_ \<^raw:\ensuremath{\uplus}> _" [90, 90] 90) and |
43 UPLUS ("_ \<^raw:\ensuremath{\uplus}> _" [90, 90] 90) and |
28 L_rexp ("\<^raw:\ensuremath{\cal{L}}>'(_')" [0] 101) and |
44 lang ("\<^raw:\ensuremath{\cal{L}}>'(_')" [0] 101) and |
29 Lam ("\<lambda>'(_')" [100] 100) and |
45 Lam ("\<lambda>'(_')" [100] 100) and |
30 Trn ("'(_, _')" [100, 100] 100) and |
46 Trn ("'(_, _')" [100, 100] 100) and |
31 EClass ("\<lbrakk>_\<rbrakk>\<^bsub>_\<^esub>" [100, 100] 100) and |
47 EClass ("\<lbrakk>_\<rbrakk>\<^bsub>_\<^esub>" [100, 100] 100) and |
32 transition ("_ \<^raw:\ensuremath{\stackrel{\text{>_\<^raw:}}{\Longmapsto}}> _" [100, 100, 100] 100) and |
48 transition ("_ \<^raw:\ensuremath{\stackrel{\text{>_\<^raw:}}{\Longmapsto}}> _" [100, 100, 100] 100) and |
33 Setalt ("\<^raw:\ensuremath{\bigplus}>_" [1000] 999) and |
49 Setalt ("\<^raw:\ensuremath{\bigplus}>_" [1000] 999) and |
34 Append_rexp2 ("_ \<^raw:\ensuremath{\triangleleft}> _" [100, 100] 100) and |
50 Append_rexp2 ("_ \<^raw:\ensuremath{\triangleleft}> _" [100, 100] 100) and |
35 Append_rexp_rhs ("_ \<^raw:\ensuremath{\triangleleft}> _" [100, 100] 50) and |
51 Append_rexp_rhs ("_ \<^raw:\ensuremath{\triangleleft}> _" [100, 100] 50) and |
36 |
52 |
37 uminus ("\<^raw:\ensuremath{\overline{>_\<^raw:}}>" [100] 100) and |
53 uminus ("\<^raw:\ensuremath{\overline{>_\<^raw:}}>" [100] 100) and |
38 tag_str_ALT ("tag\<^isub>A\<^isub>L\<^isub>T _ _" [100, 100] 100) and |
54 tag_str_Plus ("tag\<^isub>A\<^isub>L\<^isub>T _ _" [100, 100] 100) and |
39 tag_str_ALT ("tag\<^isub>A\<^isub>L\<^isub>T _ _ _" [100, 100, 100] 100) and |
55 tag_str_Plus ("tag\<^isub>A\<^isub>L\<^isub>T _ _ _" [100, 100, 100] 100) and |
40 tag_str_SEQ ("tag\<^isub>S\<^isub>E\<^isub>Q _ _" [100, 100] 100) and |
56 tag_str_Times ("tag\<^isub>S\<^isub>E\<^isub>Q _ _" [100, 100] 100) and |
41 tag_str_SEQ ("tag\<^isub>S\<^isub>E\<^isub>Q _ _ _" [100, 100, 100] 100) and |
57 tag_str_Times ("tag\<^isub>S\<^isub>E\<^isub>Q _ _ _" [100, 100, 100] 100) and |
42 tag_str_STAR ("tag\<^isub>S\<^isub>T\<^isub>A\<^isub>R _" [100] 100) and |
58 tag_str_Star ("tag\<^isub>S\<^isub>T\<^isub>A\<^isub>R _" [100] 100) and |
43 tag_str_STAR ("tag\<^isub>S\<^isub>T\<^isub>A\<^isub>R _ _" [100, 100] 100) |
59 tag_str_Star ("tag\<^isub>S\<^isub>T\<^isub>A\<^isub>R _ _" [100, 100] 100) |
44 |
60 |
45 lemma meta_eq_app: |
61 lemma meta_eq_app: |
46 shows "f \<equiv> \<lambda>x. g x \<Longrightarrow> f x \<equiv> g x" |
62 shows "f \<equiv> \<lambda>x. g x \<Longrightarrow> f x \<equiv> g x" |
47 by auto |
63 by auto |
48 |
64 |
|
65 lemma conc_def': |
|
66 "A \<cdot> B = {s\<^isub>1 @ s\<^isub>2 | s\<^isub>1 s\<^isub>2. s\<^isub>1 \<in> A \<and> s\<^isub>2 \<in> B}" |
|
67 unfolding conc_def by simp |
|
68 |
49 (* THEOREMS *) |
69 (* THEOREMS *) |
|
70 |
|
71 lemma conc_Union_left: |
|
72 shows "B \<cdot> (\<Union>n. A \<up> n) = (\<Union>n. B \<cdot> (A \<up> n))" |
|
73 unfolding conc_def by auto |
|
74 |
50 notation (Rule output) |
75 notation (Rule output) |
51 "==>" ("\<^raw:\mbox{}\inferrule{\mbox{>_\<^raw:}}>\<^raw:{\mbox{>_\<^raw:}}>") |
76 "==>" ("\<^raw:\mbox{}\inferrule{\mbox{>_\<^raw:}}>\<^raw:{\mbox{>_\<^raw:}}>") |
52 |
77 |
53 syntax (Rule output) |
78 syntax (Rule output) |
54 "_bigimpl" :: "asms \<Rightarrow> prop \<Rightarrow> prop" |
79 "_bigimpl" :: "asms \<Rightarrow> prop \<Rightarrow> prop" |
275 Isabelle/HOL as @{term "UNIV::string set"}. The concatenation of two languages |
300 Isabelle/HOL as @{term "UNIV::string set"}. The concatenation of two languages |
276 is written @{term "A \<cdot> B"} and a language raised to the power @{text n} is written |
301 is written @{term "A \<cdot> B"} and a language raised to the power @{text n} is written |
277 @{term "A \<up> n"}. They are defined as usual |
302 @{term "A \<up> n"}. They are defined as usual |
278 |
303 |
279 \begin{center} |
304 \begin{center} |
280 @{thm Seq_def[THEN eq_reflection, where A1="A" and B1="B"]} |
305 @{thm conc_def'[THEN eq_reflection, where A1="A" and B1="B"]} |
281 \hspace{7mm} |
306 \hspace{7mm} |
282 @{thm pow.simps(1)[THEN eq_reflection, where A1="A"]} |
307 @{thm lang_pow.simps(1)[THEN eq_reflection, where A1="A"]} |
283 \hspace{7mm} |
308 \hspace{7mm} |
284 @{thm pow.simps(2)[THEN eq_reflection, where A1="A" and n1="n"]} |
309 @{thm lang_pow.simps(2)[THEN eq_reflection, where A1="A" and n1="n"]} |
285 \end{center} |
310 \end{center} |
286 |
311 |
287 \noindent |
312 \noindent |
288 where @{text "@"} is the list-append operation. The Kleene-star of a language @{text A} |
313 where @{text "@"} is the list-append operation. The Kleene-star of a language @{text A} |
289 is defined as the union over all powers, namely @{thm Star_def}. In the paper |
314 is defined as the union over all powers, namely @{thm star_def}. In the paper |
290 we will make use of the following properties of these constructions. |
315 we will make use of the following properties of these constructions. |
291 |
316 |
292 \begin{proposition}\label{langprops}\mbox{}\\ |
317 \begin{proposition}\label{langprops}\mbox{}\\ |
293 \begin{tabular}{@ {}ll} |
318 \begin{tabular}{@ {}ll} |
294 (i) & @{thm star_cases} \\ |
319 (i) & @{thm star_cases} \\ |
295 (ii) & @{thm[mode=IfThen] pow_length}\\ |
320 (ii) & @{thm[mode=IfThen] pow_length}\\ |
296 (iii) & @{thm seq_Union_left} \\ |
321 (iii) & @{thm conc_Union_left} \\ |
297 \end{tabular} |
322 \end{tabular} |
298 \end{proposition} |
323 \end{proposition} |
299 |
324 |
300 \noindent |
325 \noindent |
301 In @{text "(ii)"} we use the notation @{term "length s"} for the length of a |
326 In @{text "(ii)"} we use the notation @{term "length s"} for the length of a |
370 and the language matched by a regular expression is defined as |
395 and the language matched by a regular expression is defined as |
371 |
396 |
372 \begin{center} |
397 \begin{center} |
373 \begin{tabular}{c@ {\hspace{10mm}}c} |
398 \begin{tabular}{c@ {\hspace{10mm}}c} |
374 \begin{tabular}{rcl} |
399 \begin{tabular}{rcl} |
375 @{thm (lhs) L_rexp.simps(1)} & @{text "\<equiv>"} & @{thm (rhs) L_rexp.simps(1)}\\ |
400 @{thm (lhs) lang.simps(1)} & @{text "\<equiv>"} & @{thm (rhs) lang.simps(1)}\\ |
376 @{thm (lhs) L_rexp.simps(2)} & @{text "\<equiv>"} & @{thm (rhs) L_rexp.simps(2)}\\ |
401 @{thm (lhs) lang.simps(2)} & @{text "\<equiv>"} & @{thm (rhs) lang.simps(2)}\\ |
377 @{thm (lhs) L_rexp.simps(3)[where c="c"]} & @{text "\<equiv>"} & @{thm (rhs) L_rexp.simps(3)[where c="c"]}\\ |
402 @{thm (lhs) lang.simps(3)[where a="c"]} & @{text "\<equiv>"} & @{thm (rhs) lang.simps(3)[where a="c"]}\\ |
378 \end{tabular} |
403 \end{tabular} |
379 & |
404 & |
380 \begin{tabular}{rcl} |
405 \begin{tabular}{rcl} |
381 @{thm (lhs) L_rexp.simps(4)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]} & @{text "\<equiv>"} & |
406 @{thm (lhs) lang.simps(4)[where ?r="r\<^isub>1" and ?s="r\<^isub>2"]} & @{text "\<equiv>"} & |
382 @{thm (rhs) L_rexp.simps(4)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}\\ |
407 @{thm (rhs) lang.simps(4)[where ?r="r\<^isub>1" and ?s="r\<^isub>2"]}\\ |
383 @{thm (lhs) L_rexp.simps(5)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]} & @{text "\<equiv>"} & |
408 @{thm (lhs) lang.simps(5)[where ?r="r\<^isub>1" and ?s="r\<^isub>2"]} & @{text "\<equiv>"} & |
384 @{thm (rhs) L_rexp.simps(5)[where ?r1.0="r\<^isub>1" and ?r2.0="r\<^isub>2"]}\\ |
409 @{thm (rhs) lang.simps(5)[where ?r="r\<^isub>1" and ?s="r\<^isub>2"]}\\ |
385 @{thm (lhs) L_rexp.simps(6)[where r="r"]} & @{text "\<equiv>"} & |
410 @{thm (lhs) lang.simps(6)[where r="r"]} & @{text "\<equiv>"} & |
386 @{thm (rhs) L_rexp.simps(6)[where r="r"]}\\ |
411 @{thm (rhs) lang.simps(6)[where r="r"]}\\ |
387 \end{tabular} |
412 \end{tabular} |
388 \end{tabular} |
413 \end{tabular} |
389 \end{center} |
414 \end{center} |
390 |
415 |
391 Given a finite set of regular expressions @{text rs}, we will make use of the operation of generating |
416 Given a finite set of regular expressions @{text rs}, we will make use of the operation of generating |