CSC 341  Grinnell College  Spring, 2014 
Automata, Formal Languages, and Computational Complexity  
Quick Links: February March April May 
The accompanying table indicates assignments and due dates for Computer Science 341 and are subject to the following notes.
Unless otherwise indicated, textbook references are to Michael Sipser, Introduction to the Theory of Computation, Second Edition, Thomson/Course Technology, 2006, ISBN: 13: 9760534950972 and 10: 0534950973.
Supplemental problems are stated later on this page.
Unless otherwise stated, collaboration IS allowed on problems from the text, but collaboration IS NOT allowed on assignments from the supplemental problems.
Due Date  Collaboration  Chapter  Problems  Notes  

Mon., Jan. 27  0.4, 0.7, 0.9, 0.11  The formal definition of a graph is a set of vertices and a set of edges. Thus, for Exercise 0.9, you need to translate the content of the given figure into the definition of appropriate sets. (Of course, explanation is needed.)  
Supp. Prob. 1, 2  Be sure to state any induction hypothesis carefully!  
Mon., Feb. 3  1.4be, 1.5ceg, 1.6aijl, 1.8ab  
Supp. Prob. 3a  
Mon., Feb. 10  Use the instructions of 1.21 on the NFAs of 1.16; 1.53  
Supp. Prob. 3b, c, Supp. Prob. 4  For 3b and 3c, please include your NFA for 3a, so the starting point will be clear.  
Mon, Feb. 17  Hour Test 1  Covers Chapters 0, 1  
Mon., Feb. 24  Supp. Prob. 5, Supp. Prob. 6, Supp. Prob. 7, Supp. Prob. 9  
Supp. Prob. 8, Supp. Prob. 10  
Wed., March. 3 Due at 11:30 am at my office  Supp. Prob. 11, Supp. Prob. 12ab, Supp. Prob. 13  Of course, the standard rules for quotation and citation apply. Note, however, that for problem 12, copying or slightly modifying the wording from another source will yield very few points (e.g., upper bound 0).  
Supp. Prob. 12cd, Supp. Prob. 14  
Fri, Mar. 14  Hour Test 2  Covers Chapters 04  
Wed., April. 8  Supp. Prob. 15, Supp. Prob. 16  
Supp. Prob. 17  
Film Summary: Reasoning about Programs by Edsgar Dijkstra  Film shown in class on Friday, April 4; summary should be reasonably detailed and extend at least 2/3 page. What are the main themes, how do the problems relate to those themes, and how are the themes addressed?  
Mon., April. 14  Supp. Prob. 18  Program binarysearchalternatives.c may be downloaded, compiled, and run to check your reasoning. However, answers to this question must focus on reasoning about loop invariants. Running the program with superficial reasoning will yield few, if any, points.  
Fri., April. 18  Supp. Prob. 19, Supp. Prob. 20  
Supp. Prob. 21  
Wed., April. 23  Supp. Prob. 22, Supp. Prob. 23  
Supp. Prob. 24  
Takehome Test Distributed  Covers Chapters 15, 7  
Fri., Apr. 25  Class Presentations on NP Complete Problems  
Mon., Apr. 28  Class Presentations on NP Complete Problems  
Wed., Apr. 30  Class Presentations on NP Complete Problems  
Takehome Test Due  Covers Chapters 15, 7  
Due Date  Collaboration  Chapter  Problems  Notes 
Definition: The height of a nonempty tree is defined as the number of nodes on the longest path from a leaf of a tree to its root; the height of an empty tree is defined to be 0.
Nodes in a Binary Tree: Suppose a binary tree T has height h. Prove that T contains at least h nodes and at most 2^{h}  1 nodes.
Comments in Java: Java allows two types of comments:
For the purposes of this problem, suppose all characters within a Java program are from the set {/, *, a, b, N}, where N represents the endofline character. (In a real Java program, of course, the characters a, b would be extended to all letters, digits, punctuation, etc., but that seems too extensive for this exercise.)
Consider the alphabet Σ = {0, 1}. For a string s ∈ Σ^{*}, define s^{R} as the reverse of s. That is, the characters in s^{R} are the same as the characters in s, but the characters appear in the reverse order. Is {s s^{R}  ∈ Σ^{*}} a regular language? Give a careful justification for your answer.
Strings with complementary numbers of a's, b's, and a's: Working with the alphabet Σ = {a, b}, consider the language M that contains all strings over Σ of the form a^{n}b^{n}a^{n}, where n is any nonnegative integer.
Determine whether or not M is a contextfree language.
Strings with twice the number of a's than b's: Working with the alphabet Σ = {a, b}, consider the language L that contains all strings over Σ for which the number of a's is exactly twice the number of b's .
Determine whether or not L is a contextfree language.
if Statements in Pascal: Suppose the symbols Booleanexpression and statement have been defined for the Pascal language through a contextfree grammar. Then, the Pascal Standard specifies the following contextfree grammar for "if" statements:
ifstatement → "if" Booleanexpression "then" statement  "if" Booleanexpression "then" statement elsepart elsepart → "else" statement
Assume both (x < 1.5) and (y > 4) are valid Booleanexpressions, and assume assignments a := 6.7 and b := x are valid statements. Consider the Pascal code:
if (x < 1.5) then if (y > 4) then a := 6.7 else b := x
Note that the Pascal standard added a note to resolve this issue for compilers. Thus, while the formal grammar was ambiguous, the interpretation in actual programs was not.
Cond Statements in Scheme: Suppose the symbols condition and statement have been defined for the Scheme language through a contextfree grammar.
Turing Machine for 2 a's: Consider an input alphabet Σ = {a, b}, and let L = {strings w over Σ  w contains two consecutive a's}. Design a Turing machine that accepts the language L. Write out your machine in full, both using a complete transition table and using a state diagram.
Consider the input alphabet for this problem to be {a, b}.
Turing Machine for Palindromes: Design a Turing machine that reads a string s and returns the string ss^{R}, where s^{R} is the reverse of the string s. For example, given the string "abbaa", the Turing machine should halt after "abbaaaabba" is printed on the tape. As in Supplemental Problem 9, write out your machine in full, both using a complete transition table and using a state diagram, and consider the input alphabet to be {a, b}.
Derivations of Context Free Grammars in Chomsky Normal Form:
Proof Summaries: Behind the proof of each theorem lies an idea. The details of a proof may require extensive exposition, but the underlying idea often can be explained in several sentences. For each of the following results, write an explanation (in your own words) of why the result is true; what is/are the main idea(s) of the proof.
Notes:
Pythagorean Triples as Roots of a Polynomial: In number theory, a Pythagorean triple consists of three positive integers (a, b, c), so that a^{2} + b^{2} = c^{2}. Also, a polynomial of three variables p(x, y, z) is a sum of terms as described on pages 154155. In this problem, we consider only polynomials with integer coefficients.
Consider the language Poly_{int} = {p(x, y, z)  p(x, y, z) is a polynomial with integer coefficients, such that there exists a Pythagorean triple (a, b, c) where p(a, b, c) = 0}
Show that Poly_{int} is Turing recognizable.
Unions and Intersections of Context Free Languages:
Decidability of Whether a Regular Language is Empty: Consider the question of whether a regular language L is empty. The following proof outline claims to prove this question is decidable.
Proof Outline:
Exercise: Is this proof outline valid? That is
Decidability of Whether a Regular Language is Infinite: Consider the question of whether a regular language L is infinite, and consider these claims. Use the same notation (L, R, c) as in the previous problem.
Proof Outline:
Exercise: Is this proof outline valid? That is
Decidability of Whether a Context Free Language is Empty or Infinite:
Binary Search and Loop Invariants: The C code distributed in class included four approaches for coding a binary search. For each approach:
Verbose Turing Machines: A Turning Machine is called verbose if it contains one or more states that are never used in the processing of any input string. Formulate the collection of verbose Turing Machines as a language, and show that it is undecidable.
Proof Summary for the Post Correspondence Problem: Problem 12 (above) outlines the idea of a proof summary for a result.
Twos Complement Binary Integers: Consider alphabet Σ = {0, 1}, so that strings in Σ^{*} may be considered binary integers. In interpreting an integer, consider a leading bit of 0 to represent a nonnegative integer, and a leading bit of 1 represents a negative number using twos complement notation.
Let I = {< M >  M is a Turing Machine that accepts integer a whenever M accepts a}. (In this description, note that a may be positive, negative, or zero.) Show that I is undecidable.
EQ_{TM}: Write a proof summary for Theorem 5.30. The summary should be at least 2/3 page for the "Turingrecognizable" part of the theorem and at least 2/3 page for the "coTuringrecognizable" part of the theorem.
Class P: Suppose S and T are two languages in Class P.
In each case, justify your answer.
Reducibility of a Decidable Language: Suppose A is a language over
an alphabet Σ. Also, suppose L is the infinite language {
Is it true that A is decidable if and only if A ≤_{m} W? Justify your answer.
This document is available on the World Wide Web through the course home page at
http://www.cs.grinnell.edu/~walker/courses/341.sp14/
created 5 January 1999 revised 22 February 2012 revised 24 December 201210 January 2013 revised 24 December 20135 January 2014, 1927 February 2014, 116 April 2014 

For more information, please contact Henry M. Walker at walker@cs.grinnell.edu. 