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

HW 2

This document outlines an assignment on finite automata and regular languages. It includes 7 problems related to drawing and analyzing deterministic finite automata (DFAs) with various languages and behaviors over different alphabets. Definitions of key terms are provided. The problems cover topics like constructing DFAs for specific languages, analyzing the behavior of sample DFAs on input strings, using the product construction to combine DFAs, and modeling a marble rolling toy with a finite automaton.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

HW 2

This document outlines an assignment on finite automata and regular languages. It includes 7 problems related to drawing and analyzing deterministic finite automata (DFAs) with various languages and behaviors over different alphabets. Definitions of key terms are provided. The problems cover topics like constructing DFAs for specific languages, analyzing the behavior of sample DFAs on input strings, using the product construction to combine DFAs, and modeling a marble rolling toy with a finite automaton.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CSCE 355, Fall 2022, Assignment 2

Due September 1, 2022

NOTE the following definitions:

• The binary alphabet is the set {0, 1}.

• A binary string is any string over the binary alphabet.

• If w is any string, then wR (the reversal of w) is w written backwards, that is, comprising
the symbols of w in reverse order.

• A string x is a prefix of a string y iff there exists a string z such that y = xz.

• A string x is a suffix of a string y iff there exists a string z such that y = zx.

• A string x is a substring of a string y if there exist strings w, z such that y = wxz.

1. Consider the following DFA:

a
0 1

b
b a a

b
2 3
b

(a) For each of the strings below, say which state the DFA is in after reading the string, and
say whether or not the DFA accepts the string.

aaa bb bbb abab bbbbbbbbbbbbbbbaaa ε aabbbbababbaaabbaabbababbbb

(b) Give two different strings of length 4 that each make the DFA go from state 0 to state 1.

2. Draw a DFA with alphabet {0, 1} that accepts a binary string x iff x has odd length, i.e., iff
|x| is odd.

1
3. Let A be the DFA given by the following tabular form:

0 1
→ ∗q0 q0 q1
q1 q2 q0
q2 q1 q2

(A accepts a binary string iff it represents a multiple of 3.) Recall the DFA described in class
(here we’ll call it B) that accepts a binary string iff the string ends with 1:

A B
1

0 1

Recall the product construction from class. Draw the diagram for the product of A and B so
the resulting DFA recognizes the language L(A) ∩ L(B).

4. Describe a DFA B that accepts a string over the alphabet {a, b, c} iff its first and last symbols
are different.

5. Consider the following two languages over the alphabet {a, b}:

L1 = {w | w is either the empty string or ends with b} ,


L2 = {w | there is a b followed by an a somewhere in w} .

(a) Draw a 2-state DFA recognizing L1 and a 3-state DFA recognizing L2 .


(b) Using your answer and the product construction, draw a DFA recognizing L1 ∩ L2 .
Do not perform any optimizations (e.g., removing unreachable states or transitions, or
merging indistinguishable states).

6. Give the transition diagram for a DFA over the alphabet Σ = {a, b, c} that accepts a string
w iff w contains ab as a substring but does not contain abb as a substring. What is the least
number of states you need?

7. (Optional) This exercise is adapted from Exercise 2.2.1 on pages 52–53, which is formulated
somewhat vaguely. Consider the marble-rolling toy (redrawn from Figure 2.8):

2
A B

x1 x2

x3

C D

A marble is dropped at A or B. Levers x1 , x2 , and x3 cause the marble to fall either to the
left or to the right. whenever a marble encounters a lever, it causes the lever to reverse after
the marble passes, so the next marble will take the opposite branch.
Model this toy as a finite automaton. An input to the atomaton is a string over the alphabet
{A, B}, which represents a sequence of marbles being dropped into the toy. The toy is initially
in the configuration above before any marbles are dropped (so that the first ball will exit at
C regardless of where it is dropped). Say that a sequence of marble drops is accepted exactly
in the case that if one additional marble were to be dropped in, it would go out through D
regardless of where it was dropped.

You might also like