CS 138: Automata and Formal Languages (Fall '15)

[Annnouncements] [General Info] [Team] [Weekly Schedule] [Textbook] [Piazza] [Grading] [Schedule and Homework] [Links]


  • Sep 22: Please sign into the Piazza page as soon as possible.
  • Sep 22: Update TA info and office hours.
  • Sep 1: New webpage set up. Stay tuned for updates and more info!

General information

  • Total credits: 4
  • Topics: Formal languages; finite automata and regular expressions; properties of regular languages; pushdown automata and context-free grammars; properties of context-free languages; introduction to computability and unsolvability (Turing machines) and computational complexity.
  • Prerequisites: Computer Science 40 with a grade of C or better; open to computer science and computer engineering majors only.


Instructor: Stefano Tessaro, tessaro(at)cs(dot)ucsb(dot)edu, Harold Frank Hall 1117

Teaching assistants

  • Pratik Soni (pratik_soni@cs)
  • Ben Terner (bterner@cs)

Weekly schedule

  • Class time and location
    Tue and Thu 3:30-4:45pm (PSYCH 1902)
  • Discussion sections
    Mon 4-4:50pm (GIRV 2112, Pratik Soni)
    Mon 5-5:50pm (GIRV 2119, Ben Terner)
  • Office hours
    ST: Wed 11am-12p (tenative) or by appointment (HFH 1117)
    TAs: Fr 12-2pm (Trailer 936 Room 104)


We will be using the (mandatory) textbook: Peter Linz, An Introduction to Formal Languages and Automata, Jones and Bartlett Learning.


We are going to use Piazza for discussions about this class, i.e., we are going to only use the Q&A session for now: http://piazza.com/ucsb/fall2015/cs138/home (and enroll here!)

Performance Assessment

  • Homework: There will be 8 problem sets distributed over the quarter. Generally, problem sets are posted online on Fridays, by 11:59pm PST, and are due 11 days later on Tuesday, 3pm PST (use the homework box in the CS mail room for submission), or at the beginning of class at 3:30pm. Homework will be graded, and will constitute an important part of the grade. An exception is Homework 4.5, which will serve the purpose to refresh some concepts bfore the midterm.
  • Midterm: There will be one midterm on Thursday, October 29, 2015. Allowed are only two letter-size sheets of handwritten notes. (Four pages.)
  • Final: The final will take place on Thursday, December 10, 4-7pm . Allowed are only four letter-size sheets of handwritten notes. (Eight pages.)
  • Final grade: Each of the graded problems sets will give between 0 and 30 points, for a total of 240 points. The final will give between 0 and 120 points. The midterm wll give between 0 and 60 points. The lowest homework score will be dropped. Consequently, your total score will be the total of all your points, for a maximum of 420 points.
  • Academic Honesty: The following applies to every course you attend at UC Santa Barbara (from UCSB Campus Regulations, Chapter VII: "Student Conduct and Discipline"):

    It is expected that students attending the University of California understand and subscribe to the ideal of academic integrity, and are willing to bear individual responsibility for their work. Any work (written or otherwise) submitted to fulfill an academic requirement must represent a student’s original work. Any act of academic dishonesty, such as cheating or plagiarism, will subject a person to University disciplinary action. Using or attempting to use materials, information, study aids, or commercial “research” services not authorized by the instructor of the course constitutes cheating. Representing the words, ideas, or concepts of another person without appropriate attribution is plagiarism. Whenever another person’s written work is utilized, whether it be a single phrase or longer, quotation marks must be used and sources cited. Paraphrasing another’s work, i.e., borrowing the ideas or concepts and putting them into one’s “own” words, must also be acknowledged. Although a person’s state of mind and intention will be considered in determining the University response to an act of academic dishonesty, this in no way lessens the responsibility of the student.

    Specifically for the current CS138 course this means that
    • You are not allowed to copy or transcribe answers to homework assignments from others or other sources.
    • Although you are allowed to discuss homework assignments with others, you should write down your answers independently. You should always be able to argue and explain your answers when asked for clarifications.
    • During the Midterm and Final Examination no electronics are allowed, additional notes are only allowed to the extent described prior to the test.
    • When you will be unable to hand in the homework in time you should report this to the lecturer (ST) as soon as possible, but always before the deadline. No matter the reason, you will always be asked to present documentation.
    • When in doubt, ask.
    Students violating the rules of Academic Honesty will receive an "F" for the course and will be reported to the Dean of Students Office.

Schedule and Homework

The following is a tentative schedule, and is intended to give a rough idea about what I hope to cover in the class and in which order. There will be (slight) changes depending on the pace of the class, and more information will appear on the schedule.

WeekDate Lecture contents Reading Assignments
0 2015-09-24 Welcome to CS138
  • Course organization
  • Why is this class important?
  • Review of basic mathematical language
  • Strings and languages
  • L pp 1-20
1 2015-09-29 Regular languages and DFAs
  • Brief interoduction to regular expressions
  • Definition of DFAs and extensive example
  • Definition of regular languages
  • L pp 37-49
2015-10-01 From DFAs to NFAs
  • The complement of a regular language is regular
  • More DFA examples, and difficulty of union
  • Definition of NFAs
  • Examples of NFAs
  • L pp 49-56
2 2015-10-06 Equivalence of DFAs and NFAs
  • Building a DFA from an NFA
  • A few words on DFA minimization
  • L pp 56-69
  • HW1 due
2015-10-08 Regular expressions
  • RegExp Definition
  • Language defined by a RegExp
  • RegExps exactly describe regular languages
  • Closure properties
  • L pp 71-89
  • L pp 99-109
3 2015-10-13 Non-regular languages and the Pumping Lemma
  • A direct proof of non-regularity
  • The Pumping Lemma and Applications
  • L pp 114-124
  • HW2 due
2015-10-15 From regular languages to grammars
  • The Myhill-Nerode Theorem
  • Right- and left-regular grammars
  • Equivalence of right and left-regular grammars and regular languages
  • L pp 89-97
4 2015-10-20 Regular languages wrap-up
  • Mealy machines
  • Moore machines
  • Equivalence of Mealy and Moore machines
  • Format-transforming encryption and regular languages
  • L Appendix A
  • HW3 due
2015-10-22 Context-free grammars and languages
  • Definition of CFGs / CFLs and linear grammars
  • Examples
  • Left-most and right-most derivations
  • Derivation trees
  • Ambiguity
  • L pp 125-145
5 2015-10-27 Simplifying context-free grammars I
  • Basic simplifications
  • Removing useless productions
  • Removing lambda productions
  • L pp 149-158
  • HW4 due
2015-10-29 MIDTERM
6 2015-11-03 Normal forms and parsing
  • Removing unit productions
  • Chomsky normal form
  • Greibach normal form
  • The parsing problem
  • Brute-force parsing
  • L pp 158-169
  • L pp 136-140
2015-11-05 Parsing and pushdown automata
  • The CYK algorithm
  • Simple grammars
  • LL(k) grammars
  • Introduction to NPDAs
  • L pp 171-172
  • L pp 201-204
  • L pp 175-182
7 2015-11-10 Pushdown automata and the pumping lemma
  • Equivalence of NPDAs and CFLs
  • Deterministic PDAs
  • L pp 175-201
  • HW5 due
2015-11-12 Turing Machines
  • Pumping Lemma for CFLs
  • Turing Machines: Definition and examples
  • Recursively enumerable and recursive languages
  • L pp 205-210
  • L pp 223-245
8 2015-11-17 Computability I
  • Review: Countable and uncountable sets
  • Recursively enumerable languages are countable (and so are TMs)
  • Existence of languages which are not RE
  • Existence of languages which are RE, but not recursive
  • HW6 due
2015-11-19 Computability II
  • The Halting Problem is undecidable
  • Computer viruses and undecidability
  • The Post Correspondence Problem (PCP)
  • Undecidability of PCP
9 2015-11-24 Computability III
  • CFGs and undecidability
  • Deciding ambiguity is undecidable
  • Turing Computability
  • Multi-Tape TMs
  • Non-deterministic TMs
  • HW7 due
2015-11-26 No class - Thanksgiving
10 2015-12-01 Introduction to computational complexity
2015-12-03 Wrapping up
  • Class Evaluation
  • Grade statistics so far
  • Q & A
  • HW8 due


The following are some links relevant to this class: