## Computer Science 423/523 Finite Automata Fall 2012

Weizhen Mao
Department of Computer Science
College of William and Mary

General Information | Schedules | Announcements | Lectures | Assignments | Exams

## Assignments

#### Some LaTeX commands:

To produce the binary relation for ID's of a PDA, use $\vdash$.

To produce the derivation notation in LaTeX, use

\newcommand{\derive}{\Longrightarrow} %e.g., $S\derive 0S1$
\newcommand{\deriveU}[1]{\stackrel{#1}{\Rightarrow}}k %e.g., $S\deriveU{*}w$
\renewcommand{\labelitemi}{\Pisymbol{psy}{183}} \newcommand{\deriveL}[1]{{\renewcommand{\arraystretch}{0.4} \begin{array}{c} {~}\\{\Rightarrow}\\{\scriptstyle {#1}}\end{array}}} %e.g., $S\deriveL{G}0S1$
\newcommand{\deriveUL}[2]{{\renewcommand{\arraystretch}{0.4} \begin{array}{c} {\scriptstyle {#1}}\\{\Rightarrow}\\{\scriptstyle {#2}}\end{array}}} %e.g., $S\deriveUL{*}{G}w$

#### Homework 11 (Out 11/28 and due 12/05):

• (10 points) Problem 5.17 on page 212. (Hint: Give a simple algorithm)
• (10 points) This problem considers an attempt at a polynomial reduction from one problem to another that does not work. Your task is to find the flaw. A bipartite graph is an undirected graph in which every cycle has even length. We attempt to show that the Hamiltonian cycle (a cycle that passes through each node exactly once) problem polynomially reduces to the Hamiltonian cycle problem in bipartite graphs. We need a function $T$: \{graphs\}$\rightarrow$\{bipartite graphs\} such that T can be computed in polynomial time and for any graph $G$, $G$ has Hamiltonian cycle iff $T(G)$ has a Hamiltonian cycle. Let $T(G)$ be the bipartite graph obtained by inserting a new vertex on every edge. What is wrong with this transformation?
• (10 points) The SET INTERSECTION (SI) problem is defined as follows:
INSTANCE: Finite sets $A_1,\ldots,A_m$ and $B_1,\ldots,B_n$.
QUESTION: Is there a set $T$ such that $|T\cap A_i|\ge 1$ for $i=1,\ldots,m$ and $|T\cap B_j|\le 1$ for $j=1,\ldots,n$?
Show that SAT polynomially reduces to SI.
• A bonus of 10 points!
• Write a summary for the review article that appeared on Communications of ACM in 2009: "The Status of the P Versus NP Problem"

#### Homework 10 (Out 11/14 and due 11/28):

• (10 points) Prove that $A=\{w_{2i}|w_{2i}\not\in L(M_i)\}$ is not Turing-recognizable, where $w_{2i}$ is the $2i$th string in the lexicographic order of binary strings and $M_i$ is the TM whose binary code is $w_i$.
• (10 points) Exercise 5.1 on page 211. (Hint: Reduction from $ALL_{CFG}$ on page 197.)
• (10 points) Problem 5.12 on page 211. (Hint: Reduction from $A_{TM}$.)
• (10 points) Prove that $ES_{TM}=\{code of M: TM M accepts the empty string\}$ is undecidable. (Hint: Reduction from $A_{TM}$.)

#### Homework 9 (Out 11/07 and due 11/14):

• (7 points) Exercise 4.3 on page 183.
• (7 points) Exercise 4.6 on page 183.
• (7 points) Exercise 4.7 on page 183.
• (7 points) Problem 4.19 on page 184.
• (12 points) In class, we learned that $A_D$ is non-TR, $A_{TM}$ and $HALT_{TM}$ are TR but non-TD. What can you say about their complements? Are they non-TR, TR but non-TD, or TD? Justify your answers.
• Write a summary for the review article recently published on ACM Communications: "Turing's Titanic Machine?".

#### Homework 8 (Out 10/31 and due 11/07):

• (10 points) Exercise 3.1 (d) on page 159.
• (10 points) Exercise 3.8 (b) on page 160.
• (10 points) Problem 3.15 (b), (c) and (e) on page 161.
• (10 points) Problem 3.16 (b), (c) and (d) on page 161.

#### Homework 7 (Out 10/24 and due 10/31):

• (20 points) Problem 2.30 (a) and (d) on page 131.
• (10 points) Problem 2.32 on page 131. (Hint: The following selection of s won't work: s=1^p2^p3^p4^p. Try other block orders.)
• (10 points) Problem 2.42 on page 131. (Hint: s=1^{p+1}#1^{p+2}#...#1^{3p}.)

#### Homework 6 (Out 10/17 and due 10/24):

• (10 points) Exercise 2.11 on page 129.
• (6 point) Problem 2.19 on page 130.
• (6 points) Problem 2.21 on page 130. (No proof of correctness required)
• (8 points) Problem 2.26 on page 130.
• (10 points) Problem 2.24 on page 130.
• Read the handout "Applications of Context-Free Grammars" and then write a one-page summary of what you have learned.

#### Homework 5 (Out 10/10 and due 10/17):

• (10 points) Exercise 2.6 (b) and (d) on page 129.
• (5 points) Exercise 2.9 on page 129.
• (10 points) Exercise 2.13 on page 129.
• (5 points) Exercise 2.14 on page 129.
• (10 points) Exercise 2.10 on page 129. (Give the state diagram of your PDA.)

#### Homework 4 (Out 09/26 and due 10/10):

• (8 points) Prove that the language A of strings of 0s and 1s whose length is a perfect square is not regular.
• (8 points) Problem 1.46 (c) on page 90.
• (16 points) Problem 1.49 (a) and (b) on page 90.
• (8 points) Problem 1.54 (a) on page 91.
• Read the handout "Applications of Regular Expressions" and then write a one-page summary of what you have learned.

#### Homework 3 (Out 09/19 and due 09/26):

• (8 points) Exercise 1.12 on page 85.
• (4 points each) Exercise 1.18 (e) (f) (j) on page 86.
• (10 points) Exercise 1.21(b) on page 86. (Remove the states in the order of 1, 2, and 3.)
• (5 points) Problem 1.37 on page 89.
• (5 points) Problem 1.48 on page 90.

#### Homework 2 (Out 09/12 and due 09/19):

• (5 points) Give the state diagram of an NFA that recognizes the set of strings such that there are at lease two 0s separated by a number of positions that is a multiple of 4. Note that 0 (as a number) is a multiple of 4.
• (10 points) Exercise 1.7 (c) on page 84 and then convert the NFA to an equivalent DFA.
• (10 points) Exercise 1.16 (b) on page 86 and then describe in a concise sentence the language recognized by the FA.
• (10 points) Problem 1.32 on page 88.
• (5 points) For language L, let min(L)={w|w is in L but no proper prefix of w is in L}$. Prove that if L is a regular language, so is min(L). • Read the handout "An Application: Text Search" and then write a one-page summary of what you have learned. (No points for the summary but failure to submit will affect your portfolio grades.) #### Homework 1 (Out 09/05 and due 09/12): • (5 points) Prove by induction that for all intergers$n \ge 4$the inequality$2^n < n!$holds. • (5 points) Prove by contradiction that$2 - \sqrt{2}\$ is not a rational number.
• (5 points) Problem 0.11 on page 27 in Sipser.
• (5 points each) Exercise 1.6 (a), (e), (i) and (n) on page 84 in Sipser.
• (5 points) Give the state diagram of a DFA that recognizes the set of strings such that in each string the number of 0s is divisible by 5 and the number of 1s is divisible by 3.
To help you get a quick start in LaTeX, here is a LaTeX file hw1.tex you may use for HW 1. I already typed in the problem statements, so you only need to fill in the solutions. When you turn in this homework, make sure you attach the LaTeX source file with the LaTeX printout.

#### Things to know/do:

• Before you start, get an account on the CS departmental computer system, create a directory called cs423 for undergraduate students and cs523 for graduate students with the command of "mkdir directory-name", and protect the directory with the command of "chmod 700 directory-name". From now on, all files related to the course should be stored in the directory created.
• All homework write-ups, which must contain for each problem, the complete problem description as well as its solution, are required to be produced by LaTeX, the standard high-quality typesetting program in our field. Since I do not have time to teach you LaTeX in class, you must learn LaTeX by yourself. To make things a little easier for you, I have written a brief introduction, called LaTeX summary, that contains a minimum set of things you need to know to produce a homework write-up in LaTeX.
• Remember each homework assignment is due at 1:00 (at the beginning of the lecture) on its due date. You should hand in one hard copy printed single-sided and stapled in the upper left corner. No late homework will be accepted unless for medical conditions (with doctor's note) or family emergencies.
• Always give yourself plenty of time to work on a problem set. Never expect to be able to start and complete a problem set the night before it is due.
• Although you are allowed to discuss homework problems with your classmates, you must strickly follow the "empty hand policy": You cannot leave a discussion meeting with any record of the discussion, which must be erased or torn. This is because the actual writing of the detailed homework answers must be an individual activity. In your homework write-ups, you should also give credit to your collaborators for each problem.
• Since another goal of doing homework is to improve your technical writing skills, it is important that you write in a comprehensive and yet concise style. Points may be taken off for poorly written solutions.