# HG changeset patch # User wu # Date 1287838298 0 # Node ID 440a01d100ebe1bb24e9661c801374e59f51de7a # Parent 475dd40cd73440d55c7f13189b50ffd7596f1ab8 add some proofs about the other direction 1: the NULL case 2: the EMPTY case 3: the atomic CHAR c case diff -r 475dd40cd734 -r 440a01d100eb MyhillNerode.thy --- a/MyhillNerode.thy Fri Oct 22 19:43:56 2010 +0000 +++ b/MyhillNerode.thy Sat Oct 23 12:51:38 2010 +0000 @@ -1312,6 +1312,169 @@ where "QUOT Lang \ (\x. {\x\Lang})" +(* by chunhan *) +lemma quot_lambda: "QUOT {[]} = {{[]}, UNIV - {[]}}" +proof + show "QUOT {[]} \ {{[]}, UNIV - {[]}}" + proof + fix x + assume in_quot: "x \ QUOT {[]}" + show "x \ {{[]}, UNIV - {[]}}" + proof - + from in_quot + have "x = {[]} \ x = UNIV - {[]}" + unfolding QUOT_def equiv_class_def + proof + fix xa + assume in_univ: "xa \ UNIV" + and in_eqiv: "x \ {{y. xa \{[]}\ y}}" + show "x = {[]} \ x = UNIV - {[]}" + proof(cases "xa = []") + case True + hence "{y. xa \{[]}\ y} = {[]}" using in_eqiv + by (auto simp add:equiv_str_def) + thus ?thesis using in_eqiv by (rule_tac disjI1, simp) + next + case False + hence "{y. xa \{[]}\ y} = UNIV - {[]}" using in_eqiv + by (auto simp:equiv_str_def) + thus ?thesis using in_eqiv by (rule_tac disjI2, simp) + qed + qed + thus ?thesis by simp + qed + qed +next + show "{{[]}, UNIV - {[]}} \ QUOT {[]}" + proof + fix x + assume in_res: "x \ {{[]}, (UNIV::string set) - {[]}}" + show "x \ (QUOT {[]})" + proof - + have "x = {[]} \ x \ QUOT {[]}" + apply (simp add:QUOT_def equiv_class_def equiv_str_def) + by (rule_tac x = "[]" in exI, auto) + moreover have "x = UNIV - {[]} \ x \ QUOT {[]}" + apply (simp add:QUOT_def equiv_class_def equiv_str_def) + by (rule_tac x = "''a''" in exI, auto) + ultimately show ?thesis using in_res by blast + qed + qed +qed + +lemma quot_single_aux: "\x \ []; x \ [c]\ \ x @ z \ [c]" +by (induct x, auto) + +lemma quot_single: "\ (c::char). QUOT {[c]} = {{[]}, {[c]}, UNIV - {[], [c]}}" +proof - + fix c::"char" + have exist_another: "\ a. a \ c" + apply (case_tac "c = CHR ''a''") + apply (rule_tac x = "CHR ''b''" in exI, simp) + by (rule_tac x = "CHR ''a''" in exI, simp) + show "QUOT {[c]} = {{[]}, {[c]}, UNIV - {[], [c]}}" + proof + show "QUOT {[c]} \ {{[]},{[c]}, UNIV - {[], [c]}}" + proof + fix x + assume in_quot: "x \ QUOT {[c]}" + show "x \ {{[]}, {[c]}, UNIV - {[],[c]}}" + proof - + from in_quot + have "x = {[]} \ x = {[c]} \ x = UNIV - {[],[c]}" + unfolding QUOT_def equiv_class_def + proof + fix xa + assume in_eqiv: "x \ {{y. xa \{[c]}\ y}}" + show "x = {[]} \ x = {[c]} \ x = UNIV - {[], [c]}" + proof- + have "xa = [] \ x = {[]}" using in_eqiv + by (auto simp add:equiv_str_def) + moreover have "xa = [c] \ x = {[c]}" + proof - + have "xa = [c] \ {y. xa \{[c]}\ y} = {[c]}" using in_eqiv + apply (simp add:equiv_str_def) + apply (rule set_ext, rule iffI, simp) + apply (drule_tac x = "[]" in spec, auto) + done + thus "xa = [c] \ x = {[c]}" using in_eqiv by simp + qed + moreover have "\xa \ []; xa \ [c]\ \ x = UNIV - {[],[c]}" + proof - + have "\xa \ []; xa \ [c]\ \ {y. xa \{[c]}\ y} = UNIV - {[],[c]}" + apply (clarsimp simp add:equiv_str_def) + apply (rule set_ext, rule iffI, simp) + apply (rule conjI) + apply (drule_tac x = "[c]" in spec, simp) + apply (drule_tac x = "[]" in spec, simp) + by (auto dest:quot_single_aux) + thus "\xa \ []; xa \ [c]\ \ x = UNIV - {[],[c]}" using in_eqiv by simp + qed + ultimately show ?thesis by blast + qed + qed + thus ?thesis by simp + qed + qed + next + show "{{[]}, {[c]}, UNIV - {[],[c]}} \ QUOT {[c]}" + proof + fix x + assume in_res: "x \ {{[]},{[c]}, (UNIV::string set) - {[],[c]}}" + show "x \ (QUOT {[c]})" + proof - + have "x = {[]} \ x \ QUOT {[c]}" + apply (simp add:QUOT_def equiv_class_def equiv_str_def) + by (rule_tac x = "[]" in exI, auto) + moreover have "x = {[c]} \ x \ QUOT {[c]}" + apply (simp add:QUOT_def equiv_class_def equiv_str_def) + apply (rule_tac x = "[c]" in exI, simp) + apply (rule set_ext, rule iffI, simp+) + by (drule_tac x = "[]" in spec, simp) + moreover have "x = UNIV - {[],[c]} \ x \ QUOT {[c]}" + using exist_another + apply (clarsimp simp add:QUOT_def equiv_class_def equiv_str_def) + apply (rule_tac x = "[a]" in exI, simp) + apply (rule set_ext, rule iffI, simp) + apply (clarsimp simp:quot_single_aux, simp) + apply (rule conjI) + apply (drule_tac x = "[c]" in spec, simp) + by (drule_tac x = "[]" in spec, simp) + ultimately show ?thesis using in_res by blast + qed + qed + qed +qed + +lemma quot_seq: + assumes finite1: "finite (QUOT L\<^isub>1)" + and finite2: "finite (QUOT L\<^isub>2)" + shows "finite (QUOT (L\<^isub>1;L\<^isub>2))" +apply (simp add:QUOT_def equiv_class_def equiv_str_def) +sorry + +lemma quot_alt: + assumes finite1: "finite (QUOT L\<^isub>1)" + and finite2: "finite (QUOT L\<^isub>2)" + shows "finite (QUOT (L\<^isub>1 \ L\<^isub>2))" +sorry + +lemma quot_star: + assumes finite1: "finite (QUOT L\<^isub>1)" + shows "finite (QUOT (L\<^isub>1\))" +sorry + +lemma other_direction: + "Lang = L (r::rexp) \ finite (QUOT Lang)" +apply (induct arbitrary:Lang rule:rexp.induct) +apply (simp add:QUOT_def equiv_class_def equiv_str_def) +by (simp_all add:quot_lambda quot_single quot_seq quot_alt quot_star) + + + + + + lemma test: "UNIV Quo Lang = QUOT Lang" by (auto simp add: quot_def QUOT_def)