Paper/Paper.thy
author urbanc
Mon, 31 Jan 2011 12:54:31 +0000
changeset 54 c19d2fc2cc69
parent 53 da85feadb8e3
child 58 0d4d5bb321dc
permissions -rw-r--r--
a bit more on the paper
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
     1
(*<*)
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
     2
theory Paper
39
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
     3
imports "../Myhill" "LaTeXsugar"
24
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
     4
begin
39
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
     5
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
     6
declare [[show_question_marks = false]]
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
     7
54
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
     8
consts
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
     9
 REL :: "(string \<times> string) \<Rightarrow> bool"
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    10
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    11
39
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
    12
notation (latex output)
50
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    13
  str_eq_rel ("\<approx>\<^bsub>_\<^esub>") and
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    14
  Seq (infixr "\<cdot>" 100) and
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    15
  Star ("_\<^bsup>\<star>\<^esup>") and
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    16
  pow ("_\<^bsup>_\<^esup>" [100, 100] 100) and
54
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    17
  Suc ("_+1>" [100] 100) and
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    18
  quotient ("_ \<^raw:\ensuremath{\!\sslash\!}> _" [90, 90] 90) and
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    19
  REL ("\<approx>")
52
4a517c6ac07d tuning of the syntax; needs the stmaryrd latex package
urbanc
parents: 51
diff changeset
    20
39
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
    21
24
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
    22
(*>*)
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
    23
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
    24
section {* Introduction *}
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
    25
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
    26
text {*
54
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    27
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    28
  Therefore instead of defining a regular language as being one where there exists an
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    29
  automata that regognises all of its strings, we define 
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    30
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    31
  \begin{definition}[A Regular Language]
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    32
  A language @{text A} is regular, if there is a regular expression that matches all
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    33
  strings of @{text "A"}.
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    34
  \end{definition}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    35
  
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    36
  \noindent
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    37
  {\bf Contributions:} A proof of the Myhil-Nerode Theorem based on regular expressions. The 
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    38
  finiteness part of this theorem is proved using tagging-functions (which to our knowledge
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    39
  are novel in this context).
24
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
    40
  
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
    41
*}
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
    42
