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 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
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
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
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
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
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
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
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
Links on P vs NP
(Note: conneX seems to be having an issue with some of the links. If they do not open when you click
them, try right-clicking and selecting an appropriate action to follow the link, e.g. "Open link in new tab".
The SciAm article is from t
CSC 320: Proof of the Day
Definition:
for functions f and g which map
the natural numbers to real values, the function
f(n) is in O(g(n) if there exists constants c 0
and no 0 such that for all
n n0,
f(n) c g(n).
Use this definition to prove that
3 + 4 n
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
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
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
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 #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
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.
HOMEWORK 1CSC 320SOLUTIONS PART 1
Homework is due in class on Friday Sept. 14. Text, Chapter 0 and Chapter 1 to 1.2
Exercises:
(1) If a set contains c elements, how many elements are in its power set?
(2) Let X be the natural numbers. Let f be a mapping f