CSC320
Cook-Levin Theorem
Theorem (Cook 1971, Levin 1973) SAT (in CNF form) is NP-complete
We have already shown that SAT is in NP. So now we need to show that
for any language L N P , L can be reduced to SAT
So for, we have only shown reducibilities of a
CSC320
Nonregular Languages the Pumping Lemma
Consider
L = cfw_anbn | n 0
= cfw_, ab, aabb, aaabbb, aaaaabbbbb
Intuitively: must remember how far the center point is from the start to
accept the string:
aaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbb
But FAs has o
CSC320
Turing Machines and General Computability
The Turing Machine is a simple model which, apparently, totally captures
mechanical computability. TMs are much simpler than Java programs, so
they are easier to understand, yet they capture the power of Ja
Minimizing DFAs
CSC320
Fall 2015
DFA State Minimization
Given a DFA = (, , , 0 , ), for a language , there is a
procedure for constructing a minimal DFA with as few states as
possible which is unique up to isomorphism (i.e., renumbering of the
states).
CSC320
The SAT Problem
We are now going to take a slight detour, and focus on a particular
computational problem, known as Boolean satisfiability or SAT for short.
Why study SAT?
1. A powerful technique for solving problems translate a problem instance as
CSC320
Lots of NP-complete Problems
Recall (Cook-Levin): SAT is NP-complete, and this is also true for
CN F SAT , the class of expressions in CNF form.
Starting from Cook-Levin, we want to show that other problems are NPcomplete.
To start, we will conside
CSC320
Finite Automata
Finite automata model systems with a fixed amount of memory, e.g, door
controller
Three components:
front pad, door, rear pad
door swings open to the rear
Door is in two possible states: CLOSED or OPEN
Four possible signals (or
CSC320
Context-Free Languages
A formalism such as, regular expressions, can be viewed as a language
generator.
We will now look at a more complex kind of language generator: contextfree grammars (CFGs)
CFGs use variables to represent strings of symbols
CSC320
Nondeterministic Finite Automata
Nondeterminism is an abstraction which allows us to consider extensions of
ordinary computation. We allow simulatneous execution paths, and accept
if any one path is an accepting path.
Ways to think about this:
Con
CSC320
Reductions
Basic idea: we dont have to solve problems from scratch. Use existing
problems to solve new problems.
Can be useful in practice (e.g. SAT solvers) but is also a way to show that
new problems are e.g., undecidable
Say, e.g., we have a lan
CSC320
Regular Expressions
The regular expressions over an alphabet are exactly all strings over the
alphabet cfw_(, ), , , that can be obtained as follows:
1. , , and the members of are regular expressions.
2. If R and S are regular expressions, then so
Alphabets and Languages:
the mathematics of strings
CSC320
Strings and symbols
An alphabet is a finite set of symbols, e.g., the binary or Roman alphabet. We
denote an arbitrary alphabet by
A string over an alphabet is a finite sequence of symbols from
CSC320
Variations on the TM Model
The goal of this section is not to teach you how to program TMs but to
show how powerful they are. Eventually we show they are as powerful as a
computer which has unlimited time and space.
TM Variants
1
CSC320
Programming
A Survey of Classes of Primitive Recursive Functions
Stephen A. Cook
Abstract
This paper is a transcription of mimeographed course notes titled A Survey of
Classes of Primitive Recursive Functions, by S.A. Cook, for the University of California Berkeley c
CSC320
Intractable Problems
We have shonw that there are problems which cannot be decided by a
computer. Now we look at the problems which can be decided and find
that for many of them the only algorithms we have are not practical
because they require to
Foundations of Computer
Science
CSC320
What is this course about?
We will study the fundamental nature of computation
Can you be a little more specific?
What problems are solvable by a computer?
OK, but
1. What is a problem?
2. What is a solution?
3. Ho
CSC320
N P -Completeness
A language L is NP-complete if
L is in NP
L is NP-hard: there is a polynomial time reduction from any other
language in NP L.
The Cook-Levin Theorem states that SAT is NP-complete. This implies
SAT P iff P = NP, i.e., SAT is at
CSC320
Countable Sets
A function from set A to B is 1-1 if it never maps two elements of A to
the same element of B. It is onto if for every b B there is an a A such
that f (a) = b.
A set A is countable if it is finite or if there is a 1-1 and onto functi
CSC320
Subset Sum is N P -complete
SU BSET -SU M = cfw_(S, t) | S has a subset whose elements add up to t.
Here S is a set of integers and t Z
We already showed SU BSET -SU M is in N P .
NP-completeness
1
CSC320
Vertex Cover Reduces to Subset Sum
(Note: T
Smce bra \< P 4min I E P and I
«1-7 P<bc\§z\ fP+P
mu3+ show Wwd' P +P < (PH3\
PE+P< P-P+P< MW.
50 9. < \3j7'z.\< \3\
f. :5sz ¢ 0"!
ha}
:cjz. = \F"01P¢ L
Ijlh
kc) Le+ w =lP =OF+IF"
\Xj\<P 50 4V. 04"? O'r j
P 5 ,
( :
)3 [gain-eat
4MQ QnMhB of j \\
(t) no+ «agent
3' Le+ I Show
H.(CQ((ibcd bdouo) is a»: pa. .uwy
(quach L, (L. (omPim+) M L(9\,I\:L,
Lcl weL, we when {an +-M3v~ 14 3+ Wm
end up 'm Sam 34a (Lei: (c) M»? «agar
3. Lel L(H,)--L, Iwi show 4N6-
H.(dn«amd bdouA) is m: as.» aw;
(Men's 7:,
CSC 320 Spring 2014: Assignment #3
1.
Suppose you are given a boolean function IsEmpty( M):
Input: A DFA M, Returns: true if L(M) = and false otherwise.
(a)
(b)
[5] b* aa* b(a bb* a)*
(c)
2.
[10] Describe a construction which given a DFA M 1 = (K 1 , , 1
CSC 320 Spring 2014: Assignment #1 Solutions
1.
Let A= cfw_s, p and B = cfw_a, b, c.
(a)
A ( denotes the empty set) =
(b)
A cfw_e (e denotes the empty string) = cfw_(s, e), ( p, e).
(c)
A B = cfw_(s, a), (s, b), (s, c), ( p, a), ( p, b), ( p, c).
(d)
A
CSC 320 Spring 2014: Assignment #4
Due at beginning of class, Fri. Mar. 21
Draw boxes for your marks. Place a 0 in the corresponding box for any questions you omit.
Question
1
2
3
4
5
6
7
8
Marks
1.
Consider the following rightmost derivation:
S =>
T B C
CSC 320 Spring 2014: Assignment #2
Due at beginning of class, Fri. Feb. 7
Draw boxes for your marks. Place a 0 in the corresponding box for any questions you omit.
Question
1
2
3
4
5
6
Marks
It is not the job of the TA to verify complicated regular expres
CSC 320 Spring 2014: Assignment #3
Due at beginning of class, Fri. Feb. 21
Draw boxes for your marks. Place a 0 in the corresponding box for any questions you omit.
Question
1
2
3
4
5
Marks
1.
The learning objective for this question is for students to un
CSC 320 Fall 2013: Assignment #1
Due at beginning of class, Fri. Sept. 20
Read Chapter 1 of the text (reviews math prerequisites).
1.
Put your name on your assignment. Questions should be in order.
2.
Assignments are submitted on paper at the beginning of
HOMEWORK 2CSC 320
Due Friday October 7, 2016
(1) Let = cfw_0, 1, +, =
ADD = cfw_strings of the form x = y+z | x, y, z are binary integers and x is the sum of y and z
Prove ADD is not regular using the pumping lemma.
2
(2) Let L = cfw_1k | k is an integer.
CSC320
Pushdown Automata
A pushdown automata (PDA) is like an NFA except it has a stack or
pushdown store that can be used to record an unbounded amount of
information.
The input is read left to right as in an NFA.
In each step, the machine is in some
CSC320
Pushdown Automata and Context-free Grammars
Theorem: The class of languages accepted by PDAs is exactly CFL.
We first show that every CFL is accepted by a PDA
Given a context-free grammar G = (V, , R, S), we construct a pushdown
automaton P = (Q, ,
MID TERM
CMPS 130 - Winter 14
Warmuth
NAME:
Student ID:
This exam is closed book and notes. Show partial solutions to get partial credit.
If your answers are not written legibly, you wont get full credit.
Clarity and succinctness will be rewarded.
Questio