Top Banner
thasit Surarerks 2110711 THEORY OF COMPUTATION 07 NON-DETERMINISTIC FINITE AUTOMATA 1
18

2110711 THEORY OF COMPUTATION

Jan 01, 2016

Download

Documents

Branden Shaw

2110711 THEORY OF COMPUTATION. 07 NON-DETERMINISTIC FINITE AUTOMATA. IMPORTANT. We introduce a conceptual machine that occurs in practice more frequently than the transition graph. TRANSITION GRAPH. Definition A transition graph (abbreviated TG) is a 5-tuple (Q,  , q 0 ,  , A) where - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 2110711 THEORY OF COMPUTATION

Athasit Surarerks

2110711THEORY OF COMPUTATION07 NON-DETERMINISTIC FINITE AUTOMATA

1

Page 2: 2110711 THEORY OF COMPUTATION

IMPORTANT2

We introduce a conceptual machine that occurs in practice more frequently than

the transition graph.

Page 3: 2110711 THEORY OF COMPUTATION

TRANSITION GRAPH3

DefinitionA transition graph (abbreviated TG) is a 5-tuple (Q, , q0, , A) where• Q means a finite set of states. is a finite input alphabet.• q0 Q named Initial state.• A Q , A is the set of all accepted states. is a function from Q* to P(Q), called

transition function.

Page 4: 2110711 THEORY OF COMPUTATION

TRANSITION GRAPH4

q2

1

q3

1

q0q101

01 001010

1

Page 5: 2110711 THEORY OF COMPUTATION

EXAMPLE5

(0+1)*00(0+1)*

q0 q10 q2

00,1

0,1

Page 6: 2110711 THEORY OF COMPUTATION

EXAMPLE6

(010+101)*0(0+1)*

q00 q1

1 0,1

q2

q30

1

q4 q5

00

1

Page 7: 2110711 THEORY OF COMPUTATION

NON-DETERMINISTIC MACHINE

7

A nondeterministic finite state machine (NFA) is a transition graph with a unique start state and each of its edge labels is a single alphabet.

Page 8: 2110711 THEORY OF COMPUTATION

NON-DETERMINISTIC MACHINE

8

DefinitionA nondeterministic finite automaton (abbreviated NFA) is a 5-tuple (Q,,q0,A,). where• Q means a finite set of states.• is a finite input alphabet.• q0 is in Q named Initial state.• A is a subset of Q, A is the set of all

accepted states.• is a function from Q to P(Q)where P(Q) is the power set of Q.

Page 9: 2110711 THEORY OF COMPUTATION

NON-DETERMINISTIC MACHINE

9

A B0

C0,1

0,1

D0,1

*(A,00)*(A,00) = (r,0) : r *(A,0)

: r { A , B }= { A , B } { C } = { A , B , C }

How to define the transition function?

Page 10: 2110711 THEORY OF COMPUTATION

NON-DETERMINISTIC MACHINE

1

0

A B0

C0,1

0,1

D0,1

*(A,010) *(A,010) = (r,0) : r *(A,01)

*(A,01) = (s,1) : s *(A,0)

: s { A , B }

= (A,1) (B,1)= { A } { C } : r

{ A , C }*(A,010) = (A,0) (C,0)

= { A , B } { D }= { A , B , D }

Page 11: 2110711 THEORY OF COMPUTATION

NON-DETERMINISTIC MACHINE

1

1

For a NFA, M = (Q, , q0, , A) and any pQ, *(p,) = {p}.

For any pQ and x = a1a2a3…an * (with n 1)*(p, x) is the set of all states q for which

there is a sequence of states p=p0, p1p2…pn-1, pn = q satisfying :

pi(pi-1,ai) for each i with 1 i n.

String x in * is accepted by a NFA if *(q0,x) A .

*(p,) = {p}*(p,yan) = all r*(p,y) (r,an)

Page 12: 2110711 THEORY OF COMPUTATION

NON-DETERMINISTIC MACHINE

1

2

DefinitionA nondeterministic finite automaton with -transition (NFA-) is a 5-tuple (Q, , q0, , A) where

• Q means a finite set of states. is a finite input alphabet.• q0 Q named Initial state.

• A Q , A is the set of all accepted states. is a function from Q({}) to P(Q)

where P(Q) is the power set of Q.

Page 13: 2110711 THEORY OF COMPUTATION

NON-DETERMINISTIC MACHINE

1

3

For an NFA-, M=(Q, , q0, , A) states p and q Q and a stringx = a1a2a3…an *, we will say M moves from p to q by a sequence of transitions corresponding to x if

there exist an integer m n, a sequence b1b2b3…bm {}satisfying x = b1b2b3…bm and a sequence of states

p = p0, p1, p2, …, pm = qso that for each i, 1 i m, pi (pi-1,bi).

For x * and p Q, *(p,x) is the set of all states q Q such that there is a sequence of transitions corresponding to x by which M moves from p to q.

Page 14: 2110711 THEORY OF COMPUTATION

-CLOSURE1

4

DefinitionLet M=(Q, , q0, , A) be a NFA-.

Let S be any subset of Q.The -closure of S is the set (S) defined as follows:• Every element of S is an element of (S).• For any q (S), every element of (q,) is in

(S).• No other elements of Q are in (S).

Page 15: 2110711 THEORY OF COMPUTATION

-CLOSURE1

5

For a NFA- M = (Q, , q0, , A).The extended transition function *: Q * P(Q) is defined as follows:For any q Q, *(q,) = ({q})For any q Q, y * and a ,

*(q,ya) = ( r*(q,y) (r,a) )

A string x is accepted by M if *(q0,x) A .The language recognized by M is the set L(M) of all strings accepted by M.

Page 16: 2110711 THEORY OF COMPUTATION

NON-DETERMINISTIC MACHINE

1

6

TheoremFor every nondeterministic finite state machine, there is a finite state machine accepts exactly the same language.

PROOF

Page 17: 2110711 THEORY OF COMPUTATION

NON-DETERMINISTIC MACHINE

1

7

TheoremFor every nondeterministic finite state machine with -transition, there is a finite state machine accepts exactly the same language.

PROOF

Page 18: 2110711 THEORY OF COMPUTATION

EXERCISE1

8

จงยกตั�วอยาง ภาษาที่��บรรยายด้�วย การบรรยายแบบสม่ำ��าเสม่ำอ ที่��ม่ำ� non-deterministic automaton with -transition ที่�� accept ที่�กสม่ำาชิ�กในภาษาได้� แตัไม่ำสาม่ำารถถ!กยอม่ำร�บได้�ด้�วย non-deterministic finite automaton ที่��ม่ำ� accepted state เพี�ยงสถานะเด้�ยว