# HG changeset patch # User urbanc # Date 1297371640 0 # Node ID 3b9deda4f45960f65a94f3fa0836758aa2054b99 # Parent 9540c2f2ea778ac8efffc43e382e9d234980e918 simplified a bit the proof diff -r 9540c2f2ea77 -r 3b9deda4f459 Myhill_1.thy --- a/Myhill_1.thy Thu Feb 10 13:10:16 2011 +0000 +++ b/Myhill_1.thy Thu Feb 10 21:00:40 2011 +0000 @@ -402,6 +402,13 @@ "L_rhs rhs = \ (L ` rhs)" end +lemma L_rhs_union_distrib: + fixes A B::"rhs_item set" + shows "L A \ L B = L (A \ B)" +by simp + + + text {* Transitions between equivalence classes *} definition @@ -412,14 +419,14 @@ text {* Initial equational system *} definition - "init_rhs CS X \ + "Init_rhs CS X \ if ([] \ X) then {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}" definition - "eqs CS \ {(X, init_rhs CS X) | X. X \ CS}" + "Init CS \ {(X, Init_rhs CS X) | X. X \ CS}" @@ -464,9 +471,6 @@ definition "Subst_all ES X xrhs \ {(Y, Subst yrhs X xrhs) | Y yrhs. (Y, yrhs) \ ES}" - -section {* While-combinator *} - text {* The following term @{text "remove ES Y yrhs"} removes the equation @{text "Y = yrhs"} from equational system @{text "ES"} by replacing @@ -476,30 +480,33 @@ *} definition - "Remove ES Y yrhs \ - Subst_all (ES - {(Y, yrhs)}) Y (Arden Y yrhs)" + "Remove ES X xrhs \ + Subst_all (ES - {(X, xrhs)}) X (Arden X xrhs)" + + +section {* While-combinator *} text {* - The following term @{text "iterm X ES"} represents one iteration in the while loop. + The following term @{text "Iter X ES"} represents one iteration in the while loop. It arbitrarily chooses a @{text "Y"} different from @{text "X"} to remove. *} definition - "iter X ES \ (let (Y, yrhs) = SOME (Y, yrhs). (Y, yrhs) \ ES \ (X \ Y) + "Iter X ES \ (let (Y, yrhs) = SOME (Y, yrhs). (Y, yrhs) \ ES \ X \ Y in Remove ES Y yrhs)" text {* - The following term @{text "reduce X ES"} repeatedly removes characteriztion equations + The following term @{text "Reduce X ES"} repeatedly removes characteriztion equations for unknowns other than @{text "X"} until one is left. *} definition - "reduce X ES \ while (\ ES. card ES \ 1) (iter X) ES" + "Reduce X ES \ while (\ ES. card ES \ 1) (Iter X) ES" text {* - Since the @{text "while"} combinator from HOL library is used to implement @{text "reduce X ES"}, + Since the @{text "while"} combinator from HOL library is used to implement @{text "Reduce X ES"}, the induction principle @{thm [source] while_rule} is used to proved the desired properties - of @{text "reduce X ES"}. For this purpose, an invariant predicate @{text "invariant"} is defined + of @{text "Reduce X ES"}. For this purpose, an invariant predicate @{text "invariant"} is defined in terms of a series of auxilliary predicates: *} @@ -573,6 +580,13 @@ "invariant ES \ valid_eqns ES \ finite ES \ distinct_equas ES \ ardenable ES \ finite_rhs ES \ self_contained ES" + +lemma invariantI: + assumes "valid_eqns ES" "finite ES" "distinct_equas ES" "ardenable ES" + "finite_rhs ES" "self_contained ES" + shows "invariant ES" +using assms by (simp add: invariant_def) + subsection {* The proof of this direction *} subsubsection {* Basic properties *} @@ -581,10 +595,6 @@ The following are some basic properties of the above definitions. *} -lemma L_rhs_union_distrib: - fixes A B::"rhs_item set" - shows "L A \ L B = L (A \ B)" -by simp lemma finite_Trn: assumes fin: "finite rhs" @@ -601,7 +611,7 @@ qed lemma finite_Lam: - assumes fin:"finite rhs" + assumes fin: "finite rhs" shows "finite {r. Lam r \ rhs}" proof - have "finite {Lam r | r. Lam r \ rhs}" @@ -614,16 +624,13 @@ qed lemma rexp_of_empty: - assumes finite:"finite rhs" - and nonempty:"rhs_nonempty rhs" + assumes finite: "finite rhs" + and nonempty: "rhs_nonempty rhs" shows "[] \ L (\ {r. Trn X r \ rhs})" using finite nonempty rhs_nonempty_def using finite_Trn[OF finite] by (auto) -lemma [intro!]: - "P (Trn X r) \ (\a. (\r. a = Trn X r \ P a))" by auto - lemma lang_of_rexp_of: assumes finite:"finite rhs" shows "L ({Trn X r| r. Trn X r \ rhs}) = X ;; (L (\{r. Trn X r \ rhs}))" @@ -632,41 +639,30 @@ by (rule finite_Trn[OF finite]) then show ?thesis apply(auto simp add: Seq_def) - apply(rule_tac x = "s\<^isub>1" in exI, rule_tac x = "s\<^isub>2" in exI, auto) + apply(rule_tac x = "s\<^isub>1" in exI, rule_tac x = "s\<^isub>2" in exI) + apply(auto) apply(rule_tac x= "Trn X xa" in exI) - apply(auto simp: Seq_def) + apply(auto simp add: Seq_def) done qed -lemma rexp_of_lam_eq_lam_set: - assumes fin: "finite rhs" - shows "L (\{r. Lam r \ rhs}) = L ({Lam r | r. Lam r \ rhs})" -proof - - have "finite ({r. Lam r \ rhs})" using fin by (rule finite_Lam) - then show ?thesis by auto -qed - -lemma [simp]: - "L (append_rexp r xb) = L xb ;; L r" -apply (cases xb, auto simp: Seq_def) -apply(rule_tac x = "s\<^isub>1 @ s\<^isub>1'" in exI, rule_tac x = "s\<^isub>2'" in exI) -apply(auto simp: Seq_def) -done +lemma lang_of_append: + "L (append_rexp r rhs_item) = L rhs_item ;; L r" +by (induct rule: append_rexp.induct) + (auto simp add: seq_assoc) lemma lang_of_append_rhs: "L (append_rhs_rexp rhs r) = L rhs ;; L r" -apply (auto simp:append_rhs_rexp_def image_def) -apply (auto simp:Seq_def) -apply (rule_tac x = "L xb ;; L r" in exI, auto simp add:Seq_def) -by (rule_tac x = "append_rexp r xb" in exI, auto simp:Seq_def) +unfolding append_rhs_rexp_def +by (auto simp add: Seq_def lang_of_append) lemma classes_of_union_distrib: - "classes_of A \ classes_of B = classes_of (A \ B)" -by (auto simp add:classes_of_def) + shows "classes_of (A \ B) = classes_of A \ classes_of B" +by (auto simp add: classes_of_def) lemma lefts_of_union_distrib: - "lefts_of A \ lefts_of B = lefts_of (A \ B)" -by (auto simp:lefts_of_def) + shows "lefts_of (A \ B) = lefts_of A \ lefts_of B" +by (auto simp add: lefts_of_def) subsubsection {* Intialization *} @@ -702,7 +698,7 @@ qed lemma l_eq_r_in_eqs: - assumes X_in_eqs: "(X, xrhs) \ (eqs (UNIV // (\Lang)))" + assumes X_in_eqs: "(X, xrhs) \ (Init (UNIV // (\Lang)))" shows "X = L xrhs" proof show "X \ L xrhs" @@ -713,12 +709,12 @@ proof (cases "x = []") assume empty: "x = []" thus ?thesis using X_in_eqs "(1)" - by (auto simp:eqs_def init_rhs_def) + by (auto simp: Init_def Init_rhs_def) next assume not_empty: "x \ []" then obtain clist c where decom: "x = clist @ [c]" by (case_tac x rule:rev_cases, auto) - have "X \ UNIV // (\Lang)" using X_in_eqs by (auto simp:eqs_def) + have "X \ UNIV // (\Lang)" using X_in_eqs by (auto simp:Init_def) then obtain Y where "Y \ UNIV // (\Lang)" and "Y ;; {[c]} \ X" @@ -730,17 +726,17 @@ 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) + by (simp add: Init_def Init_rhs_def) qed qed next show "L xrhs \ X" using X_in_eqs - by (auto simp:eqs_def init_rhs_def transition_def) + by (auto simp:Init_def Init_rhs_def transition_def) qed -lemma finite_init_rhs: +lemma finite_Init_rhs: assumes finite: "finite CS" - shows "finite (init_rhs CS X)" + shows "finite (Init_rhs CS X)" proof- have "finite {Trn Y (CHAR c) |Y c. Y \ CS \ Y ;; {[c]} \ X}" (is "finite ?A") proof - @@ -753,34 +749,36 @@ ultimately show ?thesis by auto qed - thus ?thesis by (simp add:init_rhs_def transition_def) + thus ?thesis by (simp add:Init_rhs_def transition_def) qed -lemma init_ES_satisfy_invariant: - assumes finite_CS: "finite (UNIV // (\Lang))" - shows "invariant (eqs (UNIV // (\Lang)))" -proof - - have "finite (eqs (UNIV // (\Lang)))" using finite_CS - by (simp add:eqs_def) - moreover have "distinct_equas (eqs (UNIV // (\Lang)))" - by (simp add:distinct_equas_def eqs_def) - moreover have "ardenable (eqs (UNIV // (\Lang)))" - by (auto simp add:ardenable_def eqs_def init_rhs_def rhs_nonempty_def del:L_rhs.simps) - moreover have "valid_eqns (eqs (UNIV // (\Lang)))" - using l_eq_r_in_eqs by (simp add:valid_eqns_def) - moreover have "finite_rhs (eqs (UNIV // (\Lang)))" - using finite_init_rhs[OF finite_CS] - by (auto simp:finite_rhs_def eqs_def) - moreover have "self_contained (eqs (UNIV // (\Lang)))" - by (auto simp:self_contained_def eqs_def init_rhs_def classes_of_def lefts_of_def) - ultimately show ?thesis by (simp add:invariant_def) +lemma Init_ES_satisfies_invariant: + assumes finite_CS: "finite (UNIV // \A)" + shows "invariant (Init (UNIV // \A))" +proof (rule invariantI) + show "valid_eqns (Init (UNIV // \A))" + unfolding valid_eqns_def + using l_eq_r_in_eqs by simp + show "finite (Init (UNIV // \A))" using finite_CS + unfolding Init_def by simp + show "distinct_equas (Init (UNIV // \A))" + unfolding distinct_equas_def Init_def by simp + show "ardenable (Init (UNIV // \A))" + unfolding ardenable_def Init_def Init_rhs_def rhs_nonempty_def + by auto + show "finite_rhs (Init (UNIV // \A))" + using finite_Init_rhs[OF finite_CS] + unfolding finite_rhs_def Init_def by auto + show "self_contained (Init (UNIV // \A))" + unfolding self_contained_def Init_def Init_rhs_def classes_of_def lefts_of_def + by auto qed subsubsection {* Interation step *} text {* From this point until @{text "iteration_step"}, - the correctness of the iteration step @{text "iter X ES"} is proved. + the correctness of the iteration step @{text "Iter X ES"} is proved. *} lemma Arden_keeps_eq: @@ -906,8 +904,7 @@ lemma Subst_updates_cls: "X \ classes_of xrhs \ classes_of (Subst rhs X xrhs) = classes_of rhs \ classes_of xrhs - {X}" -apply (simp only:Subst_def append_rhs_keeps_cls - classes_of_union_distrib[THEN sym]) +apply (simp only:Subst_def append_rhs_keeps_cls classes_of_union_distrib) by (auto simp:classes_of_def) lemma Subst_all_keeps_self_contained: @@ -933,7 +930,7 @@ thus ?thesis using xrhs_xrhs' by (auto simp:Subst_updates_cls) qed moreover have "classes_of xrhs \ lefts_of ES \ {Y}" using X_in sc - apply (simp only:self_contained_def lefts_of_union_distrib[THEN sym]) + apply (simp only:self_contained_def lefts_of_union_distrib) by (drule_tac x = "(X, xrhs)" in bspec, auto simp:lefts_of_def) moreover have "classes_of (Arden Y yrhs) \ lefts_of ES \ {Y}" using sc @@ -945,22 +942,44 @@ } thus ?thesis by (auto simp only:Subst_all_def self_contained_def) qed -lemma Subst_all_satisfy_invariant: +lemma Subst_all_satisfies_invariant: assumes invariant_ES: "invariant (ES \ {(Y, yrhs)})" shows "invariant (Subst_all ES Y (Arden Y yrhs))" -proof - - have finite_yrhs: "finite yrhs" +proof (rule invariantI) + have Y_eq_yrhs: "Y = L yrhs" + using invariant_ES by (simp only:invariant_def valid_eqns_def, blast) + have finite_yrhs: "finite yrhs" using invariant_ES by (auto simp:invariant_def finite_rhs_def) have nonempty_yrhs: "rhs_nonempty yrhs" using invariant_ES by (auto simp:invariant_def ardenable_def) - have Y_eq_yrhs: "Y = L yrhs" - using invariant_ES by (simp only:invariant_def valid_eqns_def, blast) - have "distinct_equas (Subst_all ES Y (Arden Y yrhs))" + show "valid_eqns (Subst_all ES Y (Arden Y yrhs))" + proof- + have "Y = L (Arden Y yrhs)" + using Y_eq_yrhs invariant_ES finite_yrhs nonempty_yrhs + by (rule_tac Arden_keeps_eq, (simp add:rexp_of_empty)+) + thus ?thesis using invariant_ES + by (clarsimp simp add:valid_eqns_def + Subst_all_def Subst_keeps_eq invariant_def finite_rhs_def + simp del:L_rhs.simps) + qed + show "finite (Subst_all ES Y (Arden Y yrhs))" + using invariant_ES by (simp add:invariant_def Subst_all_keeps_finite) + show "distinct_equas (Subst_all ES Y (Arden Y yrhs))" using invariant_ES by (auto simp:distinct_equas_def Subst_all_def invariant_def) - moreover have "finite (Subst_all ES Y (Arden Y yrhs))" - using invariant_ES by (simp add:invariant_def Subst_all_keeps_finite) - moreover have "finite_rhs (Subst_all ES Y (Arden Y yrhs))" + show "ardenable (Subst_all ES Y (Arden Y yrhs))" + proof - + { fix X rhs + assume "(X, rhs) \ ES" + hence "rhs_nonempty rhs" using prems invariant_ES + by (simp add:invariant_def ardenable_def) + with nonempty_yrhs + have "rhs_nonempty (Subst rhs Y (Arden Y yrhs))" + by (simp add:nonempty_yrhs + Subst_keeps_nonempty Arden_keeps_nonempty) + } thus ?thesis by (auto simp add:ardenable_def Subst_all_def) + qed + show "finite_rhs (Subst_all ES Y (Arden Y yrhs))" proof- have "finite_rhs ES" using invariant_ES by (simp add:invariant_def finite_rhs_def) @@ -973,32 +992,8 @@ ultimately show ?thesis by (simp add:Subst_all_keeps_finite_rhs) qed - moreover have "ardenable (Subst_all ES Y (Arden Y yrhs))" - proof - - { fix X rhs - assume "(X, rhs) \ ES" - hence "rhs_nonempty rhs" using prems invariant_ES - by (simp add:invariant_def ardenable_def) - with nonempty_yrhs - have "rhs_nonempty (Subst rhs Y (Arden Y yrhs))" - by (simp add:nonempty_yrhs - Subst_keeps_nonempty Arden_keeps_nonempty) - } thus ?thesis by (auto simp add:ardenable_def Subst_all_def) - qed - moreover have "valid_eqns (Subst_all ES Y (Arden Y yrhs))" - proof- - have "Y = L (Arden Y yrhs)" - using Y_eq_yrhs invariant_ES finite_yrhs nonempty_yrhs - by (rule_tac Arden_keeps_eq, (simp add:rexp_of_empty)+) - thus ?thesis using invariant_ES - by (clarsimp simp add:valid_eqns_def - Subst_all_def Subst_keeps_eq invariant_def finite_rhs_def - simp del:L_rhs.simps) - qed - moreover - have self_subst: "self_contained (Subst_all ES Y (Arden Y yrhs))" + show "self_contained (Subst_all ES Y (Arden Y yrhs))" using invariant_ES Subst_all_keeps_self_contained by (simp add:invariant_def) - ultimately show ?thesis using invariant_ES by (simp add:invariant_def) qed lemma Subst_all_card_le: @@ -1036,16 +1031,16 @@ assumes Inv_ES: "invariant ES" and X_in_ES: "(X, xrhs) \ ES" and not_T: "card ES \ 1" - shows "(invariant (iter X ES) \ (\ xrhs'.(X, xrhs') \ (iter X ES)) \ - (iter X ES, ES) \ measure card)" + shows "(invariant (Iter X ES) \ (\ xrhs'.(X, xrhs') \ (Iter X ES)) \ + (Iter X ES, ES) \ measure card)" proof - have finite_ES: "finite ES" using Inv_ES by (simp add: invariant_def) then obtain Y yrhs where Y_in_ES: "(Y, yrhs) \ ES" and not_eq: "(X, xrhs) \ (Y, yrhs)" using not_T X_in_ES by (drule_tac card_noteq_1_has_more, auto) - let ?ES' = "iter X ES" + let ?ES' = "Iter X ES" show ?thesis - proof(unfold iter_def Remove_def, rule someI2 [where a = "(Y, yrhs)"], clarsimp) + proof(unfold Iter_def Remove_def, rule someI2 [where a = "(Y, yrhs)"], clarsimp) from X_in_ES Y_in_ES and not_eq and Inv_ES show "(Y, yrhs) \ ES \ X \ Y" by (auto simp: invariant_def distinct_equas_def) @@ -1062,7 +1057,7 @@ card (Subst_all (ES - {(Y, yrhs)}) Y (Arden Y yrhs)) < card ES" proof - have "invariant (Subst_all (ES - {(Y, yrhs)}) Y (Arden Y yrhs))" - proof(rule Subst_all_satisfy_invariant) + proof(rule Subst_all_satisfies_invariant) from h have "(Y, yrhs) \ ES" by simp hence "ES - {(Y, yrhs)} \ {(Y, yrhs)} = ES" by auto with Inv_ES show "invariant (ES - {(Y, yrhs)} \ {(Y, yrhs)})" by auto @@ -1104,11 +1099,11 @@ lemma reduce_x: assumes inv: "invariant ES" and contain_x: "(X, xrhs) \ ES" - shows "\ xrhs'. reduce X ES = {(X, xrhs')} \ invariant(reduce X ES)" + shows "\ xrhs'. Reduce X ES = {(X, xrhs')} \ invariant(Reduce X ES)" proof - let ?Inv = "\ ES. (invariant ES \ (\ xrhs. (X, xrhs) \ ES))" show ?thesis - proof (unfold reduce_def, + proof (unfold Reduce_def, rule while_rule [where P = ?Inv and r = "measure card"]) from inv and contain_x show "?Inv ES" by auto next @@ -1116,7 +1111,7 @@ next fix ES assume inv: "?Inv ES" and crd: "card ES \ 1" - show "(iter X ES, ES) \ measure card" + show "(Iter X ES, ES) \ measure card" proof - from inv obtain xrhs where x_in: "(X, xrhs) \ ES" by auto from inv have "invariant ES" by simp @@ -1126,7 +1121,7 @@ next fix ES assume inv: "?Inv ES" and crd: "card ES \ 1" - thus "?Inv (iter X ES)" + thus "?Inv (Iter X ES)" proof - from inv obtain xrhs where x_in: "(X, xrhs) \ ES" by auto from inv have "invariant ES" by simp @@ -1144,91 +1139,89 @@ lemma last_cl_exists_rexp: assumes Inv_ES: "invariant {(X, xrhs)}" - shows "\ (r::rexp). L r = X" (is "\ r. ?P r") + shows "\r::rexp. L r = X" proof- def A \ "Arden X xrhs" - have "?P (\{r. Lam r \ A})" + have eq: "{Lam r | r. Lam r \ A} = A" proof - - have "L (\{r. Lam r \ A}) = L ({Lam r | r. Lam r \ A})" - proof(rule rexp_of_lam_eq_lam_set) - show "finite A" - unfolding A_def - using Inv_ES - by (rule_tac Arden_keeps_finite) - (auto simp add: invariant_def finite_rhs_def) - qed - also have "\ = L A" - proof- - have "{Lam r | r. Lam r \ A} = A" - proof- - have "classes_of A = {}" using Inv_ES - unfolding A_def - by (simp add:Arden_removes_cl - self_contained_def invariant_def lefts_of_def) - thus ?thesis - unfolding A_def - by (auto simp only: classes_of_def, case_tac x, auto) - qed - thus ?thesis by simp - qed - also have "\ = X" - unfolding A_def - proof(rule Arden_keeps_eq [THEN sym]) - show "X = L xrhs" using Inv_ES - by (auto simp only: invariant_def valid_eqns_def) - next - from Inv_ES show "[] \ L (\{r. Trn X r \ xrhs})" - by(simp add: invariant_def ardenable_def rexp_of_empty finite_rhs_def) - next - from Inv_ES show "finite xrhs" - by (simp add: invariant_def finite_rhs_def) - qed - finally show ?thesis by simp + have "classes_of A = {}" using Inv_ES + unfolding A_def self_contained_def invariant_def lefts_of_def + by (simp add: Arden_removes_cl) + thus ?thesis unfolding A_def classes_of_def + apply(auto simp only:) + apply(case_tac x) + apply(auto) + done qed - thus ?thesis by auto + have "finite A" using Inv_ES unfolding A_def invariant_def finite_rhs_def + using Arden_keeps_finite by auto + then have "finite {r. Lam r \ A}" by (rule finite_Lam) + then have "L (\{r. Lam r \ A}) = L ({Lam r | r. Lam r \ A})" + by auto + also have "\ = L A" by (simp add: eq) + also have "\ = X" + proof - + have "X = L xrhs" using Inv_ES unfolding invariant_def valid_eqns_def + by auto + moreover + from Inv_ES have "[] \ L (\{r. Trn X r \ xrhs})" + unfolding invariant_def ardenable_def finite_rhs_def + by(simp add: rexp_of_empty) + moreover + from Inv_ES have "finite xrhs" unfolding invariant_def finite_rhs_def + by simp + ultimately show "L A = X" unfolding A_def + by (rule Arden_keeps_eq[symmetric]) + qed + finally have "L (\{r. Lam r \ A}) = X" . + then show "\r::rexp. L r = X" by blast qed lemma every_eqcl_has_reg: - assumes finite_CS: "finite (UNIV // (\Lang))" - and X_in_CS: "X \ (UNIV // (\Lang))" - shows "\ (reg::rexp). L reg = X" (is "\ r. ?E r") + assumes finite_CS: "finite (UNIV // \A)" + and X_in_CS: "X \ (UNIV // \A)" + shows "\r::rexp. L r = X" proof - - let ?ES = " eqs (UNIV // \Lang)" - from X_in_CS - obtain xrhs where "(X, xrhs) \ ?ES" - by (auto simp:eqs_def init_rhs_def) - from reduce_x [OF init_ES_satisfy_invariant [OF finite_CS] this] - have "\xrhs'. reduce X ?ES = {(X, xrhs')} \ invariant (reduce X ?ES)" . - then obtain xrhs' where "invariant {(X, xrhs')}" by auto - from last_cl_exists_rexp [OF this] - show ?thesis . + def ES \ "Init (UNIV // \A)" + have "invariant ES" using finite_CS unfolding ES_def + by (rule Init_ES_satisfies_invariant) + moreover + from X_in_CS obtain xrhs where "(X, xrhs) \ ES" unfolding ES_def + unfolding Init_def Init_rhs_def by auto + ultimately + obtain xrhs' where "Reduce X ES = {(X, xrhs')}" "invariant (Reduce X ES)" + using reduce_x by blast + then show "\r::rexp. L r = X" + using last_cl_exists_rexp by auto qed -theorem hard_direction: +lemma bchoice_finite_set: + assumes a: "\x \ S. \y. x = f y" + and b: "finite S" + shows "\ys. (\ S) = \(f ` ys) \ finite ys" +using bchoice[OF a] b +apply(erule_tac exE) +apply(rule_tac x="fa ` S" in exI) +apply(auto) +done + +theorem Myhill_Nerode1: assumes finite_CS: "finite (UNIV // \A)" shows "\r::rexp. A = L r" proof - - have "\ X \ (UNIV // \A). \reg::rexp. X = L reg" + have f: "finite (finals A)" + using finals_in_partitions finite_CS by (rule finite_subset) + have "\X \ (UNIV // \A). \r::rexp. X = L r" using finite_CS every_eqcl_has_reg by blast - then obtain f - where f_prop: "\ X \ (UNIV // \A). X = L ((f X)::rexp)" - by (auto dest: bchoice) - def rs \ "f ` (finals A)" - have "A = \ (finals A)" using lang_is_union_of_finals by auto - also have "\ = L (\rs)" - proof - - have "finite rs" - proof - - have "finite (finals A)" - using finite_CS finals_in_partitions[of "A"] - by (erule_tac finite_subset, simp) - thus ?thesis using rs_def by auto - qed - thus ?thesis - using f_prop rs_def finals_in_partitions[of "A"] by auto - qed - finally show ?thesis by blast + then have a: "\X \ finals A. \r::rexp. X = L r" + using finals_in_partitions by auto + then obtain rs::"rexp set" where "\ (finals A) = \(L ` rs)" "finite rs" + using f by (auto dest: bchoice_finite_set) + then have "A = L (\rs)" + unfolding lang_is_union_of_finals[symmetric] by simp + then show "\r::rexp. A = L r" by blast qed + end \ No newline at end of file diff -r 9540c2f2ea77 -r 3b9deda4f459 Paper/Paper.thy --- a/Paper/Paper.thy Thu Feb 10 13:10:16 2011 +0000 +++ b/Paper/Paper.thy Thu Feb 10 21:00:40 2011 +0000 @@ -373,7 +373,7 @@ the language is regular. In our setting we therefore have to show: \begin{theorem}\label{myhillnerodeone} - @{thm[mode=IfThen] hard_direction} + @{thm[mode=IfThen] Myhill_Nerode1} \end{theorem} \noindent @@ -534,6 +534,19 @@ regular expression to @{text "xrhs"} and union it up with @{text rhs'}. When we use the substitution operation we will arrange it so that @{text "xrhs"} does not contain any occurence of @{text X}. + + We lift these two operation to work over equational systems @{text ES}: @{const Subst_all} + substitutes an equation @{text "X = xrhs"} throughout an equational system @{text ES}; + @{const Remove} completely removes such an equaution from @{text ES} by substituting + it to the rest of the equational system, but first removing all recursive occurences + of @{text X} by applying @{const Arden} to @{text "xrhs"}. + + \begin{center} + \begin{tabular}{rcl} + @{thm (lhs) Subst_all_def} & @{text "\"} & @{thm (rhs) Subst_all_def}\\ + @{thm (lhs) Remove_def} & @{text "\"} & @{thm (rhs) Remove_def} + \end{tabular} + \end{center} *} section {* Regular Expressions Generate Finitely Many Partitions *}