Ronald Mak

Department of Computer Science
Department of Computer Engineering
Spring Semester 2016

 Office hours: TuTh: 4:30-5:30 PM Office location: MacQuarrie Hall, room 413 E-mail: ron.mak@sjsu.edu
Mission Control, Jet Propulsion Laboratory (JPL)
NASA Mars Exploration Rover Mission

CS 154/SE 154: Formal Languages and Computability

Assignments

# Date Due Assignment
1 Jan 28 Feb 8 Introduction to JFLAP
Suggested solutions
2 Feb 11 Feb 17 Problem set A
Suggested solutions
3 Feb 25 Mar 3 Problem set B
Suggested solutions
4 Mar 3 Mar 14 JavaCC Super Calculator
SimpleCalculator.jj
Suggested solution
5 Mar 17 Mar 23 Problem set C
Suggested solutions
6 Apr 7 Apr 15 Turing machines
Suggested solutions
7 Apr 21 Apr 29 Recursively enumerable and recursive languages
Suggested solutions

Exams

Date Solutions
Midterm #1 Feb 18 solutions
Midterm #2 Mar 24 solutions

Lectures

Date Content
Jan 28 Slides: Goals for the course; science theories; computer theory; bold assertions; historical perspective: Cantor, Hilbert; Goedel, Church, Kleene, Post, Turing, von Neumann, Chomsky; overview of the course; the language game; basic terms; string examples
Feb 2 Slides: Substrings; proof that |uv|=|u|+|v|; example languages; languages are sets; language rules; what is L**; grammars; production rules; derivations; language generation; sentential forms; grammar examples; Assignment #1
Feb 4 Slides: Grammar examples; automata; control unit; transition function; automata configuration; acceptors and transducers; deterministic vs. nondeterministic; deterministic finite acceptors (DFA); DFA operation; transition graph; state transition matrix; a practical application; languages and DFAs

Example DFA use: War and Peace
Feb 9 Slides: DFA and associated transition graph; regular languages; nondeterministic finite acceptors (NDA); language accepted by an NFA; NFA more powerful than DFA?; NFA to DFA conversion; why convert?
Feb 11 Slides: Assignment #1 solutions; NFA to DFA conversion algorithm; equivalent DFAs; distinguishable vs. indistinguishable states; reducing the number of states
Feb 16 Slides: JFLAP manual derivation; regular languages and automata; regular expressions; precedence rules; construct an NFA from an RE; generalized transition graph; NFA to RE conversion; regular grammars; ways to describe a regular language, grep and Java's regex package; review for midterm #1
Feb 18 Midterm exam #1
Feb 23 Slides: Kleene's Theorem; closure properties of regular languages; homomorphisms; right quotient; pumping lemma for regular languages
Feb 25 Slides: The pumping lemma for regular languages; example pumping lemma proofs; Assignment #3; Chomsky Hierarchy of Languages; context-free languages; leftmost and rightmost derivations; an expression grammar; derivation trees; ambiguity
Mar 1 Slides: Type 0, 1, 2, 3 languages; context-free and context-sensitive languages; regular expressions for tokens; compiler-compilers; scanners and parsers; JavaCC; JavaCC regular expressions; s-grammars

Example JavaCC grammar files:
helloworld1.jj   helloworld2.jj   helloworld3.jj   helloworld4.jj   helloworld5.jj   numbers.jj
Mar 3 Slides: BNF for statements and simple expressions; JavaCC for simple expressions; Assignment #4

