diff -r e31b733ace44 -r f72c82bf59e5 My.thy --- a/My.thy Thu Nov 18 11:39:17 2010 +0000 +++ b/My.thy Thu Nov 25 18:54:45 2010 +0000 @@ -1,12 +1,12 @@ theory My -imports Main +imports Main Infinite_Set begin definition - lang_seq :: "string set \ string set \ string set" ("_ ; _" [100,100] 100) + Seq :: "string set \ string set \ string set" ("_ ;; _" [100,100] 100) where - "L1 ; L2 = {s1 @ s2 | s1 s2. s1 \ L1 \ s2 \ L2}" + "L1 ;; L2 = {s1 @ s2 | s1 s2. s1 \ L1 \ s2 \ L2}" inductive_set Star :: "string set \ string set" ("_\" [101] 102) @@ -15,6 +15,32 @@ start[intro]: "[] \ L\" | step[intro]: "\s1 \ L; s2 \ L\\ \ s1@s2 \ L\" +lemma lang_star_cases: + shows "L\ = {[]} \ L ;; L\" +unfolding Seq_def +by (auto) (metis Star.simps) + +lemma lang_star_cases2: + shows "L ;; L\ = L\ ;; L" +sorry + + +theorem ardens_revised: + assumes nemp: "[] \ A" + shows "(X = X ;; A \ B) \ (X = B ;; A\)" +proof + assume eq: "X = B ;; A\" + have "A\ = {[]} \ A\ ;; A" sorry + then have "B ;; A\ = B ;; ({[]} \ A\ ;; A)" unfolding Seq_def by simp + also have "\ = B \ B ;; (A\ ;; A)" unfolding Seq_def by auto + also have "\ = B \ (B ;; A\) ;; A" unfolding Seq_def + by (auto) (metis append_assoc)+ + finally show "X = X ;; A \ B" using eq by auto +next + assume "X = X ;; A \ B" + then have "B \ X" "X ;; A \ X" by auto + show "X = B ;; A\" sorry +qed datatype rexp = NULL @@ -25,14 +51,14 @@ | STAR rexp fun - L_rexp :: "rexp \ string set" + Sem :: "rexp \ string set" ("\_\" [0] 1000) where - "L_rexp (NULL) = {}" - | "L_rexp (EMPTY) = {[]}" - | "L_rexp (CHAR c) = {[c]}" - | "L_rexp (SEQ r1 r2) = (L_rexp r1) ; (L_rexp r2)" - | "L_rexp (ALT r1 r2) = (L_rexp r1) \ (L_rexp r2)" - | "L_rexp (STAR r) = (L_rexp r)\" + "\NULL\ = {}" + | "\EMPTY\ = {[]}" + | "\CHAR c\ = {[c]}" + | "\SEQ r1 r2\ = \r1\ ;; \r2\" + | "\ALT r1 r2\ = \r1\ \ \r2\" + | "\STAR r\ = \r\\" definition folds :: "('a \ 'b \ 'b) \ 'b \ 'a set \ 'b" @@ -40,7 +66,7 @@ "folds f z S \ SOME x. fold_graph f z S x" lemma folds_simp_null [simp]: - "finite rs \ x \ L_rexp (folds ALT NULL rs) = (\r \ rs. x \ L_rexp r)" + "finite rs \ x \ \folds ALT NULL rs\ \ (\r \ rs. x \ \r\)" apply (simp add: folds_def) apply (rule someI2_ex) apply (erule finite_imp_fold_graph) @@ -49,7 +75,7 @@ done lemma folds_simp_empty [simp]: - "finite rs \ x \ L_rexp (folds ALT EMPTY rs) = ((\r \ rs. x \ L_rexp r) \ x = [])" + "finite rs \ x \ \folds ALT EMPTY rs\ \ (\r \ rs. x \ \r\) \ x = []" apply (simp add: folds_def) apply (rule someI2_ex) apply (erule finite_imp_fold_graph) @@ -58,7 +84,7 @@ done lemma [simp]: - "(x, y) \ {(x, y). P x y} \ P x y" + shows "(x, y) \ {(x, y). P x y} \ P x y" by simp definition @@ -103,11 +129,11 @@ qed lemma all_rexp: - "\finite (UNIV // \Lang); X \ (UNIV // \Lang)\ \ \r. X = L_rexp r" + "\finite (UNIV // \Lang); X \ (UNIV // \Lang)\ \ \r. X = \r\" sorry lemma final_rexp: - "\finite (UNIV // (\Lang)); final X Lang\ \ \r. X = L_rexp r" + "\finite (UNIV // (\Lang)); final X Lang\ \ \r. X = \r\" unfolding final_def using all_rexp by blast @@ -132,12 +158,12 @@ lemma finite_regular_aux: fixes Lang :: "string set" assumes "finite (UNIV // (\Lang))" - shows "\rs. Lang = L_rexp (folds ALT NULL rs)" + shows "\rs. Lang = \folds ALT NULL rs\" apply(subst lang_is_union_of_finals) using assms apply - apply(drule finite_final) -apply(drule_tac f="L_rexp" in finite_f_one_to_one) +apply(drule_tac f="Sem" in finite_f_one_to_one) apply(clarify) apply(drule final_rexp[OF assms]) apply(auto)[1] @@ -151,7 +177,7 @@ lemma finite_regular: fixes Lang :: "string set" assumes "finite (UNIV // (\Lang))" - shows "\r. Lang = L_rexp r" + shows "\r. Lang = \r\" using assms finite_regular_aux by auto @@ -239,7 +265,7 @@ definition transitions :: "string set \ string set \ rexp set" ("_\\_") where - "Y \\ X \ {CHAR c | c. Y ; {[c]} \ X}" + "Y \\ X \ {CHAR c | c. Y ;; {[c]} \ X}" definition transitions_rexp ("_ \\ _") @@ -250,7 +276,7 @@ "rhs CS X \ if X = {[]} then {({[]}, EMPTY)} else {(Y, Y \\X) | Y. Y \ CS}" definition - "rhs_sem CS X \ \ {(Y; L_rexp r) | Y r . (Y, r) \ rhs CS X}" + "rhs_sem CS X \ \ {(Y;; \r\) | Y r . (Y, r) \ rhs CS X}" definition "eqs CS \ (\X \ CS. {(X, rhs CS X)})" @@ -276,7 +302,7 @@ lemma every_eqclass_has_transition: assumes has_str: "s @ [c] \ X" and in_CS: "X \ UNIV // (\Lang)" - obtains Y where "Y \ UNIV // (\Lang)" and "Y ; {[c]} \ X" and "s \ Y" + obtains Y where "Y \ UNIV // (\Lang)" and "Y ;; {[c]} \ X" and "s \ Y" proof - def Y \ "(\Lang) `` {s}" have "Y \ UNIV // (\Lang)" @@ -284,22 +310,21 @@ moreover have "X = (\Lang) `` {s @ [c]}" using has_str in_CS defined_by_str by blast - then have "Y ; {[c]} \ X" - unfolding Y_def Image_def lang_seq_def + then have "Y ;; {[c]} \ X" + unfolding Y_def Image_def Seq_def unfolding str_eq_rel_def by (auto) (simp add: str_eq_def) moreover have "s \ Y" unfolding Y_def unfolding Image_def str_eq_rel_def str_eq_def by simp - moreover - have "True" by simp (* FIXME *) - note that - ultimately show thesis by blast + (*moreover + have "True" by simp FIXME *) + ultimately show thesis by (blast intro: that) qed lemma test: assumes "[] \ X" - shows "[] \ L_rexp (Y \\ X)" + shows "[] \ \Y \\ X\" using assms by (simp add: transitions_rexp_def) @@ -308,7 +333,7 @@ shows "X \ rhs_sem (UNIV // (\Lang)) X" apply(case_tac "X = {[]}") apply(simp) -apply(simp add: rhs_sem_def rhs_def lang_seq_def) +apply(simp add: rhs_sem_def rhs_def Seq_def) apply(rule subsetI) apply(case_tac "x = []") apply(simp add: rhs_sem_def rhs_def) @@ -317,4 +342,48 @@ apply(rule_tac x = "X" in exI) apply(simp add: assms) apply(simp add: transitions_rexp_def) -oops \ No newline at end of file +oops + + +(* +fun + power :: "string \ nat \ string" (infixr "\" 100) +where + "s \ 0 = s" +| "s \ (Suc n) = s @ (s \ n)" + +definition + "Lone = {(''0'' \ n) @ (''1'' \ n) | n. True }" + +lemma + "infinite (UNIV // (\Lone))" +unfolding infinite_iff_countable_subset +apply(rule_tac x="\n. {(''0'' \ n) @ (''1'' \ i) | i. i \ {..n} }" in exI) +apply(auto) +prefer 2 +unfolding Lone_def +unfolding quotient_def +unfolding Image_def +apply(simp) +unfolding str_eq_rel_def +unfolding str_eq_def +apply(auto) +apply(rule_tac x="''0'' \ n" in exI) +apply(auto) +unfolding infinite_nat_iff_unbounded +unfolding Lone_def +*) + + + +text {* Derivatives *} + +definition + DERS :: "string \ string set \ string set" +where + "DERS s L \ {s'. s @ s' \ L}" + +lemma + shows "x \L y \ DERS x L = DERS y L" +unfolding DERS_def str_eq_def +by auto \ No newline at end of file