Harvard CS 121 and CSCI E-207 Lecture 10: Pushdown Automata
Harry Lewis October 6, 2009
Reading: Sipser, 2.2.
Harvard CS 121 & CSCI E-207
October 6, 2009
Context-free Grammars and Automata What is the fourth term in the analogy: Regular Languages : Finit
Computer Science E-207
A Reduction
1. N P -completeness. A language L is said to be N P -complete i
L is in N P ; and
L is N P -hard (i.e. every language in N P is reducible to L in polynomial time).
To show L is in N P :
Show that L has succinct certi
Computer Science E-207
A Proof by Construction and Mutual Inclusion
Let L be a language and dene Suffix(L) = cfw_x : w s.t. wx L. Prove that, if L is regular, then so is Suffix(L).
Proof Idea: Since L is regular, let M = (Q, , q0 , , F ) be a DFA recogniz
yj ~)whs h f i s g s x i y pi f yv y i s v gi h v s j s j f d py i s y j f h fy y hv g i Fwhq6ufwsFDfur$8q!brnwhcfw_wws)wF'i qrbv uxF)Sahag vp gf d i s si p o v s yv y h sy s v y hf v xf p pf j i y x i jppv i g sv jp j $r6q~ghw$q@uwpn!rFufrwbF@f$iFrbruTfb
Computer Science E-207
A Formal Description of a Turing Machine
Problem Give the seven-tuple for a Turing machine, M , that loops forever, counting up all strings in cfw_a, b, c lexicographically (i.e., in dictionary order).
Solution M = (K, , , q0 , q7 ,
A CFG for Strings with Equal Numbers of as and bs G = (cfw_S , cfw_a, b, R, S ) where R has rules: S S SS S aSb S bSa Claim: L(G) = cfw_x : x has the same # of as and bs (1) x L(G) x has the same # of as and bs Pf: Easy, every RHS has the same number of a
Harvard CS 121 and CSCI E-207
Lecture 4: Languages and Finite
Automata
Harry Lewis
September 15, 2009
Reading: Sipser, 1.1 and 1.2.
Harvard CS 121 & CSCI E-207
September 15, 2009
Languages
A language L over alphabet is a set of strings over (i.e.
L )
Com
Harvard CS 121 & CSCI E-207
September 6, 2011
An inductive proof
Proposition: The nth Fibonacci number is the number of
strings over cfw_a, b of length n 2 with no consecutive bs.
First step: make sure you know what everything means
What are the Fibona
Harvard CS121 and CSCI E-207 Lecture 1: Introduction and Overview
Harry Lewis September 2, 2009
Harvard CS121
September 2, 2009
Introduction to Formal Systems and Computation Computer Science 121 and CSCI E-207 Objective: Make a theory out of the idea of
Harvard CS 121 and CSCI E-207 Lecture 11: CFL Closure Properties and Non-Context-Free Languages
Harry Lewis October 8, 2009
Reading: Sipser, pp. 119-128.
Harvard CS 121 & CSCI E-207
October 8, 2008
Closure Properties of CFLs Thm (last time): The CFLs are
Harvard CS 121 and CSCI E-207 Lecture 5: NFAs and DFAs Closure Properties
Harry Lewis September 17 2009
Reading: Sipser, 1.2.
Harvard CS 121 & CSCI E-207
September 17, 2009
Announcements Invest in a stapler! About 80% of PS0s were not stapled. That makes
Harvard CS 121 and CSCI E-207 Lecture 20: NP
Harry Lewis November 19, 2009
Reading: Sipser 7.3.
Harvard CS 121 & CSCI E-27
November 19, 2009
Another way of looking at P Multiplicative increases in time or computing power yield multiplicative increases in
Harvard CS 121 and CSCI E-207
Lecture 21: NP-Completeness
Harry Lewis
November 24, 2009
Reading: Sipser 7.4, 7.5.
For culture: Computers and Intractability: A Guide to the
Theory of NP-completeness, by Garey & Johnson.
Harvard CS 121
November 24, 2009
B
NP-completeness: A Retrospective
Christos H. Papadimitriou?
University of California, Berkeley, USA computer science's favorite paradigm, fad, punching bag, buzzword, alibi, and intellectual export. This paper is a fragmentary commentary on its origins, i
A LTEX 2 Cheat Sheet
Lists
\begincfw_enumerate Numbered list. \begincfw_itemize Bulleted list. \begincfw_descriptionDescription list. \item text Add an item. \item[x ] text Use x instead of normal bullet or number. Required for descriptions.
Justication
E
A
An introduction to LTEX
for CS 121
By the CS 121 staff.
An introduction to L EX p. 1/?
AT
A
What is LTEX?
It is a typesetting program.
You give it text interspersed with formatting commands.
E.g. The last word is in cfw_\it italics.
The last word is in
Harvard CS121 and CSCI E-207 Lecture 2: Mathematical Preliminaries
Harry Lewis September 8, 2009
Reading: Sipser, Chapter 0
Harvard CS 121 & CSCI E-207
September 8, 2009
Sets Sets are dened by their members A = B means that for every x, x A iff x B Exampl
Harvard CS121 and CSCI E-207 Lecture 3: Doing Proofs
Harry Lewis September 10, 2009
Reading: Sipser, Chapter 0
Harvard CS 121 & CSCI E-207
September 10, 2009
Formal Inductive Definitions Like recursive data structures and recursive procedures when program
Harvard CS 121 and CSCI E-207 Lecture 8: Non-Regular Languages
Harry Lewis September 29, 2009
Reading: Sipser, 1.4.
Harvard CS 121 & CSCI E-207
September 29, 2009
Cardinality of Languages An alphabet is nite by denition Proposition: is countably innite S
Harvard CS 121 and CSCI E-207 Lecture 6: Optimality of the Subset Construction Regular Expressions
Harry Lewis September 22, 2009
Reading: Sipser, 1.3.
Harvard CS 121 & CSCI E-207
September 22, 2009
1976 Michael O. Rabin See the ACM Author Profile in the
Harvard CS 121 and CSCI E-207 Lecture 16: Reductions
Harry Lewis November 5, 2009
Reading: Sipser Ch. 5
Harvard CS 121 & CSCI E-207
November 5, 2009
Co-X For any property X that a set might have, a set S is co-X iff S has property X. For example, a co-ni
Harvard CS 121 and CSCI E-207 Lecture 12: Turing Machines
Harry Lewis October 15, 2009
Reading: Sipser, 3.1.
Harvard CS 121 & CSCI E-207
October 15, 2009
Turing Machines Objective: Dene a computational model that is General-purpose: (as powerful as progr
Harvard CS 121 and CSCI E-207
Lecture 17: Undecidable Problems and
Unprovable Theorems
Harry Lewis
November 10, 2009
Reading: Sipser Ch. 5
Harvard CS 121 & CSCI E-207
November 10, 2009
Unsolvability of Derivability in General Grammars
Theorem: There is
Harvard CS 121 and CSCI E-207 Lecture 15: Undecidability
Harry Lewis November 3, 2009
Reading: Sipser 4.2, 5.1.
Harvard CS 121 & CSCI E-207
November 3, 2009
Motivation Goal: to nd an explicit undecidable language By the ChurchTuring thesis, such a langua
Computer Science E-207
Pumping Lemma for Regular Languages
Pumping Lemma for Regular Languages, Strong Version If L is a regular language, then there exists a constant p such that, for any string s L, where |s| p, there exist strings x, y, z , where s = x
Computer Science E-207
Pumping Lemma for Context-Free Languages
Pumping Lemma for Context-Free Languages, Strong Version If G is a context-free grammar, then there exists a constant p such that, for every string s L(G), where |s| p, there exist strings u,
Computer Science E-207
A Proof by Contradiction
Lets prove that L = cfw_ak : k = q 2 for some q 0 is not regular. First, some intuition. Note that L = cfw_, a, aaaa, aaaaaaaaa, aaaaaaaaaaaaaaaa, . . .. Your instincts should tell you that a DFA couldnt pos
A
Using Imported Graphics in L TEX 2
Keith Reckdahl
reckdahl@am-sun2.stanford.edu
Version 2.0
December 15, 1997
Summary
A
This document explains how to use imported graphics in L TEX 2 documents.
While reading the entire document is certainly worthwhile,
Harvard CS 121 and CSCI E-207
Lecture 19: Polynomial Time
Harry Lewis
November 17, 2009
Harvard CS 121 & CSCI E-207
November 17, 2009
More Relations
Def: We say that g = o(f ) iff for every > 0, n0 such that
g (n) f (n) for all n n0.
Equivalently, limn