Title: Finite Automata and Non Determinism
1Finite Automata andNon Determinism
- http//cis.k.hosei.ac.jp/yukita/
2Definition 1.1 Finite Automaton
3State Diagram for M1
1
0
q3
0
q1
q2
1
0, 1
4Data Representation for M1
5Task 01DFA
- Implement M1 with your favorite programming
language. - GUI
- Two buttons for input 0 and 1
- State chart with the current state highlighted
6Language of M1
7State Diagram for M5
0
q1
1
2, ltRESETgt
0, ltRESETgt
0
1
2
q2
q0
2
1, ltRESETgt
8Data Representation for M5
9Informal Description of M5
- M5 keeps a running count of the sum of the
numerical symbols it reads, modulo 3. - Every time it receives the ltRESETgt symbol it
resets the count to 0. - M5 accepts if the sum is 0, modulo 3.
10Definition 1.7 Regular Language
- A language is called a regular language if some
finite automaton recognizes it.
11Example 1.9 A finite automaton E2
- E2 recognizes the regular language of all strings
that contain the string 001 as a substring. - 0010, 1001, 001, and 1111110011110 are all
accepted, - but 11 and 0000 are not.
12Find a set of states of E2
- You
- havent just seen any symbols of the pattern,
- have just seen a 0,
- have just seen 00 or,
- have just seen the entire pattern 001.
- Assign the states q,q0,q00, and q001 to these
possibilities.
13 Draw a State Diagram for E2
0, 1
0
1
q00
q001
q0
0
q
1
0
1
14Regular Operations on Languages
15Example 1.11
16Theorem 1.12 Closedness for Union
17Proof of Theorem 1.12
18Construction of M
19Correctness
- You should check the following.
- For any string recognized by M1 is recognized by
M. - For any string recognized by M2 is recognized by
M. - For any string recognized by M is recognized by
M1 or M2.
20Theorem 1.13 Closedness for concatenation
21Nondeterminism
- To prove Theorem 1.13, we need nondeterminism.
- Nondeterminism is a generalization of
determinism. So, every deterministic automaton is
automatically a nondeterministic automaton.
22Nondetermistic Finite Automata
- A nondeterministic finite automaton can be
different from a deterministic one in that - for any input symbol, nondeterministic one can
transit to more than one states. - epsilon transition
- NFA and DFA stand for nondeterministic finite
automaton and deterministic finite automaton,
respectively.
23NFA N1
0,1
0,1
q3
q4
1
q1
q2
1
0,e
24Parallel world and NFA
...
...
accept
25Example 1.14 NFA N2
0,1
q3
q4
q1
q2
0,1
1
0,1
Let language A consist of all strings over 0,1
containing a 1 in the third position from the
end. N2 recognizes A.
26A DFA equivalent to N2
0
0
q010
q110
q000
q100
0
0
1
0
1
0
1
0
0
1
1
q011
q111
q001
q101
1
1
1
27Example 1.15 NFA N3
0
0
e
0
e
0
0
Let language A consist of all strings 0k , where
k is a multiple of 2 or 3. N3 recognizes A.
28A DFA equivalent to N3
0, 1
q-1
1
1
1
1
1
1
q5
q4
q2
q1
q3
q0
0
0
0
0
0
0
29Example 1.16 NFA N4
q1
a
b
e
a
q3
q2
a,b
N4 accepts e, a, baba, and baa. N4 does not
accept b, nor babba.
30Definition 1.17 NFA
31Example 1.18 NFA N1
32In what situation is Non Determinism relevant?
- Von Neumann machines are deterministic.
- However, there are many cases where machine
specification is all we need.
33Theorem 1.19
- Every nondeterministic finite automaton has an
equivalent deterministic finite automaton. - Def. The two machines are equivalent is they
recognize the same language.
34Proof of Th. 1.19
35Incorporate e arrows
36Corollary 1.20
- A language is regular if and only if some
nondeterministic finite automaton recognizes it.
37Example 1.21 NFA N4 to DFA
1
b
a
e
a
3
2
a,b
38Task 02Parallel World
- Write a program that simulates N4.
- GUI
- Three buttons for input 0, 1, and epsion.
- State chart that reflect the branching of the
world.
39Start and Accept states
40The state diagram of D
2
1,2
a,b
a
b
f
1
a,b
b
a
b
b
a
a
2,3
1,2,3
3
a
1,3
a
b
b
41Theorem 1.22 The class of regular languages is
closed under the union operation.
N
N1
e
e
N2
42Proof of Th. 1.22
43Theorem 1.23 The class of regular languages is
closed under the concatenation operation.
N
e
e
44Proof of Th. 1.23
45Theorem 1.24 The class of regular languages is
closed under the star operation.
N
e
e
e
46Proof of Th. 1.24