This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CPS 102: Discrete Mathematics Instructor: Bruce Maggs Assignment 1 Due: Monday, September 19th, 2011 1 Designing DFAs (35 points) Let Σ = { , 1 } . For each of the following languages, give the state diagram for a DFA that recog nizes it. (a) (4 pts) L 1 = { w : w contains the substring 010 } (b) (4 pts) L 2 = { w : w begins and ends with an even number of 1’s } (c) (5 pts) L 3 is the language that consists of all strings such that between every two 1’s, there is an even number of 0’s. (d) (5 pts) L 4 is the language that consists of all strings w such that w ends in an odd number of 1’s and w contains an even number of 0’s. (e) (5 pts) L = { w  w contains an even number of 1s or exactly one 0 } . Examples in L : 11, 10, 101, 00, ε . Examples not in L : 111, 100, 1. (f) (5 pts) Σ * Σ * 1 Σ * Σ * Examples in L : 010, 000110, 11011001. Examples not in L : 111, 011, 00011. (g) (7 pts) L = { w  w is a binary number divisible by 2, given least significant digit first } . Ex amples in L : 0, 01, 001, 010, 01011. Examples not in L : 1, 111, 101. 1 2 DFAs can verify addition (15 points) DFA’s “can’t count,” but they can verify addition. Consider an alphabet with rather interesting symbols: Σ = , 1 , 1 , 1 1 , 1 , 1 1 , 1 1 , 1 1 1 which represent columns which could appear when writing the addition and result of two binary numbers. An input of length n represents the addition of two nbit numbers where the input is given from least to most significant bit. The first number’s binary representation is in the top row, the second number’s representation is in the middle row, and the result is in the bottom row. Let L be the language of strings over this alphabet which represent correct addition statements as described above. As an example, correctly representing 4 + 2 = 6 in this scheme would give the following string (first input symbol on the left) 1 1 1 1 The following input would represent 4 + 5 = 8, and thus this string should not be in L : 1 1 1 1 Write a DFA which accepts L . Keep your DFA small; machines with more than 5 states will....
View
Full
Document
This document was uploaded on 01/17/2012.
 Fall '09

Click to edit the document details