Myhill.thy
author zhang
Sat, 05 Feb 2011 13:56:50 +0000
changeset 68 dceb84acdee8
parent 64 b69d4e04e64a
child 69 ecf6c61a4541
permissions -rw-r--r--
Check in Myhill.thy before trying another way to explain DFA
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
     1
theory Myhill
62
d94209ad2880 Copy Myhill.thy into Myhill_2.thyand put Myhill_2.thy into logic ListP. Myhill.thy is now almost empty ready to be extended by new manuscripts.
zhang
parents: 57
diff changeset
     2
  imports Myhill_2
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
     3
begin
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
     4
48
61d9684a557a Myhill.thy and Myhill_1.thy changed.
zhang
parents: 47
diff changeset
     5
section {* Direction @{text "regular language \<Rightarrow>finite partition"} *}
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
     6
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
     7
text {*
64
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
     8
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
     9
The intuition behind our treatment is still automata. Taking the automaton in 
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    10
Fig.\ref{fig_origin_auto} as an example, like any automaton, it
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    11
represents the vehicle used to recognize a certain regular language.
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    12
For any given string, the process starts from the left most and proceed 
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    13
character by character to the right, driving the state transtion of automaton 
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    14
starting from the initial state (the one marked by an short arrow). There could
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    15
be three outcomes:
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    16
  \begin{enumerate}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    17
   \item The process finally reaches the end of the string and the automaton is at an accepting
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    18
        state, in which case the string is considered a member of the language.
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    19
         For the automaton in Fig.\ref{fig_origin_auto}, @{text "a, ab, abb, abc, abbcc, b, baa"}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    20
         are such kind of strings.
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    21
   \item The process finally reaches the end of the string but the automaton is at an non-accepting
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    22
         state, in which case, the string is considered a non-member of the language. For the automaton 
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    23
         in Fig.\ref{fig_origin_auto}, @{text "ad, abbd, adbd, bdabbccd"}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    24
         are such kind of strings. \label{case_end_reject}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    25
   \item \label{case_stuck}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    26
     The process get stuck at the middle of the string, in which case, the string is considered
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    27
           a non-member of the lauguage.  For the automaton in Fig.\ref{fig_origin_auto}, 
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    28
           @{text "c, acb, bbacd, aaccd"} 
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    29
           are such kind of strings.
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    30
  \end{enumerate}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    31
To avoid the situation \ref{case_stuck} above, we can augment a normal automaton with a ``absorbing state'',
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    32
as the state $X_3$ in Fig.\ref{fig_extended_auto}. In an auguments automaton, the process of strings never
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    33
get stuck: whenever a string is recognized as not belonging to the language, the augmented automaton
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    34
is transfered into the ``absorbing state'' and kept there until the process reaches the end of the string, 
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    35
in which case, the string is rejected by situation \ref{case_end_reject} above.
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    36
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    37
Given a language @{text "Lang"} and a string @{text "x"}, the equivalent class @{text "\<approx>Lang `` {x}"}
68
dceb84acdee8 Check in Myhill.thy before trying another way to explain DFA
zhang
parents: 64
diff changeset
    38
corresponds to the state reached by processing @{text "x"} with the augmented automaton. Since  
dceb84acdee8 Check in Myhill.thy before trying another way to explain DFA
zhang
parents: 64
diff changeset
    39
@{text "\<approx>Lang `` {x}"} is defined for every @{text "x"}, it corresponds to the fact that 
dceb84acdee8 Check in Myhill.thy before trying another way to explain DFA
zhang
parents: 64
diff changeset
    40
the processing of @{text "x"} will never get stuck.
dceb84acdee8 Check in Myhill.thy before trying another way to explain DFA
zhang
parents: 64
diff changeset
    41
dceb84acdee8 Check in Myhill.thy before trying another way to explain DFA
zhang
parents: 64
diff changeset
    42
The most acquainted way to define a regular language @{text "Lang"} is by giving an automaton which
dceb84acdee8 Check in Myhill.thy before trying another way to explain DFA
zhang
parents: 64
diff changeset
    43
recorgizes every string in @{text "Lang"}. Fig.\ref{fig_origin_auto} gives such a automaton, which 
dceb84acdee8 Check in Myhill.thy before trying another way to explain DFA
zhang
parents: 64
diff changeset
    44
can be viewed as a way of assigning status to strings: for any given string @{text "x"}:
dceb84acdee8 Check in Myhill.thy before trying another way to explain DFA
zhang
parents: 64
diff changeset
    45
dceb84acdee8 Check in Myhill.thy before trying another way to explain DFA
zhang
parents: 64
diff changeset
    46
64
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    47
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    48
\begin{figure}[h!]
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    49
\centering
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    50
\subfigure[Original automaton]{\label{fig_origin_auto}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    51
\begin{minipage}{0.4\textwidth}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    52
\scalebox{0.8}{
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    53
\begin{tikzpicture}[ultra thick,>=latex]
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    54
  \node[draw,circle,initial] (start) {$X_0$};
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    55
  \node[draw,circle,accepting] at ($(start) + (3.5cm,2cm)$) (ac1) {$X_1$};
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    56
  \node[draw,circle,accepting] at ($(start) + (3.5cm,-2cm)$) (ac2) {$X_2$};
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    57
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    58
  \path[->] (start) edge [bend left] node [midway, above] {$a$} (ac1);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    59
  \path[->] (start) edge [bend right] node [midway, below] {$b$} (ac2);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    60
  \path[->] (ac1) edge [loop above] node [midway, above] {$b$} (ac1);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    61
  \path[->] (ac2) edge [loop below] node [midway, below] {$a$} (ac2);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    62
  \path[->] (ac1) edge [bend right] node [midway, left] {$c$} (ac2);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    63
  \path[->] (ac2) edge [bend right] node [midway, right] {$c$} (ac1);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    64
  \path[->] (ac1) edge node [midway, sloped, above] {$d$} (start);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    65
  \path[->] (ac2) edge node [midway, sloped, above] {$d$} (start);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    66
\end{tikzpicture}}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    67
\end{minipage}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    68
}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    69
\subfigure[Extended automaton]{\label{fig_extended_auto}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    70
\begin{minipage}{0.5\textwidth}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    71
\scalebox{0.8}{
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    72
\begin{tikzpicture}[ultra thick,>=latex]
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    73
  \node[draw,circle,initial] (start) {$X_0$};
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    74
  \node[draw,circle,accepting] at ($(start) + (3.5cm,2cm)$) (ac1) {$X_1$};
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    75
  \node[draw,circle,accepting] at ($(start) + (3.5cm,-2cm)$) (ac2) {$X_2$};
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    76
  \node[draw,circle] at ($(start) + (6.5cm,0cm)$) (ab) {$X_3$};
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    77
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    78
  \path[->] (start) edge [bend left] node [midway, above] {$a$} (ac1);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    79
  \path[->] (start) edge [bend right] node [midway, below] {$b$} (ac2);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    80
  \path[->] (ac1) edge [loop above] node [midway, above] {$b$} (ac1);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    81
  \path[->] (ac2) edge [loop below] node [midway, below] {$a$} (ac2);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    82
  \path[->] (ac1) edge [bend right] node [midway, left] {$c$} (ac2);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    83
  \path[->] (ac2) edge [bend right] node [midway, right] {$c$} (ac1);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    84
  \path[->] (ac1) edge node [midway, sloped, above] {$d$} (start);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    85
  \path[->] (ac2) edge node [midway, sloped, above] {$d$} (start);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    86
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    87
  \path [draw, rounded corners,->,dashed] (start) -- ($(start) + (0cm, 3.7cm)$)
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    88
         -- ($(ab) + (0cm, 3.7cm)$)  node[midway,above,sloped]{$\Sigma - \{a, b\}$} -- (ab);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    89
  \path[->,dashed] (ac1) edge node [midway, above, sloped] {$\Sigma - \{b,c,d\}$} (ab);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    90
  \path[->,dashed] (ac2) edge node [midway, below, sloped] {$\Sigma - \{a,c,d\}$} (ab);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    91
  \path[->,dashed] (ab) edge [loop right] node [midway, right] {$\Sigma$} (ab);
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    92
\end{tikzpicture}}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    93
\end{minipage}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    94
}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    95
\caption{The relationship between automata and finite partition}\label{fig_auto_part_rel}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    96
\end{figure}
b69d4e04e64a Added something to Myhill.thy, trying to explain the relationship between finite automata and language partition.
zhang
parents: 62
diff changeset
    97
55
d71424eb5d0c Myhill.thy IsabelleMakefile modified
zhang
parents: 49
diff changeset
    98
  *}
d71424eb5d0c Myhill.thy IsabelleMakefile modified
zhang
parents: 49
diff changeset
    99
31
b6815473ee2e 1. Myhill.thy is proved to correct some typos. 2. Some sections are added to the first direction. 3. The small theory of list difference is now separated into Prefix_subtract.thy and the ROOT.ML
zhang
parents: 30
diff changeset
   100
end