diff -r 8ab3a06577cf -r 426070e68b21 Myhill_1.thy --- a/Myhill_1.thy Sun Feb 06 11:21:12 2011 +0000 +++ b/Myhill_1.thy Mon Feb 07 10:23:23 2011 +0000 @@ -133,27 +133,29 @@ shows "x @ y \ A\" using a b by (blast intro: star_intro1 star_intro2) +lemma star_cases: + shows "A\ = {[]} \ A ;; A\" +proof + { fix x + have "x \ A\ \ x \ {[]} \ A ;; A\" + unfolding Seq_def + by (induct rule: star_induct) (auto) + } + then show "A\ \ {[]} \ A ;; A\" by auto +next + show "{[]} \ A ;; A\ \ A\" + unfolding Seq_def by auto +qed + lemma star_decom: - "\x \ A\; x \ []\ \(\ a b. x = a @ b \ a \ [] \ a \ A \ b \ A\)" + assumes a: "x \ A\" "x \ []" + shows "\a b. x = a @ b \ a \ [] \ a \ A \ b \ A\" +using a apply(induct rule: star_induct) apply(simp) apply(blast) done -lemma lang_star_cases: - shows "L\ = {[]} \ L ;; L\" -proof - { fix x - have "x \ L\ \ x \ {[]} \ L ;; L\" - unfolding Seq_def - by (induct rule: star_induct) (auto) - } - then show "L\ \ {[]} \ L ;; L\" by auto -next - show "{[]} \ L ;; L\ \ L\" - unfolding Seq_def by auto -qed - lemma shows seq_Union_left: "B ;; (\n. A \ n) = (\n. B ;; (A \ n))" and seq_Union_right: "(\n. A \ n) ;; B = (\n. (A \ n) ;; B)" @@ -237,7 +239,7 @@ assume eq: "X = B ;; A\" have "A\ = {[]} \ A\ ;; A" unfolding seq_star_comm[symmetric] - by (rule lang_star_cases) + by (rule star_cases) then have "B ;; A\ = B ;; ({[]} \ A\ ;; A)" by (rule seq_add_left) also have "\ = B \ B ;; (A\ ;; A)" @@ -351,7 +353,7 @@ @{text "\A"} is an equivalence class defined by language @{text "A"}. *} definition - str_eq_rel ("\_" [100] 100) + str_eq_rel :: "lang \ (string \ string) set" ("\_" [100] 100) where "\A \ {(x, y). (\z. x @ z \ A \ y @ z \ A)}" @@ -361,7 +363,9 @@ *} definition - "finals A \ {\A `` {x} | x . x \ A}" + finals :: "lang \ lang set" +where + "finals A \ {\A `` {x} | x . x \ A}" text {* The following lemma establishes the relationshipt between @@ -464,14 +468,19 @@ @{text "CS"}, the term @{text "init_rhs CS X"} is used to extract the right hand side of the equation describing the formation of @{text "X"}. The definition of @{text "init_rhs"} is: - *} +*} + +definition + transition :: "lang \ char \ lang \ bool" ("_ \_\_" [100,100,100] 100) +where + "Y \c\ X \ Y ;; {[c]} \ X" definition "init_rhs CS X \ if ([] \ X) then - {Lam(EMPTY)} \ {Trn Y (CHAR c) | Y c. Y \ CS \ Y ;; {[c]} \ X} + {Lam EMPTY} \ {Trn Y (CHAR c) | Y c. Y \ CS \ Y \c\ X} else - {Trn Y (CHAR c)| Y c. Y \ CS \ Y ;; {[c]} \ X}" + {Trn Y (CHAR c)| Y c. Y \ CS \ Y \c\ X}" text {* In the definition of @{text "init_rhs"}, the term @@ -483,7 +492,7 @@ With the help of @{text "init_rhs"}, the equitional system descrbing the formation of every equivalent class inside @{text "CS"} is given by the following @{text "eqs(CS)"}. - *} +*} definition "eqs CS \ {(X, init_rhs CS X) | X. X \ CS}" @@ -546,10 +555,11 @@ With the help of the two functions immediately above, Ardens' transformation on right hand side @{text "rhs"} is implemented by the following function @{text "arden_variate X rhs"}. - After this transformation, the recursive occurent of @{text "X"} - in @{text "rhs"} will be eliminated, while the - string set defined by @{text "rhs"} is kept unchanged. - *} + After this transformation, the recursive occurence of @{text "X"} + in @{text "rhs"} will be eliminated, while the string set defined + by @{text "rhs"} is kept unchanged. +*} + definition "arden_variate X rhs \ append_rhs_rexp (rhs - items_of rhs X) (STAR (rexp_of rhs X))" @@ -580,9 +590,9 @@ "eqs_subst ES X xrhs \ {(Y, rhs_subst yrhs X xrhs) | Y yrhs. (Y, yrhs) \ ES}" text {* - The computation of regular expressions for equivalent classes is accomplished + The computation of regular expressions for equivalence classes is accomplished using a iteration principle given by the following lemma. - *} +*} lemma wf_iter [rule_format]: fixes f @@ -773,7 +783,7 @@ text {* The following several lemmas until @{text "init_ES_satisfy_Inv"} shows that the initial equational system satisfies invariant @{text "Inv"}. - *} +*} lemma defined_by_str: "\s \ X; X \ UNIV // (\Lang)\ \ X = (\Lang) `` {s}" @@ -824,16 +834,17 @@ and "clist \ Y" using decom "(1)" every_eqclass_has_transition by blast hence - "x \ L {Trn Y (CHAR c)| Y c. Y \ UNIV // (\Lang) \ Y ;; {[c]} \ X}" - using "(1)" decom + "x \ L {Trn Y (CHAR c)| Y c. Y \ UNIV // (\Lang) \ Y \c\ X}" + unfolding transition_def + using "(1)" decom by (simp, rule_tac x = "Trn Y (CHAR c)" in exI, simp add:Seq_def) - thus ?thesis using X_in_eqs "(1)" - by (simp add:eqs_def init_rhs_def) + thus ?thesis using X_in_eqs "(1)" + by (simp add: eqs_def init_rhs_def) qed qed next show "L xrhs \ X" using X_in_eqs - by (auto simp:eqs_def init_rhs_def) + by (auto simp:eqs_def init_rhs_def transition_def) qed lemma finite_init_rhs: @@ -851,7 +862,7 @@ ultimately show ?thesis by auto qed - thus ?thesis by (simp add:init_rhs_def) + thus ?thesis by (simp add:init_rhs_def transition_def) qed lemma init_ES_satisfy_Inv: @@ -884,7 +895,8 @@ From this point until @{text "iteration_step"}, it is proved that there exists iteration steps which keep @{text "Inv(ES)"} while decreasing the size of @{text "ES"}. - *} +*} + lemma arden_variate_keeps_eq: assumes l_eq_r: "X = L rhs" and not_empty: "[] \ L (rexp_of rhs X)"