0% found this document useful (0 votes)
102 views

Assignment 1

This document outlines 9 problems regarding theory of computation concepts like DFAs, NFAs, regular expressions, closure properties, pumping lemma, and decision problems. The problems involve constructing automata and regular expressions to recognize specific languages, proving properties of regular expressions, showing languages are/aren't regular, and using the pumping lemma to show languages aren't regular.

Uploaded by

goku
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views

Assignment 1

This document outlines 9 problems regarding theory of computation concepts like DFAs, NFAs, regular expressions, closure properties, pumping lemma, and decision problems. The problems involve constructing automata and regular expressions to recognize specific languages, proving properties of regular expressions, showing languages are/aren't regular, and using the pumping lemma to show languages aren't regular.

Uploaded by

goku
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Theory of Computation

Problem set #1
(DFA, NFA, RE, closure, decision problems, minimization, pumping theorem)

15-2-2019
The alphabet is Σ = {0, 1} unless otherwise stated. For specifying a DFA or NFA give the complete 5-tuple. The
transition function can be a diagram or a table.

1. (a) Construct a DFA to recognize the following language: L={w|w ∈ Σ∗ , and the number of 0s in w is
divisible by 3 and the number of 1s is divisible by 5}.
(b) Construct an NFA to recognize the language

L = {w|w ∈ Σ? , the number of consecutive 1s in w is 0 or a multiple of 4}

. Also, prove that the NFA you have constructed does indeed recognize the language L.
(c) Construct a DFA/NFA to recognize the language L = {w|w ∈ Σ? , reversed w is divisible by 5}
(d) Construct a DFA/NFA to recognize the language L = {w|w ∈ Σ? , w does not contain the string 101}
[5,5,5,5=20]

2. Let us change the definition of acceptance for an NFA (let us call them NFA∗ ) as follows: an NFA∗ accepts
string w iff δ̂N (q0 , w) ⊂ FN , q0 is the start state, FN is the set of final states. That is when w is completely
read then every state that can be reached starting from q0 is a final state. Note that our earlier definition
required that at least one such state be a final state. Show that NFA∗ recognizes the same languages that
NFAs do, that is it has the same power as NFAs.
[15]

3. Write regular expressions (r.e. henceforth) for the following languages, where Σ = {0, 1}:
(a) L={w—w∈ Σ∗ ,w does not contain 101 as a substring}
(b) L={w—w∈ Σ∗ ,w number of 0s in w is divisible by 5}
(c) L={w—w∈ Σ∗ ,w number of 0s is divisible by 5 and the number of 1s is even}
[3×5=30]

4. Write an r.e to describe addresses in SNU. These addresses should work for houses and for hostels. You can
use a more expressive way to specify regular expressions:
Below anything in < > is to be treated as a variable, anything within curly bracket { } is optional and a
vertical bar (|) denotes alternatives. Note that the different lines of an address should occur in physically
separate lines. Anything within quotation marks " " is to be interpreted literally. The structure of an address
is shown below:

<number> {<street>|<road>|<hostel>}
"SNU Campus," {"NH-91, Dadri"},
"Gautam Budh Nagar"
"UP 201314"
The variable <number> when referring to house numbers can be 2 digits or 3 digits, when referring to room
numbers in halls it can have an optional initial alphabetic character. At least one space should occur between
the various parts of an address on the same line. Where necessary make suitable assumptions and state them
clearly in your answer.
[15]
5. (a) Construct a finite automaton for the language specified by the r.e.:
0∗ (01 + 10 + )1∗
(b) The following is a transition table for a DFA. The start state is A and the final states are {C, F, I}.
A B C D E F G H I
0 B C D E F G H I A
1 E F H H I B B C E
Construct the minimal DFA for the above DFA.
(c) Construct a regular expression for the minimal DFA in part (a).
[10,10=20]
6. For regular expressions r, s prove or disprove the rules below:
(a) (r? )? = r?
(b) (r + s)? = (r? + s? )
(c) (rs + r)? r = r(sr + r)?
[3×5=15]
7. (a) We define the avoids operation for languages L1 and L2 to be
L1 avoids L2 = {w|w ∈ L1 and w does not contain any string in L2 as a substring}.
Prove that the class of regular languages is closed under the avoids operation.
(b) Find an algorithm to decide whether a regular language contains at least 100 strings. Assume the language
is given as a DFA.
(c) Find an algorithm to check if a regular language is equal to Σ? .
[3×5=15]
8. Show that the following languages are not regular. You can use the Pumping theorem and closure properties.
2
(a) {w|w = 1n , n0}
n
(b) {w|w = 12 , n0}
(c) Show more generally that if f : N → N is such that (f (n + 1)f (n)) > n, then {w|w = 1f (n) , n ≥ 0} is
not regular.
(d) {w|w = xxR , x0, 1? xR is the reverse of x}
(e) {w|w = 0n 1m 0n , m, n ≥ 0}, use closure properties.
[5,5,5,5,5=25]
9. Use the Pumping theorem to construct adversary arguments to show that if the language is regular then the
adversary wins. Do this for the following two languages:
(a) L = {00, 11}
(b) L = 01? 0? 1
[5,5=10]

Page 2

You might also like