hws/hw03.tex
author Christian Urban <urbanc@in.tum.de>
Sun, 27 Oct 2019 13:32:15 +0000
changeset 674 e0a41a1f24cf
parent 652 4642e2073808
child 770 c563cf946497
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass{article}
264
4deef8ac5d72 uodated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 258
diff changeset
     2
\usepackage{../style}
4deef8ac5d72 uodated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 258
diff changeset
     3
\usepackage{../graphics}
23
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
\begin{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
\section*{Homework 3}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
347
22b5294daa2a updated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 294
diff changeset
     9
\HEADER
22b5294daa2a updated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 294
diff changeset
    10
23
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
\begin{enumerate}
647
180600c04da2 updated
Christian Urban <urbanc@in.tum.de>
parents: 577
diff changeset
    12
\item The regular expression matchers in Java, Python and Ruby can be
180600c04da2 updated
Christian Urban <urbanc@in.tum.de>
parents: 577
diff changeset
    13
  very slow with some (basic) regular expressions. What is the main
180600c04da2 updated
Christian Urban <urbanc@in.tum.de>
parents: 577
diff changeset
    14
  reason for this inefficient computation?
180600c04da2 updated
Christian Urban <urbanc@in.tum.de>
parents: 577
diff changeset
    15
  
401
5d85dc9779b1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 355
diff changeset
    16
\item What is a regular language? Are there alternative ways
5d85dc9779b1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 355
diff changeset
    17
      to define this notion? If yes, give an explanation why
5d85dc9779b1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 355
diff changeset
    18
      they define the same notion.
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    19
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    20
\item Why is every finite set of strings a regular language?
132
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 102
diff changeset
    21
401
5d85dc9779b1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 355
diff changeset
    22
\item Assume you have an alphabet consisting of the letters
5d85dc9779b1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 355
diff changeset
    23
      $a$, $b$ and $c$ only. (1) Find a regular expression
5d85dc9779b1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 355
diff changeset
    24
      that recognises the two strings $ab$ and $ac$. (2) Find
5d85dc9779b1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 355
diff changeset
    25
      a regular expression that matches all strings
5d85dc9779b1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 355
diff changeset
    26
      \emph{except} these two strings. Note, you can only use
5d85dc9779b1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 355
diff changeset
    27
      regular expressions of the form
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    28
      
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    29
  \begin{center} $r ::=
401
5d85dc9779b1 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 355
diff changeset
    30
    \ZERO \;|\; \ONE \;|\; c \;|\; r_1 + r_2 \;|\;
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    31
    r_1 \cdot r_2 \;|\; r^*$ 
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    32
  \end{center}
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    33
647
180600c04da2 updated
Christian Urban <urbanc@in.tum.de>
parents: 577
diff changeset
    34
%\item Define the function \textit{zeroable} which takes a
180600c04da2 updated
Christian Urban <urbanc@in.tum.de>
parents: 577
diff changeset
    35
%      regular expression as argument and returns a boolean.
180600c04da2 updated
Christian Urban <urbanc@in.tum.de>
parents: 577
diff changeset
    36
%      The function should satisfy the following property:
180600c04da2 updated
Christian Urban <urbanc@in.tum.de>
parents: 577
diff changeset
    37
%
180600c04da2 updated
Christian Urban <urbanc@in.tum.de>
parents: 577
diff changeset
    38
%  \begin{center}
180600c04da2 updated
Christian Urban <urbanc@in.tum.de>
parents: 577
diff changeset
    39
%    $\textit{zeroable(r)} \;\text{if and only if}\; 
180600c04da2 updated
Christian Urban <urbanc@in.tum.de>
parents: 577
diff changeset
    40
%    L(r) = \{\}$
180600c04da2 updated
Christian Urban <urbanc@in.tum.de>
parents: 577
diff changeset
    41
%  \end{center}
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    42
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    43
\item Given the alphabet $\{a,b\}$. Draw the automaton that has two
517
edab48a5b37e updated
cu
parents: 444
diff changeset
    44
  states, say $Q_0$ and $Q_1$.  The starting state is $Q_0$ and the
edab48a5b37e updated
cu
parents: 444
diff changeset
    45
  final state is $Q_1$. The transition function is given by
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    46
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    47
  \begin{center}
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    48
    \begin{tabular}{l}
517
edab48a5b37e updated
cu
parents: 444
diff changeset
    49
      $(Q_0, a) \rightarrow Q_0$\\
edab48a5b37e updated
cu
parents: 444
diff changeset
    50
      $(Q_0, b) \rightarrow Q_1$\\
edab48a5b37e updated
cu
parents: 444
diff changeset
    51
      $(Q_1, b) \rightarrow Q_1$
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    52
    \end{tabular}
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    53
  \end{center}
258
1e4da6d2490c updated programs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 146
diff changeset
    54
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    55
  What is the language recognised by this automaton?
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    56
355
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
    57
\item Give a non-deterministic finite automaton that can
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
    58
      recognise the language $L(a\cdot (a + b)^* \cdot c)$.
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    59
517
edab48a5b37e updated
cu
parents: 444
diff changeset
    60
\item Given a deterministic finite automaton $A(\varSigma, Q, Q_0, F,
355
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
    61
      \delta)$, define which language is recognised by this
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
    62
      automaton. Can you define also the language defined by a
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
    63
      non-deterministic automaton?
23
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
355
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
    65
\item Given the following deterministic finite automaton over
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
    66
      the alphabet $\{a, b\}$, find an automaton that
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
    67
      recognises the complement language. (Hint: Recall that
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
    68
      for the algorithm from the lectures, the automaton needs
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
    69
      to be in completed form, that is have a transition for
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
    70
      every letter from the alphabet.)
264
4deef8ac5d72 uodated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 258
diff changeset
    71
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    72
  \begin{center}
292
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
    73
    \begin{tikzpicture}[>=stealth',very thick,auto,
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
    74
                        every state/.style={minimum size=0pt,
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
    75
                        inner sep=2pt,draw=blue!50,very thick,
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
    76
                        fill=blue!20},scale=2]
517
edab48a5b37e updated
cu
parents: 444
diff changeset
    77
      \node[state, initial]        (q0) at ( 0,1) {$Q_0$};
edab48a5b37e updated
cu
parents: 444
diff changeset
    78
      \node[state, accepting]  (q1) at ( 1,1) {$Q_1$};
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    79
      \path[->] (q0) edge node[above] {$a$} (q1)
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    80
                (q1) edge [loop right] node {$b$} ();
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    81
    \end{tikzpicture}
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    82
  \end{center}
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    83
264
4deef8ac5d72 uodated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 258
diff changeset
    84
4deef8ac5d72 uodated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 258
diff changeset
    85
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    86
%\item Given the following deterministic finite automaton
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    87
%
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    88
%\begin{center}
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    89
%\begin{tikzpicture}[scale=3, line width=0.7mm]
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    90
%  \node[state, initial]        (q0) at ( 0,1) {$q_0$};
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    91
%  \node[state,accepting]  (q1) at ( 1,1) {$q_1$};
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    92
%  \node[state, accepting] (q2) at ( 2,1) {$q_2$};
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    93
%  \path[->] (q0) edge node[above] {$b$} (q1)
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    94
%                  (q1) edge [loop above] node[above] {$a$} ()
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    95
%                  (q2) edge [loop above] node[above] {$a, b$} ()
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    96
%                  (q1) edge node[above] {$b$} (q2)
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    97
%                  (q0) edge[bend right] node[below] {$a$} (q2)
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    98
%                  ;
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
    99
%\end{tikzpicture}
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   100
%\end{center}
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   101
%find the corresponding minimal automaton. State clearly which nodes
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   102
%can be merged.
31
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents: 30
diff changeset
   103
355
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
   104
\item Given the following non-deterministic finite automaton
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
   105
      over the alphabet $\{a, b\}$, find a deterministic
a259eec25156 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 347
diff changeset
   106
      finite automaton that recognises the same language:
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   107
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   108
  \begin{center}
292
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
   109
    \begin{tikzpicture}[>=stealth',very thick,auto,
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
   110
                        every state/.style={minimum size=0pt,
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
   111
                        inner sep=2pt,draw=blue!50,very thick,
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
   112
                        fill=blue!20},scale=2]
517
edab48a5b37e updated
cu
parents: 444
diff changeset
   113
      \node[state, initial]        (q0) at ( 0,1) {$Q_0$};
edab48a5b37e updated
cu
parents: 444
diff changeset
   114
      \node[state]                    (q1) at ( 1,1) {$Q_1$};
edab48a5b37e updated
cu
parents: 444
diff changeset
   115
      \node[state, accepting] (q2) at ( 2,1) {$Q_2$};
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   116
      \path[->] (q0) edge node[above] {$a$} (q1)
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   117
                (q0) edge [loop above] node[above] {$b$} ()
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   118
                (q0) edge [loop below] node[below] {$a$} ()
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   119
                (q1) edge node[above] {$a$} (q2);
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   120
    \end{tikzpicture}
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   121
  \end{center}
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   122
652
4642e2073808 updated
Christian Urban <urbanc@in.tum.de>
parents: 647
diff changeset
   123
\item \textbf{(Deleted for 2017, 2018, 2019)}
517
edab48a5b37e updated
cu
parents: 444
diff changeset
   124
  Given the following deterministic finite automaton over the
271
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   125
  alphabet $\{0, 1\}$, find the corresponding minimal automaton. In
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   126
  case states can be merged, state clearly which states can be merged.
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   127
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   128
  \begin{center}
292
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
   129
    \begin{tikzpicture}[>=stealth',very thick,auto,
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
   130
                        every state/.style={minimum size=0pt,
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
   131
                        inner sep=2pt,draw=blue!50,very thick,
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
   132
                        fill=blue!20},scale=2]
517
edab48a5b37e updated
cu
parents: 444
diff changeset
   133
      \node[state, initial]        (q0) at ( 0,1) {$Q_0$};
edab48a5b37e updated
cu
parents: 444
diff changeset
   134
      \node[state]                    (q1) at ( 1,1) {$Q_1$};
edab48a5b37e updated
cu
parents: 444
diff changeset
   135
      \node[state, accepting] (q4) at ( 2,1) {$Q_4$};
edab48a5b37e updated
cu
parents: 444
diff changeset
   136
      \node[state]                    (q2) at (0.5,0) {$Q_2$};
edab48a5b37e updated
cu
parents: 444
diff changeset
   137
      \node[state]                    (q3) at (1.5,0) {$Q_3$};
271
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   138
      \path[->] (q0) edge node[above] {$0$} (q1)
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   139
                (q0) edge node[right] {$1$} (q2)
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   140
                (q1) edge node[above] {$0$} (q4)
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   141
                (q1) edge node[right] {$1$} (q2)
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   142
                (q2) edge node[above] {$0$} (q3)
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   143
                (q2) edge [loop below] node {$1$} ()
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   144
                (q3) edge node[left] {$0$} (q4)
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   145
                (q3) edge [bend left=95, looseness = 2.2] node [left=2mm] {$1$} (q0)
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   146
                (q4) edge [loop right] node {$0, 1$} ();
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   147
    \end{tikzpicture}
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   148
  \end{center}
b9b54574ee41 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 267
diff changeset
   149
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   150
\item Given the following finite deterministic automaton over the alphabet $\{a, b\}$:
264
4deef8ac5d72 uodated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 258
diff changeset
   151
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   152
  \begin{center}
292
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
   153
    \begin{tikzpicture}[scale=2,>=stealth',very thick,auto,
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
   154
                        every state/.style={minimum size=0pt,
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
   155
                        inner sep=2pt,draw=blue!50,very thick,
7ed2a25dd115 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 271
diff changeset
   156
                        fill=blue!20}]
517
edab48a5b37e updated
cu
parents: 444
diff changeset
   157
      \node[state, initial, accepting]        (q0) at ( 0,1) {$Q_0$};
edab48a5b37e updated
cu
parents: 444
diff changeset
   158
      \node[state, accepting]                    (q1) at ( 1,1) {$Q_1$};
edab48a5b37e updated
cu
parents: 444
diff changeset
   159
      \node[state] (q2) at ( 2,1) {$Q_2$};
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   160
      \path[->] (q0) edge[bend left] node[above] {$a$} (q1)
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   161
                (q1) edge[bend left] node[above] {$b$} (q0)
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   162
                (q2) edge[bend left=50] node[below] {$b$} (q0)
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   163
                (q1) edge node[above] {$a$} (q2)
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   164
                (q2) edge [loop right] node {$a$} ()
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   165
                (q0) edge [loop below] node {$b$} ()
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   166
            ;
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   167
    \end{tikzpicture}
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   168
  \end{center}
31
e22ba348b209 added hw04
Christian Urban <urbanc@in.tum.de>
parents: 30
diff changeset
   169
267
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   170
  Give a regular expression that can recognise the same language as
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   171
  this automaton. (Hint: If you use Brzozwski's method, you can assume
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   172
  Arden's lemma which states that an equation of the form $q = q\cdot r + s$
a1544b804d1e updated homeworks
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 264
diff changeset
   173
  has the unique solution $q = s \cdot r^*$.)
294
c29853b672fb updated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 292
diff changeset
   174
c29853b672fb updated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 292
diff changeset
   175
\item If a non-deterministic finite automaton (NFA) has
c29853b672fb updated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 292
diff changeset
   176
$n$ states. How many states does a deterministic 
c29853b672fb updated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 292
diff changeset
   177
automaton (DFA) that can recognise the same language
c29853b672fb updated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 292
diff changeset
   178
as the NFA maximal need?
c29853b672fb updated hws
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 292
diff changeset
   179
444
3056a4c071b0 updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 401
diff changeset
   180
\item \POSTSCRIPT  
23
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
\end{enumerate}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
\end{document}
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
%%% Local Variables: 
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
%%% mode: latex
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
%%% TeX-master: t
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
%%% End: