hw5 - deterministic machine should be the sets of states of...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSC236H: Introduction to the Theory of Computation Homework 5 Due on Tuesday April 6, 2010 (in review session, see announcements) 1. Give a context-free grammar for each of the following languages. (a) L 1 = { 0 n 1 m 0 m 1 n | n,m 0 } . (b) L 2 = { a n b m c k | n,m,k 0 and n = m + k } . (c) L 3 = { a n b m c k | n,m,k 0 and n = 2 m + 3 k } . (d) L 4 = { a n b m | 0 n m 2 n } . 2. In a string w ∈ { 0 , 1 } * , define a block to be a maximal length consecutive sequence of 0s or 1s. For example, in the string 0111000011001 there are six blocks, three blocks of 0s of lengths 1, 4, and 2, and three blocks of 1s of lengths 3, 2, and 1. Let L be the language consisting of all strings that have (somewhere) two blocks of zeros of the same length. So, for example, 011001110 L but 000110011 6∈ L . (a) Prove that L is not regular. (b) Show that L is context-free by giving a grammar for L . (c) Prove that your grammar of part (b) is correct. 3. Consider the NFA defined by the transition table below, with p the initial state and r the only accepting state. state input 0 input 1 p { p,s } { q } q { r,s } { q } r { r } { s } s {} { q } Construct a DFA that accepts the same language using the technique discussed in class. The states of your
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: deterministic machine should be the sets of states of the nondeterministic machine. 4. Give NFAs with the specied number of states recognizing each of the following languages. (a) The language { w | w ends with 00 } with three states. (b) The language { w | w contains the substring 0101, i.e., w = x 0101 y for some x and y } with ve states. (c) The language { w | w contains an even number of 0s, or exactly two 1s } with six states. (d) The language 0 * 1 * * 0 with three states. 5. Give regular expressions for: (a) All binary strings with exactly two 1s. (b) All binary strings with a double symbol (contains 00 or 11) somewhere. (c) All binary strings that contain both 00 and 11 as substrings. (d) All binary strings without a double symbol anywhere. 1...
View Full Document

This note was uploaded on 04/11/2010 for the course CSC CSC236 taught by Professor Farzanazadeh during the Spring '10 term at University of Toronto- Toronto.

Ask a homework question - tutors are online