Non-Deterministic Time

Similar documents
Space Complexity. Master Informatique. Université Paris 5 René Descartes. Master Info. Complexity Space 1/26

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

Introduction to Complexity Theory

Advanced Topics in Theoretical Computer Science

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

Complexity Theory. Knowledge Representation and Reasoning. November 2, 2005

Comp487/587 - Boolean Formulas

Introduction to Advanced Results

Lecture 7: Polynomial time hierarchy

NP-Complete Reductions 1

1. Introduction Recap

CS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP

Polynomial Hierarchy

NP-Completeness. NP-Completeness 1

CISC 4090 Theory of Computation

CSE 135: Introduction to Theory of Computation NP-completeness

SAT, NP, NP-Completeness

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

CSE 548: (Design and) Analysis of Algorithms

Principles of Knowledge Representation and Reasoning

NP Complete Problems. COMP 215 Lecture 20

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

Polynomial-Time Reductions

Lecture 2 (Notes) 1. The book Computational Complexity: A Modern Approach by Sanjeev Arora and Boaz Barak;

Theory of Computation Time Complexity

The Polynomial Hierarchy

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

Quantified Boolean Formulas Part 1

NP-completeness was introduced by Stephen Cook in 1971 in a foundational paper.

NP and Computational Intractability

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.

MTAT Complexity Theory October 20th-21st, Lecture 7

Lecture 8. MINDNF = {(φ, k) φ is a CNF expression and DNF expression ψ s.t. ψ k and ψ is equivalent to φ}

Lecture 4: NP and computational intractability

Introduction to Complexity Theory. Bernhard Häupler. May 2, 2006

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness

NP-Completeness. Algorithmique Fall semester 2011/12

De Morgan s a Laws. De Morgan s laws say that. (φ 1 φ 2 ) = φ 1 φ 2, (φ 1 φ 2 ) = φ 1 φ 2.

NP Completeness and Approximation Algorithms

Theory of Computation Chapter 9

CS Lecture 28 P, NP, and NP-Completeness. Fall 2008

NP-Completeness. Subhash Suri. May 15, 2018

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

Lecture 19: Finish NP-Completeness, conp and Friends

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Lecture 7: The Polynomial-Time Hierarchy. 1 Nondeterministic Space is Closed under Complement

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P

Intro to Theory of Computation

A An Overview of Complexity Theory for the Algorithm Designer

1 PSPACE-Completeness

satisfiability (sat) Satisfiability unsatisfiability (unsat or sat complement) and validity Any Expression φ Can Be Converted into CNFs and DNFs

: Computational Complexity Lecture 3 ITCS, Tsinghua Univesity, Fall October 2007

Computational Complexity

Lecture 9: Polynomial-Time Hierarchy, Time-Space Tradeoffs

COMPLEXITY THEORY. Lecture 17: The Polynomial Hierarchy. TU Dresden, 19th Dec Markus Krötzsch Knowledge-Based Systems

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

The Cook-Levin Theorem

Correctness of Dijkstra s algorithm

CS154, Lecture 13: P vs NP

Polynomial time reduction and NP-completeness. Exploring some time complexity limits of polynomial time algorithmic solutions

NP-completeness. Chapter 34. Sergey Bereg

Lecture 18: More NP-Complete Problems

Polynomial-time Reductions

Essential facts about NP-completeness:

Introduction. Pvs.NPExample

Algorithm Design and Analysis

CSC 373: Algorithm Design and Analysis Lecture 15

1.1 P, NP, and NP-complete

CS154, Lecture 13: P vs NP

Limitations of Algorithm Power

Search and Optimization Problems. CSE 548: (Design and) Analysis of Algorithms. Hard Problems: Where you find yourself...

Show that the following problems are NP-complete

P = k T IME(n k ) Now, do all decidable languages belong to P? Let s consider a couple of languages:

NP-Completeness and Boolean Satisfiability

6-1 Computational Complexity

COMP Analysis of Algorithms & Data Structures

