Reminders
Course Calendar ICS
Upcoming Deadlines
Recent Discussions
Thread title |
|---|
|
Announcements
Course is Graded
Final Exam Deadline Extended
Schedule for Course Wrapup
The final is a 3-hour exam, covering the material in the entire course. You will have a one week period in which to open it, but once you open it, it closes 3 hours later, so make sure you don't open it until you have 3 consecutive free hours. The 1-week window will begin Monday Nov. 2, 2015, 00:01AM and end Monday Nov. 9, 2015, 00:01AM. Remember that these times are GMT -8:00. Note: the exam is "open book," in the sense that you can use any materials such as class videos or Wikipedia, while you take the final. However, since the exam time is limited to 3 hours, you do not want to spend too much time learning the material during the time you are taking the final. You really need to get things straight before you begin.
Statements of Accomplishment will be emailed to all who score at least 50% of the marks. Recall that half the marks are your combined score on the seven homeworks, and the other half come from the final exam. For distinction, you need 90% of the marks, but each programming project done successfully gives you a 5% bonus.
Challenge Problems 5
The Chain-Selection Problem is: given
1. A budget m,
2. A target t,
3. A directed graph G that consists of disjoint chains only (a chain is a sequence of nodes n_1, n_2,...,n_k, such that the only arcs among these nodes are from n_i to n_{i+1}, for i = 1, 2,..., k-1), and
4. A value v_i for each node n_i,
can we select m nodes, whose values sum to at least t, subject to the constraint that if we select a node, then we must select its predecessor, if any, in its chain?
Example: An example of a chain graph has nodes 1, 2,..., 10 and arcs 1→2, 2→3, 3→4, 6→7, 7→8, 8→9, and 9→10. The chains are 1-2-3-4, 5, and 6-7-8-9-10. In this graph, with a budget of 4, we could choose nodes {1, 2, 5, 6}, or {6, 7, 8, 9}, for example, but we could not choose {1, 2, 7, 8}, because it is not permitted to choose 7 without choosing its predecessor 6 in its chain.
Your question: Is the Chain-Selection Problem NP-complete or is it in P? Either give a reduction to show it is NP-complete or give a polytime algorithm to solve it.
Aside: This problem actually surfaced recently as a problem about materialized-view selection in databases. However, we can see it as one of choosing items to purchase in an environment where it doesn't make sense to purchase one item until you have purchased all the previous items on a chain. For instance, one chain might be "a TV" → "cable service" → "high-def decoder box." It doesn't make sense to buy cable service if you have no TV, and it doesn't make sense to get a decoder box unless you have cable service.
Problem 2
The Quadratic Allocation Problem is: given
1. Nonnegative integers a and b,
2. A list of integers i_1, i_2,..., i_k, and
3. An integer limit l (ell),
can we select a subset of the integers on the list i_1, i_2,..., i_k, such that the sum of ai+bi^2 over all selected integers i equals the limit l? Note: all integers are assumed represented in binary for this problem.
Is the Quadratic Allocation Problem NP-complete or is it in P? Either give a reduction to show it is NP-complete or give a polytime algorithm to solve it.
Aside: This problem arose during some consulting I was doing, where the integers represented the sizes of different software jobs, and the quadratic term is there because the cost of implementing software goes up faster than linearly with the size of the job.
We'll post hints for both these problems on the Challenge-Problem forum.
Materials for Week 6
Also in Video 20 we meet the idea of a polynomial-time reduction, a way to show that if one problem (say a problem in NP) has a polynomial-time algorithm, then another does. That gives us the notion of an NP-complete problem -- one to which every problem in NP has a polynomial-time reduction. The essential property of NP-complete problems is that if any one of them has a polynomial-time solution, then everything in NP has a polynomial-time solution. Since it appears that no NP-complete problem has a polynomial-time solution, a proof that a problem is NP-complete is almost-but-not-quite a proof that it cannot be solved in polynomial time. Commonly, we interpret a proof of NP-completeness as concluding the problem requires more than polynomial time.
In Video 21, we begin the process of proving certain real problems to be NP-complete. We start with Cook's theorem -- that the question of whether a Boolean expression is satisfiable (has an assignment of truth values to its variables that makes the expression true) is NP complete. Steve Cook proved this by showing how the language of any nondeterministic polynomial-time Turing machine could be reduced in polynomial time to the satistfiability problem.
Video 22 does the proof that two common problems: Node Cover and Knapsack are NP-complete. The proofs are by reducing SAT to each of these problems using a polynomial-time reduction.
A fourth video is a "problem session" from the earlier class; it addresses two common questions on undecidability and intractability.
There is a final homework for this session. Both the hard and soft deadline are Sunday Nov. 1, just before midnight. The reason for this schedule is to give you a reasonable amount of time to do the homework, and yet have the solutions posted before the final.
We have also posted a final set of challenge problems for you to consider. These let you try to apply what you learned about NP-completeness to decide if two problems that I encountered in my travels are NP-complete or have polynomial-time algorithms.
Challenge Problems 4
Problem 1
Let L be the set of Turing machine codes M such that L(M) contains at least two strings. By Rice's theorem, L is not recursive. Show that L is recursively enumerable by constructing a Turing machine that accepts L. The description can be informal. Just remember to give the key ideas so the reader is convinced you understand how the TM works.
Problem 2
Devise an encoding with a finite alphabet for all context-free grammars with terminal alphabet {0,1}. Remember that CFG's may have any number of variables, so you will have to find a naming system for them. Incidentally, you can extend the encoding (but you don't have to in this problem) so the grammars may have any terminal alphabet. But since the encoding must use a finite alphabet, you would not be able to retain the identity of the terminal symbols. Thus, for example,
Materials for Week 5
There are only three videos this week, but they are in aggregate about as long as the four videos we have been showing in each of the past weeks. Video 17 explores Turing machine theory, showing that some obvious restrictions and obvious generalizations all define exactly the recursively enumerable (RE) languages. This video also looks at the two classes of languages defined by Turing machines: the RE languages and the recursive languages; the latter are languages defined by Turing machines that always halt. We show that each of these language classes have closure properties similar to those of the regular languages or context free languages -- with some differences, of course.
In video 18, we introduce our first undecidable problems, starting with a diagonalization over all Turing machines. Then, in video 19 we explore some real undecidable problems. We prove Rice's theorem, which lets us conclude that essentially everything about what Turing machines (or computer programs) do is undecidable. We introduce Post's Correspondence problem (PCP), a question that does not appear to have anything to do with computation, and prove PCP is undecidable. Finally, we use PCP to prove some questions about CFG's are undecidable; an example is whether a CFG is ambiguous.
There is one new homework for this week, and we'll offer another challenge-problem set (optional).
Finally, there is a third problem-session video, discussing the "HALF" problem and some points that were raised in the discussion forum from the first offering of the class.
Materials for Week 4
Then, video 16 introduces Turing machines. The Turing machine is the common model for what it means to be able to compute something, and they have played this role since before there were computers. We give the definition of this type of automaton, but most of the time is spent talking about some subtle points necessary to understand what Turing machines can and cannot do: the fact that everything can be encoded as integers or binary strings, and the difference between Turing machines that are guaranteed to halt on any input and those that are not.
There is a new homework, and a second optional programming project. The latter is based on the CYK algorithm for deciding whether a string is a member of a CFL, as discussed in video 15.
Challenge Problems 3
Arithmetic expressions with operator + and parentheses can be generated by the grammar
E -> E+E | (E) | a
where a is intended to represent any number. A typical string in the language is a+(a+a). This grammar is ambiguous.
(a) Give an example of a string that has two or more leftmost derivations or parse trees.
(b) Design an unambiguous grammar for the same language.
Problem 2:
The operation HALF(L), discussed in a previous challenge problem, is { w | for some x with the same length as w, wx is in L}. While regular languages are closed under HALF, CFL's are not. Give an example of a CFL L such that HALF(L) is not a CFL. Prove that your language L is a CFL by describing a CFG or PDA for L. Prove that HALF(L) is not a CFL by whatever means you find appropriate, e.g., using the pumping lemma and/or applying some CFL-preserving operation to HALF(L) to produce a language known not to be a CFL. We'll provide a hint later on the forum for challenge problems.
Materials for Week 3
In Video 9, we introduce the CFG notation and the related Backus-Naur Form (BNF) notation used to describe most programming languages' syntax today. Video 10 teaches about parse trees and the problem of ambiguity. Video 11 covers simplifications of CFG's -- ways to eliminate certain problematic structures in grammars. Finally, in Video 12, we meet the pushdown automaton, a finite automaton with an additional memory capability: a stack data structure. These automata recognize exactly the CFL's, as we shall learn in week 4.
There is one new homework for week 3, and we are also making available a "Problem Session" that was conducted by Zhu ChenGuang the first time this course was offered.
We also will post two new challenge problems in the class announcements, Monday morning 9/28/15. They are not graded, but you can discuss them on the Forum created for this purpose.
Incidentally, class registration is still open, but closes at the end of week 3. So if you have a friend who was planning to jump in late, tell them now is the time to jump in.
Challenge Problems 2
Problem 1:
Develop an algorithm that given:
1. A finite automaton A,
2. Two particular states p and q of A, and
3. A regular expression E,
tells whether there is any string in L(E) that takes state p to state q in A.
Problem 2:
Define HALF operation on a language L:
HALF(L) = {x | there exists a string y such that xy is in L and |x|=|y| }
Prove that if L is regular, so is HALF(L).
Example: if L = {0010, 10, 010}, then HALF(L) = {00, 1}. Note that 010, being of odd length, yields nothing for HALF. 0010 yields its first half: 00, and 10 yields its first half: 1.
Problem 3:
You probably know about Fibonacci numbers, where the n-th Fibonacci number F(n) is defined by F(0) = F(1) = 1, and F(n) = F(n-1) + F(n-2) for
But there is more to the story. The straightforward dynamic programming algorithm takes a number of arithmetic steps that is linear in n to compute F(n). It is truly remarkable that this is NOT the best way to compute large Fibonacci numbers. In fact, it can be done in O(log n) arithmetic steps. The technique is called "recursive doubling." Here's an idea that does not work, but it might suggest an improvement that does. Suppose we had a function
Materials for Week 2
The materials for week 2 of Automata consist of four videos, two homework sets, an optional programming project, and an optional challenge problem set (which is in the form of a class announcement, NOT an email). The videos will finish the work on regular languages. In the first of these (video 5), we introduce regular expressions, and in video 6 we learn that the languages definable by regular expressions are all and only the regular languages. That is, regular expressions and finite automata of all kinds define the same languages.
Video 7 covers what are called "decision properties" of regular languages. We can answer many questions about the languages represented by regular expressions or finite automata that we cannot answer about programs in general. The existence of algorithms to do things like tell whether the language of a finite automaton is empty, or to find a minimum-state equivalent to a given finite automaton is one of the things that makes these automata so useful. Finally in the 8th video we learn about closure properties of regular languages: the fact that we can combine regular languages using many common operations,such as union or intersection, and get another regular language.
I apologize for giving a double homework this week, Because we allow essentially infinite tries, it is important that we bundle questions into groups of about 5. If we grouped them into smaller groups, you could just keep guessing A on each question until you were right. and if we grouped a larger number together, it would be too painful to repeat a whole set if you got one wrong. Thus, we cannot give the problems out in an exactly equal number each week. Since we are fairly liberal in setting deadlines, we hope you will not feel overwhelmed this week.
Also for your consideration is an optional programming project, involving code to translate from regular expressions to epsilon-NFA's, and a challenge problem about a certain regular languages. You are welcome to discuss these, and there are discussion forums for each.
Important Course Survey
Stanford would appreciate your taking a survey when starting the automata course. Please go to short pre-course survey.
---- Jeff Ullman
Link to survey: https://stanforduniversity.qualtrics.com/SE/?SID=SV_enWZKK0uHnmCnop&a=42254b0b31d667f7a5a179c876e5bf3391f863af&c=415
Challenge Problem 1
Let L be the language with alphabet {0, 1, 2} consisting of strings that do not have any three consecutive 0's, any three consecutive 1's, or any three consecutive 2's. Prove that L is a regular language (hint: design automata or regular expressions for some simpler languages and then use closure properties of regular languages to get L). Harder is to design a DFA A for which the language is L itself, but we encourage you try to design one as a second part of this exercise.
Note: this problem is optional and does not count toward your class score.
Welcome to "Automata."
Homework
The course will have a number of homeworks that are designed using the Gradiance technology. The objective of these homeworks is to enable everyone to get 100% and learn the underlying material. While questions look like multiple choice, you should think of them as more conventional "solve this problem and submit the solution" questions. That is, you are given a problem to solve, which you should work completely. Then, you are given a random choice of responses that are designed to figure out whether you got the right solution or not. If you do have the right solution, you should be able to answer the question easily, regardless of the choices presented. If you get it wrong, you will be given a hint and allowed to try again. Your score on a homework is the maximum of any try. We group about 5 questions together, so you can't repeatedly guess each question independently, without actually doing the work.
The homework for each week will be made available on Saturday, 12:01AM, and due two Mondays (i.e., 16 days) later, 11:59PM. All times are Pacific Time (GMT - 7:00 until November 1, when we go off daylight-savings time and it becomes GMT -8:00). These times are what Coursera calls "soft deadlines," and need to be followed if you want full credit. You can still get half credit by the "hard deadline," which will be Monday, Oct 26, 11:59PM for all but the last homework, which will be a few days later.
Videos
Each week you will have about 2 hours of video to watch, and either one or two groups of homework questions. The time taken by the videos is about half the time I took to deliver the same material in class. The reason the video goes faster than in-class presentation is that a lot of the "ums" and fumbling are edited out. The speed can be good, if the material is not dense or hard to follow. However, there will undoubtedly be points where the going is rough -- details of a proof or an algorithm. In those cases, I encourage you to take advantage of the fact that the lectures are on video, to repeat material, or pause it to stare at a slide for example.
In the first week's videos, you will begin with an introduction to the whole course. I want to try to convince you of the value of learning the four big concepts that you can take away from this course: finite automata, context-free grammars, undecidable problems, and intractable problems (NP-completeness). The second video is an informal introduction to finite automata. Both these two first videos are "light," and I expect you to have little trouble. The third video introduces deterministic finite automata, and at this point we start to get more formal. In the fourth video, the important concept of nondeterminism is introduced. We learn the remarkable fact that despite the almost "magic" capability of nondeterminism, it does not add power to the finite automaton (although it does make description of many applications of automata a lot easier).
Statement of Accomplishment
To get a basic "statement of accomplishment," you need to get 50% of the marks. Half the marks come from the homeworks, and the other half from the final. You can even pass the course just by doing all the homework correctly. Since you are allowed to make multiple tries, that is not impossible. However, the first time I gave this course, a number of people figured they could ignore the homework and just do the final. No one got 100% on the final, so please take the homework seriously.
Programming Assignments
There will also be two optional programming assignments. These do not affect your score for the basic statement of accomplishment. However, for a SoA "with distinction," you need 90% on the homework and final combined, but you get a bonus of 5% for each of the programming assignments completed successfully (e.g., if you do both, then 80% on the homework + final gives you distinction).
Challenge Problems
Finally, we shall issue "challenge problems" after each week. These do not count toward your score, but are worth considering. Discussion on the class forum is welcome (but don't just publish the answer, please).