INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.

Slides:



Advertisements
Similar presentations
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Advertisements

The class NP Section 7.3 Giorgi Japaridze Theory of Computability.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Umans Complexity Theory Lectures Lecture 2a: Reductions & Completeness.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
The diagonalization method The halting problem is undecidable Decidability.
Complexity 12-1 Complexity Andrei Bulatov Non-Deterministic Space.
Measuring Time Complexity Sipser 7.1 (pages )
P and NP Sipser (pages ). CS 311 Fall Polynomial time P = ∪ k TIME(n k ) … P = ∪ k TIME(n k ) … TIME(n 3 ) TIME(n 2 ) TIME(n)
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Mount Holyoke College 2 The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Fall The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
More Turing Machines Sipser 3.2 (pages ). CS 311 Fall Multitape Turing Machines Formally, we need only change the transition function to.
More Turing Machines Sipser 3.2 (pages ).
Complexity ©D.Moshkovitz 1 Turing Machines. Complexity ©D.Moshkovitz 2 Motivation Our main goal in this course is to analyze problems and categorize them.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
NP-Completeness CS 51 Summer 2008 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A AA A A AAA.
Computability and Complexity 32-1 Computability and Complexity Andrei Bulatov Boolean Circuits.
CS 310 – Fall 2006 Pacific University CS310 P vs NP the steel cage death match Section 7.2 November 29, 2006.
Time Complexity.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Fall 2004COMP 3351 Time Complexity We use a multitape Turing machine We count the number of steps until a string is accepted We use the O(k) notation.
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 2015.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
חישוביות וסיבוכיות Computability and Complexity Lecture 7 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A AAAA.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
Computational Complexity Theory Lecture 2: Reductions, NP-completeness, Cook-Levin theorem Indian Institute of Science.
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
Complexity Non-determinism. NP complete problems. Does P=NP? Origami. Homework: continue on postings.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong The Cook-Levin.
Costas Busch - LSU1 Time Complexity. Costas Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
NPC.
Alternation Section 10.3 Giorgi Japaridze Theory of Computability.
1 Time Complexity We use a multitape Turing machine We count the number of steps until a string is accepted We use the O(k) notation.
NP-complete Languages
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
Given this 3-SAT problem: (x1 or x2 or x3) AND (¬x1 or ¬x2 or ¬x2) AND (¬x3 or ¬x1 or x2) 1. Draw the graph that you would use if you want to solve this.
TU/e Algorithms (2IL15) – Lecture 9 1 NP-Completeness NOT AND OR AND NOT AND.
1 1. Which of these sequences correspond to Hamilton cycles in the graph? (a) (b) (c) (d) (e)
Prof. Busch - LSU1 Time Complexity. Prof. Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
 2005 SDU Lecture15 P,NP,NP-complete.  2005 SDU 2 The PATH problem PATH = { | G is a directed graph that has a directed path from s to t} s t
Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3
CSCI 2670 Introduction to Theory of Computing November 15, 2005.
NP-Completeness A problem is NP-complete if: It is in NP
The NP class. NP-completeness
CS154, Lecture 13: P vs NP.
CSCI 2670 Introduction to Theory of Computing
Intro to Theory of Computation
Intro to Theory of Computation
Complexity 6-1 The Class P Complexity Andrei Bulatov.
Time Complexity We use a multitape Turing machine
CS154, Lecture 13: P vs NP.
CS154, Lecture 12: Time Complexity
CS21 Decidability and Tractability
CS21 Decidability and Tractability
Umans Complexity Theory Lectures
CSE 589 Applied Algorithms Spring 1999
Theory of Computability
Intro to Theory of Computation
Presentation transcript:

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011

A CIRCUIT … is a collection of gates and inputs connected by wires. ∧ ⋁ ¬ ⋁ x0x0 x1x1 x2x2 … is satisfiable if some setting of inputs makes it output 1. … can be encoded as a string CIRCUIT-SAT = { 〈 C 〉 : C is a satisfiable circuit }

CIRCUIT-SAT IS DECIDABLE is_satisfiable(C): for each x ∈ {0,1} n : if (circuitValue(C,x)==1): return True else: return False How long does the algorithm take on n-bit inputs? COMPLEXITY THEORY: What problems have efficient algorithms? CIRCUIT-SAT ∈ TIME(2 O(n) )

TIME COMPLEXITY Definition: Let M be a TM that halts on all inputs. The running time or time-complexity of M is the function ƒ : N  N, where ƒ(n) is the maximum number of steps that M uses on any input of length n. Definition: TIME(t(n)) = { L | L is a language decided by a O(t(n)) time Turing Machine }

FAST ALGORITHMS Idea: a problem A is efficiently decidable if A  TIME( ) ?

Theorem: Let t(n) be a function such that t(n)  n. Then every t(n)-time multi-tape TM has an equivalent O(t(n) 2 ) single tape TM COMPUTATIONAL MODELS A = { 0 k 1 k | k  0 }  TIME(n log n) No (single-tape) TM decides A in time o(n log n) A is decidable in time O(n) with a two-tape TM

P = TIME(n c )  c  ℕ IMPORTANT COMPLEXITY CLASS P is the class of problems that can be solved in polynomial time: they are efficiently decidable