8. INTRACTABILITY I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 2/6/18 2:16 AM

Complete problems for classes in PH, The Polynomial-Time Hierarchy (PH) oracle is like a subroutine, or function in

Space is a computation resource. Unlike time it can be reused. Computational Complexity, by Fu Yuxi Space Complexity 1 / 44

Umans Complexity Theory Lectures

Compendium of Parameterized Problems at Higher Levels of the Polynomial Hierarchy

CS 5114: Theory of Algorithms

CS 583: Algorithms. NP Completeness Ch 34. Intractability

Discrete Optimization 2010 Lecture 10 P, N P, and N PCompleteness

Computational complexity

ECE 695 Numerical Simulations Lecture 2: Computability and NPhardness. Prof. Peter Bermel January 11, 2017

CSE 3500 Algorithms and Complexity Fall 2016 Lecture 25: November 29, 2016

Tecniche di Verifica. Introduction to Propositional Logic

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010

LOGIC PROPOSITIONAL REASONING

CS 5114: Theory of Algorithms. Tractable Problems. Tractable Problems (cont) Decision Problems. Clifford A. Shaffer. Spring 2014

Chapter 34: NP-Completeness

Complexity: moving from qualitative to quantitative considerations

Theory of Computation CS3102 Spring 2015 A tale of computers, math, problem solving, life, love and tragic death

