Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
1
Outline
- Nondeterminism
- Regular expressions
- Elementary reductions
Outline Nondeterminism Regular expressions Elementary - - PowerPoint PPT Presentation
Outline Nondeterminism Regular expressions Elementary reductions Computation, Computers, and Programs Nondetermistic Finite Automata 1 http://www.cs.caltech.edu/~cs20/a October 8, 2002 Determistic Finite Automata A finite
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
1
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
2
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
3
1 1 1 1 q0 q1 q2 q3
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
4
1 1 1 1
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
5
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
6
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
7
– delta : state * symbol -> state – For each state, and each symbol, there is a unique next state
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
8
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
9
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
10
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
11
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
12
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
13
1 1 1 1
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
14
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
15
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
16
– Is there a language L=L(M) for some NFA M, where L<>L(M’) for some DFA M’?
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
17
– I: For each DFA, produce an NFA that accepts the same language – II: For each NFA, produce a DFA that accepts the same language
– We’ll do part II; part I is immediate
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
18
i=1 δ(qi, c)
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
19
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
20
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
21
δ(s, xa) = by definition of δ δ(δ(s, x), a) = by definition of δ
= by induction
= by definition of δ′
= by definition of δ′
= by definition of δ′ δ′(δ′({s}, x), a) = by definition of δ′ δ′({s}, xa)
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
22
– Allow transitions that require no input – Label them epsilon (no input) – The automaton may choose to take an epsilon transition without any input
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
23
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
24
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
25
– If the e-NFA could be in states {q1, q2, … qn}, add the states that could be reached by e-transitions from any state qi – This is called the e-closure
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
26
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
27
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
28
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
29
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
30
δ(s,w) δ′(q, a)
δ(s,w)
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
31
– Proved NFA->DFA – Proved e-NFA->NFA
– Prove regex->e-NFA – Prove DFA->regex
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
32
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
33
– Show the empty RE has an e-NFA – Show the RE has an e-NFA – Show the a (symbol) RE has an e-NFA
– Show (xy) has an e-NFA – Show (x + y) has an e-NFA – Show x* has an e-NFA
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
34
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
35
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
36
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
37
Computation, Computers, and Programs Nondetermistic Finite Automata http://www.cs.caltech.edu/~cs20/a October 8, 2002
38