JavaCC grammar file for Simple Calculator: SimpleCalculator.jj
Mar 8 Slides: BNF for simple expressions; JavaCC for simple expressions; Assignment #4; simplifying context-free grammars; lambda-free grammars; substitution rule; remove useless productions; remove lambda productions; remove unit productions; Chomsky normal form; Greibach normal form; limitations of finite automata; pushdown automata
Mar 10 Slides: How a pushdown automaton (PDA) works; how to program a PDA; example programs with flowcharts; nondeterministic PDA (NPDA); NPDA transition function; example NPDAs; instantaneous description; context-free languages and NPDAs
Mar 15 Slides: Convert DFA-->regular grammar; convert context-free grammar-->PDA; convert NPDA-->context-free grammar; deterministic context-free language
Mar 17 Slides: Pumping lemma for context-free languages; example proofs with the pumping lemma; Assignment #5; context-free closure properties; regular intersection; context-free decidable properties; sample solution for Assignment #4
Mar 22 Slides: More context-free decidable properties; programming language parsers; top-down and bottom-up parsers; shift-reduce parsing; table-driven shift-reduce parsing; parsing examples; how to construct an LR(1) parsing table; review for midterm #2
Mar 24 Midterm exam #2
Apr 5 Slides: Theory of undecidable problems; Alan Turing; models of computation; Turing machine: definition, transition function; TM example #1
Apr 7 Slides: Turing machine example #2; instantaneous descriptions; TM example #3; Ms as language acceptors; TMs as transducers; Turing-computable functions; is addition Turing-computable?
Apr 12 Slides: Turing machine to copy strings; TM that compares values; combining TMs; TM subprograms; Turing's thesis; definition of an algorithm; Turing's writings
Apr 14 Slides: Other models of Turing machines; equivalent automata classes; simulation; TMs with: stay option, multiple heads, multi-track, multi-tape, semi-infinite tape, input file, multidimensional tape; nondeterministic TM; universal TM; homemade TM
Apr 19 Slides: Countable sets; proper order; Turing machines are countable; limited forms of TMs; linear bounded automata; recursively enumerable languages; recursive languages
Apr 21 Slides: Membership algorithm; construct an enumeration procedure; burning questions; powerset is not countable; non-recursively enumerable languages; language L and its complement; recursively enumerable but not recursive; Assignment #7
Apr 26 Slides: Grammar review; unrestricted grammar generates recursively enumerable language; context-sensitive grammars and linear bounded automaton; LBA less powerful than Turing machine; hierarchy of languages; limits of computation; computable functions; decidable problems; halting problem and recursively enumerable; reducing undecidable problems; state-entry problem; halting problem
Apr 28 Slides: Analogy of problem reduction; Post correspondence problem (PCP); modified Post correspondence problem (MPCP); proof that MPCP is undecidable; proof that PCP is undecidable
May 3 Slides: Why PCP is undecidable (intuitive); why PCP is useful; known undecidable problems for context-free languages; efficiency; formalized mathematics: axioms, rules, and propositions
May 5 Slides: Gödel's incompleteness theorem; primitive recursive functions; monus operator; functions not primitive recursive; Ackermann's function; µ-recursive functions; computation efficiency; algorithm scaling; big-Oh; upper and lower bounds; time complexity
May 10 Slides: Algorithm running times; satisfiability problem; deterministic vs. nondeterministic; single-tape vs. multi-tape; efficient algorithms; easy vs. hard problems; yes vs. no problems; reductions; properties of polynomials; nondeterministic machines; NP; traveling salesman problem; NP-complete; P; is P = NP?
May 12 Slides: Language families and complexity classes; deciding and classifying a language; languages and classes P and NP; polynomial-time reduction; NP-complete; What the Heck?

Goals

• Understand the fundamental capabilities and ultimate limitations of computation.
• Appreciate the rich antecedents and foundational theories of modern computing.

Prerequisites

Department policy is to enforce
all course prerequisites strictly.

 CS 46B Introduction to Data Structures grade C- or better Math 42 Discrete mathematics grade C- or better

Required book

 An Introduction to Formal Languages and Automata, 5th edition Peter Linz Jones & Bartlett Learning, 2012 ISBN: 978-1-4496-1552-9 Contents of the enclosed CD ROM

Software to install

There may be other software packages announced during the semester.