50
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    43
section {* Preliminaries *}
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    44
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    45
text {*
54
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    46
  Strings in Isabelle/HOL are lists of characters. Therefore the
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    47
  \emph{empty string} is represented by the empty list, written @{term "[]"}. \emph{Languages} are sets of 
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    48
  strings. The language containing all strings is abbreviated as @{term "UNIV::string set"}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    49
  and the notation for the quotient of a language @{text A} according to a relation @{term REL} is
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    50
  @{term "A // REL"}.
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    51
  
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    52
  Set operations
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    53
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    54
  \begin{center}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    55
  @{thm Seq_def}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    56
  \end{center}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    57
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    58
  \noindent
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    59
  where @{text "@"} is the usual list-append operation.
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    60
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    61
  \noindent
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    62
  Regular expressions are defined as the following datatype
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    63
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    64
  \begin{center}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    65
  @{text r} @{text "::="}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    66
  @{term NULL}\hspace{1.5mm}@{text"|"}\hspace{1.5mm} 
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    67
  @{term EMPTY}\hspace{1.5mm}@{text"|"}\hspace{1.5mm} 
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    68
  @{term "CHAR c"}\hspace{1.5mm}@{text"|"}\hspace{1.5mm} 
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    69
  @{term "SEQ r r"}\hspace{1.5mm}@{text"|"}\hspace{1.5mm} 
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    70
  @{term "ALT r r"}\hspace{1.5mm}@{text"|"}\hspace{1.5mm} 
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    71
  @{term "STAR r"}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    72
  \end{center}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
    73
51
6cfb92de4654 some tuning of the paper
urbanc
parents: 50
diff changeset
    74
  Central to our proof will be the solution of equational systems
50
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    75
  involving regular expressions. For this we will use the following ``reverse'' 
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    76
  version of Arden's lemma.
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    77
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    78
  \begin{lemma}[Reverse Arden's Lemma]\mbox{}\\
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    79
  If @{thm (prem 1) ardens_revised} then
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    80
  @{thm (lhs) ardens_revised} has the unique solution
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    81
  @{thm (rhs) ardens_revised}.
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    82
  \end{lemma}
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    83
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    84
  \begin{proof}
51
6cfb92de4654 some tuning of the paper
urbanc
parents: 50
diff changeset
    85
  For the right-to-left direction we assume @{thm (rhs) ardens_revised} and show
6cfb92de4654 some tuning of the paper
urbanc
parents: 50
diff changeset
    86
  that @{thm (lhs) ardens_revised} holds. From Lemma ??? we have @{term "A\<star> = {[]} \<union> A ;; A\<star>"},
50
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    87
  which is equal to @{term "A\<star> = {[]} \<union> A\<star> ;; A"}. Adding @{text B} to both 
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    88
  sides gives @{term "B ;; A\<star> = B ;; ({[]} \<union> A\<star> ;; A)"}, whose right-hand side
51
6cfb92de4654 some tuning of the paper
urbanc
parents: 50
diff changeset
    89
  is equal to @{term "(B ;; A\<star>) ;; A \<union> B"}. This completes this direction. 
50
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    90
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    91
  For the other direction we assume @{thm (lhs) ardens_revised}. By a simple induction
51
6cfb92de4654 some tuning of the paper
urbanc
parents: 50
diff changeset
    92
  on @{text n}, we can establish the property
50
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    93
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    94
  \begin{center}
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    95
  @{text "(*)"}\hspace{5mm} @{thm (concl) ardens_helper}
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    96
  \end{center}
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    97
  
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    98
  \noindent
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
    99
  Using this property we can show that @{term "B ;; (A \<up> n) \<subseteq> X"} holds for
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
   100
  all @{text n}. From this we can infer @{term "B ;; A\<star> \<subseteq> X"} using Lemma ???.
51
6cfb92de4654 some tuning of the paper
urbanc
parents: 50
diff changeset
   101
  For the inclusion in the other direction we assume a string @{text s}
50
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
   102
  with length @{text k} is element in @{text X}. Since @{thm (prem 1) ardens_revised}
51
6cfb92de4654 some tuning of the paper
urbanc
parents: 50
diff changeset
   103
  we know that @{term "s \<notin> X ;; (A \<up> Suc k)"} since its length is only @{text k}
6cfb92de4654 some tuning of the paper
urbanc
parents: 50
diff changeset
   104
  (the strings in @{term "X ;; (A \<up> Suc k)"} are all longer). 
53
da85feadb8e3 small typo
urbanc
parents: 52
diff changeset
   105
  From @{text "(*)"} it follows then that
50
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
   106
  @{term s} must be element in @{term "(\<Union>m\<in>{0..k}. B ;; (A \<up> m))"}. This in turn
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
   107
  implies that @{term s} is in @{term "(\<Union>n. B ;; (A \<up> n))"}. Using Lemma ??? this
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
   108
  is equal to @{term "B ;; A\<star>"}, as we needed to show.\qed
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
   109
  \end{proof}
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
   110
*}
39
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   111
54
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   112
section {* Finite Partitions Imply Regularity of a Language *}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   113
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   114
text {*
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   115
  \begin{theorem}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   116
  Given a language @{text A}.
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   117
  @{thm[mode=IfThen] hard_direction[where Lang="A"]}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   118
  \end{theorem}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   119
*}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   120
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   121
section {* Regular Expressions Generate Finitely Many Partitions *}
39
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   122
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   123
text {*
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   124
54
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   125
  \begin{theorem}
39
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   126
  Given @{text "r"} is a regular expressions, then @{thm rexp_imp_finite}.
54
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   127
  \end{theorem}  
39
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   128
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   129
  \begin{proof}
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   130
  By induction on the structure of @{text r}. The cases for @{const NULL}, @{const EMPTY}
50
32bff8310071 revised proof of Ardens lemma
urbanc
parents: 39
diff changeset
   131
  and @{const CHAR} are straightforward, because we can easily establish
39
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   132
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   133
  \begin{center}
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   134
  \begin{tabular}{l}
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   135
  @{thm quot_null_eq}\\
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   136
  @{thm quot_empty_subset}\\
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   137
  @{thm quot_char_subset}
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   138
  \end{tabular}
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   139
  \end{center}
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   140
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   141
  \end{proof}
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   142
*}
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   143
a59473f0229d tuned a little bit the section about finite partitions
urbanc
parents: 37
diff changeset
   144
54
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   145
section {* Conclusion and Related Work *}
c19d2fc2cc69 a bit more on the paper
urbanc
parents: 53
diff changeset
   146
24
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
   147
(*<*)
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
   148
end
f72c82bf59e5 added paper
urbanc
parents:
diff changeset
   149
(*>*)