Download presentation

Presentation is loading. Please wait.

1
**Lecture 5 Examples of DFA**

2
**Construct DFA to accept (0+1)***

1

3
**Construct DFA to accept 00(0+1)***

1 1 1 1

4
**(0+1)*00(0+1)* Idea: Suppose the string x1x2 ···xn is on**

the tape. Then we check x1x2, x2x3, ..., xn-1xn in turn. Step 1. Build a checker

5
**Step 2. Find all edges by the following consideration:**

Consider x1x2. If x1=1, then we give up x1x2 and continue to check x2x3. So, we have δ(q0, 1) = q0. If x1x2 = 01, then we also give up x1x2 and continue to check x2x3. So, δ(q1, 1) = δ(q0, 1) =q0. If x1x2 = 00, then x1x2··· xn is accepted for any x3···xn. So, δ(q2,0)=δ(q2,1)=q2.

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

7
(0+1)*00 1 1 1

8
**In general, suppose x1 x2 … xn is the string on the tape**

And we want check x1 …xk, x2 …xk+1, …, in turn. If x1…xk Is not the substring that we want and we need to check x2…xk+1, then we set that for and i < k, δ( δ(s, x1 …xi), xi+1) = δ(s, x1…xi xi+1).

9
(0+1)*(00+01) 1 1 1 1

10
**2nd Solution-Parallel Machine**

L(M) = (0+1)*00 M=(Q, Σ, δ, s, F) L(M’)= (0+1)*01 M’=(Q’, Σ, δ’, s’, F’) L(M’’) = (0+1)(00+01) = L(M) U L(M’) Q’’ = {(q, q’) | q in Q, q’ in Q’} δ’’((q, q’), a) = (δ(q, a), δ’(q’, a)) s’’ = (s, s’) F’’ = { (q, q’) | q in F or q’ in F’ }.

11
1 1 1 c a c b a b 1 1 1 1 a b c a b b 1 1 a 1 c

12
**Union, Intersection, subtraction**

Union: F’’ = {(q,q’) | q in F or q’ in F’} Intersection: F’’= {(q,q’) | q in F and q’ in F’} Subtraction: L(M) \ L(M’) F’’ = {(q,q’) | q in F and q’ not in F’}

13
**(0+1)*00 ∩ (0+1)*01 1 1 1 c a c b a b 1 1 1 1 a b c a b b 1 1 a 1 c c**

1 1 c a c b a b 1 1 1 1 a b c a b b 1 1 (0+1)*00 ∩ (0+1)*01 a 1 c c c

14
1 1 1 c a c b a b 1 1 1 1 a b c a b b 1 1 (0+1)*00 \ (0+1)*01 a 1 c

15
Complement L(M’)= Σ*-L(M) F’ = Q - F 1 1 (0+1)*00

16
The set of all binary strings beginning with 1 which interpreted as a binary representation of an integer, is congruent to zero modulo 5. Idea: To construct a DFA, we need to figure out what should be states and where each edge should go. Usually, states can be found through studying the condition for accepting. The condition for accepting a string x1x2···xn is x1x2···xn ≡ 0 mod(5). So, we first choose residues 0, 1, 2, 3, 4 as states.

17
2i + 0 ≡ ? (mod 5) 2i + 1 ≡ ? (mod 5) 1 1 2 1 1 1 1 1 3 4 0,1

Similar presentations

OK

Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.

Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google

Ppt on animation Ppt on area of trapezium ppt Convert pdf ppt to ppt online form Ppt on political parties and electoral process in the united Ppt on data integrity proofs in cloud storage Ppt on index of industrial production india Ppt on paper display technology Ppt on frame of reference Ppt on various types of web browser and their comparative features Ppt on online shopping mall