A brief introduction to Logic. (slides from

The Complexity of Maximum. Matroid-Greedoid Intersection and. Weighted Greedoid Maximization

CS 512, Spring 2017, Handout 10 Propositional Logic: Conjunctive Normal Forms, Disjunctive Normal Forms, Horn Formulas, and other special forms

Transcription:

Non-Deterministic Time Master Informatique 2016 1 Non-Deterministic Time Complexity Classes Reminder on DTM vs NDTM [Turing 1936] (q 0, x 0 ) (q 1, x 1 ) Deterministic (q n, x n ) Non-Deterministic (q m, x m ) (q 0, x 0 ) (q 1, x 1 ) (q k, x k ) (q n, x n ) (q o, x o ) (q p, x p ) Intuition on Solving an Exponential Problem...... with DTM Linear calculations since is a 1 to 1 mapping from configurations to transitions Exponential number of steps cannot be avoided... with NDTM The tree structure can simulate parallel computing The solving time is the length of the longest branch of the tree COULD BE polynomial (no guarantee in general) When it stays exponential, it COULD BE smaller exponential (e.g. O(2 n ) steps instead of O(10 n )) 1

Really Naive Example Solving an Equation... Does f(n) = 0 have a solution, with n [0, 1,, 10 9 ]?... with DTM Compute f(0). If it works, fine, otherwise compute f(1), then f(2), Not efficient: if the solutions of the equation are huge (e.g. 10 9 ), then a lot of useless calculations are made... with NDTM Compute f(i) on the i th branch of the tree, with 0 i 10 9 Whatever the solution of the problem, it is obtained in the time of a «single» f(i) computation Non-Deterministic Complexity Classes Evaluating Time with NDTM Given a function f : N N, NTIME(f(n)) is the set of all languages recognized by a NDTM M in less than g(n) steps (longer branch), with g(n) O(f(n)) Closeness under com- f : N N, then DTIME(f(n)) NTIME(f(n)) f(n) n, NTIME(f(n)) is closed for finite union and finite intersection if L 1,, L m NTIME(f(n)), then L 1 L m NTIME(f(n)) if L 1,, L m NTIME(f(n)), then L 1 L m NTIME(f(n)) plement is an open question. The answer is mainly assumed to be «no» Hierarchy Theorem Same intuition as deterministic time: «more time, more problems can be solved» Theorem [Cook 1972, Seiferas et al 1978] Given f : N N s.t. n, f(n) 0, and g : N N a time-constructible increasing function. If f(n + 1) o(g(n)), then NTIME(f(n)) NTIME(g(n)) Polynomial vs Exponential Time The complexity class NP is the set of languages recognized in polynomial time by a NDTM, i.e NP = k N NTIME(n k ) The complexity class NEXP is the set of languages recognized in exponential time by a NDTM, i.e NEXP = k N NTIME(2 nk ) Theorem P NP EXP NEXP Moreover, P EXP, NP NEXP. P = NP, NP = EXP or EXP = NEXP are open questions: Millennium Prize Problems Examples of Problems in NP Clique Input: G a graph, k N Problem: Does G contain a clique with size k? Subset Sum Input: {a 1,, a n } N, k N Problem: Is there a subset S {a 1,, a n } s.t. x S x = k? 2

2 Polynomial Hierarchy Complement of a Class Given a complexity class C, its complement coc is defined by coc = { P P C} For complexity classes C defined with DTM, coc = C Important Complement Class conp is the complement complexity class of NP Examples of Problems in conp No Clique Input: G a graph, k N Problem: Does G contain no clique with size k? Why determining if a graph has a k-clique has not the same complexity than proving that it has no k-clique? To accept an instance of Clique: just exhibit one example of a k-clique to answer YES To accept an instance of No Clique: you have to check every k-subgraph G and check if it s a clique Relations between P, NP, conp Theorem but NP = / conp is still an open question P NP and P conp Idea of the polynomial hierarchy: defined generalized complexity classes with similar inclusion pattern Oracle Machines Given C 1, C 2 two complexity classes, C C2 1 is the set of all problems which can be solved by a Turing machine from the class C 1 with an oracle from the class C 2 oracle of class C 2 : abstract entity which can solve in one step a problem from C 2 Example A problem belongs to P NP if it can be solved by a DTM with polynomially many calls to a NP oracle (i.e. a polynomial NDTM) Polynomial Hierarchy [Stockmeyer 1976] The polynomial hierarchy is the set if complexity classes defined recursively by P 0 = Σ P 0 = Π P 0 = P P k+1 = PΣP k Σ P k+1 = NPΣP k Π P k+1 = conpσp k 3

conp Π P 2 Π P 3 P P 2 P 3 NP Σ P 2 Σ P 3 C 1 C 2 means that C 1 C 2 PH = i N ΣP i Relative Hardness of Problems Polynomial-Time Functional Reduction A polynomial-time functional reduction f is a total computable function from a problem P 1 to a problem P 2 such that, for any instance i of P 1, f(i) can be computed in polynomial-time in the size of i i is a positive instance of P 1 iff f(i) is a positive instance of P 2 Notation: P 1 P f P 2 C-hardness A problem P is C-hard iff for each P C, P P f P Intuition: P is at least as hard to solve as every problem from C Completeness C-completeness A problem P is C-complete iff it is C-hard and P C Intuition: P is one of the hardest problems from C A lot of interesting AI problems are complete for NP, conp, Σ P 2 or Π P 2 3 Complexity of Well-Known Problems 3.1 SAT and Related Problems SAT Syntax and Semantics of al Logic V = {x 1,, x n } a set of Boolean variables C = {,, } a set of connectives A well formed formula (wff) φ is: an atom: φ = x i the negation of a wff: φ = ψ the conjunction of two wffs: φ = ψ 1 ψ 2 the disjunction of two wffs: φ = ψ 1 ψ 2 Interpretation ω : V B = {0, 1} Semantics of connectives: ω( ψ) = 1 ω(ψ) ω(ψ 1 ψ 2 ) = min(ω(ψ 1 ), ω(ψ 2 )) ω(ψ 1 ψ 2 ) = max(ω(ψ 1 ), ω(ψ 2 )) ω = φ iff ω(φ) = 1 4

SAT Complexity Theorem [Cook 1971] Given a propositional formula φ, the SAT problem consists in determining whether φ is consistent, i.e. whether φ has a model. SAT is NP-complete. General knowledge: SAT is the first problem which has been proved NP-complete. The power of propositional logic to express a lot of «real» problems (solving games, planning, ) has led to the development of quite efficient methods to solve NP-complete problems. But even these methods do not allow to solve ALL instances of NP-complete problems. Normal Forms A literal l is either a variable x or its negation x A clause is a disjunction of literals l 1 l n A cube is a conjunction of literals l 1 l n Conjunctive Normal Form A formula is in CNF if it is a conjunction of clauses Disjunctive Normal Form A formula is in DNF if it is a disjunction of cubes Complexity of SAT with Normal Forms CNF-SAT Any formula can be transformed in an equivalent CNF formula The transformation can be done in polynomial time Solving CNF-SAT is NP-complete DNF-SAT Any formula can be transformed in an equivalent DNF formula Solving DNF-SAT is polynomial The transformation cannot be done in polynomial time :( Tractable Classes 2SAT A binary clause is a clause with two literals: l 1 l 2 A 2CNF is a CNF formula with only binary clauses Complexity of 2SAT Determining if a 2CNF formula is satisfiable is in P Tractable Classes Horn-SAT A Horn clause is a clause with at most one positive literal: x 1 x 2 x n A Horn formula (or Horn CNF) is a CNF formula with only Horn clauses Complexity of Horn-SAT Determining if a Horn formula is satisfiable is in P 5

Quantified Boolean Formula A canonical QBF is a formula Q 1 X 1, Q 2 X 2, Q n X n, φ with Q i {, } and Q i Q i+1 X 1, X n form a partition of the Boolean variables in φ φ is a propositional formula E.g. x 1, x 3, x 2, ( x 1 x 2 ) ( x 3 x 2 ) n QBF is the decision problem: is the QBF X 1, X 2, Q n X n, φ true? n QBF is the decision problem: is the QBF X 1, X 2, Q n X n, φ true? Complexity of n QBF n QBF is Σ P n -complete Complexity of n QBF n QBF is Π P n -complete 3.2 Other Problems Set Packing Given a universe U and S 2 U, a set packing of U is a subset C S s.t. all elements in C are pairwise disjoints Theorem [Karp 1972] Given U, S and k N, determining whether there is a set packing C s.t. C = k is NP-complete Knapsack Problem Given a list of objects x 1,, x n, each of them associated with a value v 1,, v n and a weight w 1,, w n, a knapsack with a maximal weight W, and an integer V, is it possible to fill the bag with some of the objects, such that the sum of the weights is lesser than W and the sum of the values is greater than V? Theorem Solving the Knapsack Problem is NP-complete Kernel of a Graph A graph is a pair G = N, E where elements of N are called nodes and E N N is the set of edges between the nodes. A kernel of G is a subset K N s.t. n i, n j K, (n i, n j ) / E and n j N \ K, n i K s.t. (n i, n j ) E Theorem [Creignou 1995] Given a graph G, determining whether G has a kernel is NP-complete. Shortest Implicant An implicant of a formula φ is a conjunction of literals c = x 1 x n s.t. c φ. Theorem [Umans 2001] Given a formula φ and k N, determining whether φ has an implicant c s.t. c k is Σ P 2 -complete More Information on Complexity of Problems [Garey and Johnson 1979]: One of the most well-known book on the topic, a lot of classical results [Schaefer and Umans 2002a, Schaefer and Umans 2002b]: More recent collection of results 6

4 Determining the Complexity of a Problem Bounds of Complexity In some cases, it s not easy to determine precisely the complexity of a problem, but we can give lower/upper bounds. Lower bound: C-hardness. E.g. if P is NP-hard, P is at least as hard as SAT Upper bound: C membership. E.g. if P Σ P 2, P is at most as hard as Shortest Implicant problem. Exact complexity: C-completeness Prove C-completeness: prove hardness (c.f. polynomial functional reductions) + prove membership Certificate A certificate (also called a witness) is a word that certifies the answer to a computation, or certifies the membership of some word in a language. Example P = Given a polynomial P, has P at least one root?. The instance P (x) = x 2 can be verified with the certificate x = 0: P (0) = 0. x = 0 is a certificate that P is a positive instance of P P = Given a polynomial P, is P (x) positive for all x? The instance P (x) = x 2 2 can be verified with the certificate x = 1: P ( 1) = ( 1) 2 2 = 1 2 = 1 < 0. x = 1 is a certificate that P is a negative instance of P Proving C-Membership with a Certificate Let P be a problem. Given an instance x of P and a certificate c, if the problem is in Π P i 1, then P ΣP i P : «Is c a proof that x is a positive instance of P?» Let P be a problem. Given an instance x of P and a certificate c, if the problem is in Σ P i 1, then P ΠP i NP and conp Membership P : «Is c a proof that x is a negative instance of P?» Let P be a problem. Given an instance x of P and a certificate c, if the problem is in P, then P NP P : «Is c a proof that x is a positive instance of P?» Let P be a problem. Given an instance x of P and c a certificate, if the problem is in P, then P conp P : «Is c a proof that x is a negative instance of P?» NP: Problems where checking a solution is easy conp: Problems where checking a counter-example is easy 7

Example Proving that Graph Kernel NP A kernel of G = N, E is a subset K N s.t. n i, n j K, (n i, n j ) / E and n j N \ K, n i K s.t. (n i, n j ) E Given a set of nodes K of a graph G = N, E, it is polynomial to determine whether K is a kernel of G Proof The algorithm to check if K is a kernel of G is polynomial: For all x, y K, check whether (x, y) / E: K 2 operations (O(n 2 )) For all y N \ K, check whether x K s.t. (x, y) E: N \ K K operations (O(n 2 )) Upper Bound through Reduction Instead of certificates, reductions can be used to give an upper bound complexity. Graph Kernel We define the Boolean variables V = {v x x N}. The set K is a kernel of the graph G iff V K = {v x V x K} is a model of the formula φ Kernel = [v x ( v y )] x N y N,(y,x) E The reduction from Graph Kernel to SAT is polynomial: the size of φ Kernel is polynomial in N ; an algorithm to build φ Kernel from G is O(n 2 ) References Références [Turing 1936] A. M. Turing, On computable numbers, with an application to the Entscheidungsproblem. Proceedings of the London Mathematical Society, 1936. [Cook 1972] S. A. Cook, A Hierarchy for Nondeterministic Time Complexity. STOC, 187 192, 1972. [Seiferas et al 1978] J. I. Seiferas, M. J. Fischer and A. R. Meyer, Separating Non-deterministic Time Complexity Classes. J. ACM, 25.1, 146 167, 1978. [Stockmeyer 1976] L. J. Stockmeyer, The polynomial-time hierarchy. Theoretical Computer Science, 3, 1 22, 1976. References Références [Cook 1971] S. A. Cook, The Complexity of Theorem-Proving Procedures. Proc. of the Third Annual Symposium on Theory of Computing, 151 158, 1971. [Karp 1972] R. M. Karp, Reducibility Among Combinatorial Problems. Proc. of Symposium on the Complexity of Computer Computations, 85 103, 1972. [Creignou 1995] N. Creignou, The Class of Problems That are Linearly Equivalent to Satisfiability or a Uniform Method for Proving NP-Completeness. Theoretical Computer Science, 145, 111 145, 1995. [Umans 2001] C. Umans, The Minimum Equivalent DNF Problem and Shortest Implicants. J. Comput. Syst. Sci., 63, 597 611, 2001. References 8

Références [Garey and Johnson 1979] M. R. Garey and D. S. Johnson, Computers and Intractability: A Guide to the Theory of NP-Completeness. Freeman, 1979. [Schaefer and Umans 2002a] M. Schaefer and C. Umans, Completeness in the Polynomial-Time Hierarchy: A Compendium. Sigact News September, 2002. [Schaefer and Umans 2002b] M. Schaefer and C. Umans, Completeness in the Polynomial-Time Hierarchy: Part II. Sigact News December, 2002. 9