diff -r f824e1331fc6 -r bd5a8a6b3871 progs/Matcher.thy --- a/progs/Matcher.thy Wed Nov 27 08:49:51 2013 +0000 +++ b/progs/Matcher.thy Wed Nov 27 21:36:30 2013 +0000 @@ -2,6 +2,7 @@ imports "Main" begin + section {* Regular Expressions *} datatype rexp = @@ -82,6 +83,34 @@ | "nullable (STAR r) = True" fun + noccurs :: "rexp \ bool" +where + "noccurs (NULL) = True" +| "noccurs (EMPTY) = False" +| "noccurs (CHAR c) = False" +| "noccurs (ALT r1 r2) = (noccurs r1 \ noccurs r2)" +| "noccurs (SEQ r1 r2) = (noccurs r1 \ noccurs r2)" +| "noccurs (STAR r) = (noccurs r)" + +lemma + "\ noccurs r \ L r \ {}" +apply(induct r) +apply(auto simp add: Seq_def) +done + +lemma + "L r = {} \ noccurs r" +apply(induct r) +apply(auto simp add: Seq_def) +done + +lemma does_not_hold: + "noccurs r \ L r = {}" +apply(induct r) +apply(auto simp add: Seq_def) +oops + +fun der :: "char \ rexp \ rexp" where "der c (NULL) = NULL" @@ -110,6 +139,25 @@ by (induct r) (auto simp add: Seq_def) section {* Left-Quotient of a Set *} +fun + zeroable :: "rexp \ bool" +where + "zeroable (NULL) = True" +| "zeroable (EMPTY) = False" +| "zeroable (CHAR c) = False" +| "zeroable (ALT r1 r2) = (zeroable r1 \ zeroable r2)" +| "zeroable (SEQ r1 r2) = (zeroable r1 \ zeroable r2)" +| "zeroable (STAR r) = False" + + +lemma zeroable_correctness: + shows "zeroable r \ (L r = {})" +apply(induct r) +apply(auto simp add: Seq_def)[6] +done + +section {* Left-Quotient of a Set *} + definition Der :: "char \ string set \ string set" where