WHY P? Many t(n) time variants of TMs can be simulated in time O(t(n) c ) by a single-tape TM, including: TMs with double-unbounded tape: O(t(n)) Multi-tape TMs: O(t 2 (n)) RAM Machines: O(t 6 (n)) Polynomials are the simplest class of functions closed under composition, multiplication, etc… They “grow slowly” compared to exponentials

EXAMPLE: PATH A directed graph with n nodes… is a set of vertices V = {1,2,…,n} and a set of edges E ⊆ VV can be encoded as an adjacency matrix has a path from s to t if there are nodes i 1, …, i k such that { (s,i 1 ), (i 1, i 2 ),…, (i k, t) } ⊆ E. PATH = { 〈 G,s,t 〉 | G has a path from s to t } A ij = 1, if (i,j) ∈ E 0, otherwise

PATH IS IN P has_path(G,s,t): mark s and add it to the queue while the queue is not empty: take v i from the queue for each v j in {1,…, n}: if A ij = 1 and v j is not marked: mark v j and add it to the queue if t is marked: return True else: return False Total RAM Complexity: O(n 2 ) O(1) O(n)

EXAMPLES Show that the following are in P: 3PATH = { 〈 G,s,t 〉 | There is a path of length at most 3 from s to t} E DFA = { 〈 D 〉 | D is a DFA and L(D)=Ø } MEDIAN = { 〈 (y 1,…,y n ),k 〉 | median(y 1,…,y n ) is at least k }

STABLE MARRIAGES A High School has N boys and N girls. Each has a ranked list of dates for the 1951 Senior Prom. Albert BobCharlie Alice Betty Carol B,C,A A,C,B A,B,C B,A,CC,A,BC,B,A An unstable couple prefer each other to their current dates. STABLE = { 〈 B,G 〉 | There is a pairing with no unstable couple}

STABLE MARRIAGES in P Albert BobCharlie Alice Betty Carol B,C,A A,C,B A,B,C B,A,C C,A,B C,B,A 1. Each boy asks his “first choice” to the prom. 2. Each girl “accepts” her best offer – for now. 3. Repeat until everyone has a date: a. Each boy with no date asks the next girl on his list. b. Each girl “accepts” her new best offer – for now. Total Time = O(n 2 )

NON-DETERMINISTIC TMs …are just like standard TMs, except: 1. The machine may proceed according to several possibilities. Formally, the transition function outputs a set of zero or more (state,symbol,direction) choices. 2. The machine accepts a string if there exists a path from start configuration to an accepting configuration 3. The running time of the machine is the length of the longest path to q accept or q reject.

Deterministic Computation Non-Deterministic Computation accept or rejectaccept reject

{ L | L is decided by a O(t(n))-time non-deterministic Turing machine } Definition: NTIME(t(n)) = TIME(t(n))  NTIME(t(n)) NTIME(t(n)) ⊆ TIME(?)

Non-Deterministic Computation accept reject ntm_accepts(M,C): if (current_state(C) = q accept ): return True if (current_state(C) = q reject ): return False for each C’ ∈ M.  (C): if ntm_accepts(M,C’): return True return False Deterministic Computation 2c2c t(n) NTIME(t(n)) ⊆ TIME(2 O(t(n)) )

NON-DETERMINISTIC PROGRAMS …are just like standard programs, except: 1. There is a special instruction, guess(), that can return 0 or The program accepts an input if there exists a list of guesses that make it accept. 3. The running time of the program is the maximum number of steps that can be caused by calls to guess().

NP = NTIME(n c )  c  ℕ

BOOLEAN FORMULAS (  x  y)  z  = logical operations variables parentheses A satisfying assignment is a setting of the variables that makes the formula true x = 1, y = 1, z = 1 is a satisfying assignment for   (x  y)  (z   x) 0010

SAT = {  |  is a satisfiable Boolean formula } A Boolean formula is satisfiable if there exists a satisfying assignment for it  (x  y)  x a  b  c   d YES NO

A 3cnf-formula is of the form: (x 1   x 2  x 3 )  (x 4  x 2  x 5 )  (x 3   x 2   x 1 ) clauses (x 1  x̅ 2  x 1 ) (x 3  x 1 )  (x 3  x̅ 2  x̅ 1 ) (x 1  x 2  x 3 )  (x̅ 4  x 2  x 1 )  (x 3  x 1  x̅ 1 ) (x 1  x̅ 2  x 3 )  (x 3  x̅ 2  x̅ 1 ) YES NO 3SAT = {  |  is a satisfiable 3cnf-formula }

Theorem: 3SAT  NP 3SAT = {  |  is a satisfiable 3cnf-formula } 1. Check if the formula is in 3cnf On input  : 2. For each variable, non-deterministically substitute it with 0 or 1 3. Test if the assignment satisfies  (x  y  x) (  y  )00 (  y  ) 11 (  )000(  )010

Theorem: 3SAT  NP 3SAT = {  |  is a satisfiable 3cnf-formula } 1. Check if the formula is in 3cnf On input  : 2. For each variable x i : 3. Test if the assignment satisfies  a. Set temp = guess(). b. Scan across , replacing x i with temp. Total running time = O(mn)