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

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

Complexity Theory 112. Space Complexity

Computability and Complexity CISC462, Fall 2018, Space complexity 1

Space Complexity. then the space required by M on input x is. w i u i. F ) on. September 27, i=1

Review of Basic Computational Complexity

CMPT 710/407 - Complexity Theory Lecture 4: Complexity Classes, Completeness, Linear Speedup, and Hierarchy Theorems

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes

Introduction to Complexity Classes. Marcin Sydow

CS5371 Theory of Computation. Lecture 23: Complexity VIII (Space Complexity)

Polynomial Time Computation. Topics in Logic and Complexity Handout 2. Nondeterministic Polynomial Time. Succinct Certificates.

Lecture 16: Time Complexity and P vs NP

Turing-Computable Functions

COMPLEXITY THEORY. PSPACE = SPACE(n k ) k N. NPSPACE = NSPACE(n k ) 10/30/2012. Space Complexity: Savitch's Theorem and PSPACE- Completeness

Lecture 21: Space Complexity (The Final Exam Frontier?)

CS154, Lecture 17: conp, Oracles again, Space Complexity

Could we potentially place A in a smaller complexity class if we consider other computational models?

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

Space Complexity. The space complexity of a program is how much memory it uses.

Cantor s Theorem. Theorem 7 The set of all subsets of N (2 N ) is infinite and not countable.

CS5371 Theory of Computation. Lecture 23: Complexity VIII (Space Complexity)

1 PSPACE-Completeness

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

Advanced Topics in Theoretical Computer Science

Finish K-Complexity, Start Time Complexity

Time Complexity. Definition. Let t : n n be a function. NTIME(t(n)) = {L L is a language decidable by a O(t(n)) deterministic TM}

Randomized Complexity Classes; RP

Introduction to Computational Complexity

Notes on Complexity Theory Last updated: December, Lecture 2

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

Theory of Computation Lecture Notes. Problems and Algorithms. Class Information

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?

The knapsack Problem

CS151 Complexity Theory. Lecture 4 April 12, 2017

Space Complexity. Huan Long. Shanghai Jiao Tong University

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.

Lecture 20: PSPACE. November 15, 2016 CS 1010 Theory of Computation

CS151 Complexity Theory. Lecture 1 April 3, 2017

The Polynomial Hierarchy

CS154, Lecture 13: P vs NP

Theory of Computation Space Complexity. (NTU EE) Space Complexity Fall / 1

Theory of Computation. Ch.8 Space Complexity. wherein all branches of its computation halt on all

Computability and Complexity Theory: An Introduction

The space complexity of a standard Turing machine. The space complexity of a nondeterministic Turing machine

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

The Complexity of Optimization Problems

conp, Oracles, Space Complexity

Lecture Notes Each circuit agrees with M on inputs of length equal to its index, i.e. n, x {0, 1} n, C n (x) = M(x).

Definition: conp = { L L NP } What does a conp computation look like?

CS154, Lecture 13: P vs NP

Outline. Complexity Theory. Example. Sketch of a log-space TM for palindromes. Log-space computations. Example VU , SS 2018

Lecture 22: PSPACE

DRAFT. Diagonalization. Chapter 4

Tecniche di Verifica. Introduction to Propositional Logic

6.045 Final Exam Solutions

P vs. NP Classes. Prof. (Dr.) K.R. Chowdhary.

Notes for Lecture Notes 2

Chapter 7: Time Complexity

Non-Deterministic Time

Notes for Lecture 3... x 4

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

A.Antonopoulos 18/1/2010

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

max bisection max cut becomes max bisection if we require that It has many applications, especially in VLSI layout.

Umans Complexity Theory Lectures

Ma/CS 117c Handout # 5 P vs. NP

Technische Universität München Summer term 2010 Theoretische Informatik August 2, 2010 Dr. J. Kreiker / Dr. M. Luttenberger, J. Kretinsky SOLUTION

The Traveling Salesman Problem

Announcements. Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved!

Polynomial Hierarchy

Lecture 17: Cook-Levin Theorem, NP-Complete Problems

Computational Complexity

Review of unsolvability

MTAT Complexity Theory October 13th-14th, Lecture 6

CSE 135: Introduction to Theory of Computation NP-completeness

Exam Computability and Complexity

Comp487/587 - Boolean Formulas

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT

CSCI3390-Second Test with Solutions

Hierarchy theorems. Evgenij Thorstensen V18. Evgenij Thorstensen Hierarchy theorems V18 1 / 18

CSCI 1590 Intro to Computational Complexity

About the relationship between formal logic and complexity classes

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

A brief introduction to Logic. (slides from

Theory of Computation Lecture Notes

Computational complexity

Principles of Knowledge Representation and Reasoning

Lecture 7: Polynomial time hierarchy

TIME COMPLEXITY AND POLYNOMIAL TIME; NON DETERMINISTIC TURING MACHINES AND NP. THURSDAY Mar 20

CSE200: Computability and complexity Space Complexity

Complexity (Pre Lecture)

SOLUTION: SOLUTION: SOLUTION:

Computational Complexity: A Modern Approach. Draft of a book: Dated January 2007 Comments welcome!

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

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

Advanced topic: Space complexity

1 Computational Problems

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

1 Circuit Complexity. CS 6743 Lecture 15 1 Fall Definitions

Transcription:

Any Expression φ Can Be Converted into CNFs and DNFs φ = x j : This is trivially true. φ = φ 1 and a CNF is sought: Turn φ 1 into a DNF and apply de Morgan s laws to make a CNF for φ. φ = φ 1 and a DNF is sought: Turn φ 1 into a CNF and apply de Morgan s laws to make a DNF for φ. φ = φ 1 φ 2 and a DNF is sought: Make φ 1 and φ 2 DNFs. φ = φ 1 φ 2 and a CNF is sought: Let φ 1 = n 1 i=1 A i and φ 2 = n 2 i=1 B i be CNFs. Set φ = n 1 n2 i=1 j=1 (A i B j ). φ = φ 1 φ 2 : Similar to above. satisfiability (sat) The length of a boolean expression is the length of the string encoding it. satisfiability (sat): Given a CNF φ, is it satisfiable? Solvable in time O(n 2 2 n ) on a TM by the truth table method. Solvable in polynomial time on an NTM, hence in NP (p. 84). A most important problem in answering the P = NP problem (p. 237). c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 143 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 145 Satisfiability A boolean expression φ is satisfiable if there is a truth assignment T appropriate to it such that T = φ. φ is valid or a tautology, a written = φ, if T = φ for all T appropriate to φ. φ is unsatisfiable if and only if φ is false under all appropriate truth assignments if and only if φ is valid. a Wittgenstein (1889 1951) in 1922. Wittgenstein is one of the most important philosophers of all time. God has arrived, the great economist Keynes (1883 1946) said of him on January 18, 1928. I met him on the 5:15 train. unsatisfiability (unsat or sat complement) and validity unsat (sat complement): Given a boolean expression φ, is it unsatisfiable? validity: Given a boolean expression φ, is it valid? φ is valid if and only if φ is unsatisfiable. So unsat and validity have the same complexity. Both are solvable in time O(n 2 2 n ) on a TM by the truth table method. c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 144 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 146

Relations among sat, unsat, and validity Boolean Functions (continued) A boolean expression expresses a boolean function. Think of its truth value under all truth assignments. The negation of an unsatisfiable expression is a valid expression. None of the three problems satisfiability, unsatisfiability, validity are known to be in P. A boolean function expresses a boolean expression. T = φ, literal y i is true under T (y 1 y n ). y 1 y n is the minterm over {x 1,...,x n } for T. The length a is n2 n 2 2n. In general, the exponential length in n cannot be avoided (p. 156)! a We count the logical connectives here. c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 147 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 149 Boolean Functions An n-ary boolean function is a function f : {true,false} n {true,false}. It can be represented by a truth table. There are 2 2n such boolean functions. Each of the 2 n truth assignments can make f true or false. Boolean Functions (concluded) x 1 x 2 f(x 1, x 2 ) 0 0 1 0 1 1 1 0 0 1 1 1 The corresponding boolean expression: ( x 1 x 2 ) ( x 1 x 2 ) (x 1 x 2 ). c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 148 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 150

Boolean Circuits and Expressions Boolean Circuits A boolean circuit is a graph C whose nodes are the gates. There are no cycles in C. They are equivalent representations. One can construct one from the other: All nodes have indegree (number of incoming edges) equal to 0, 1, or 2. Each gate has a sort from {true,false,,,, x 1, x 2,...}. c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 151 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 153 An Example Boolean Circuits (concluded) Gates of sort from {true,false, x 1, x 2,...} are the inputs of C and have an indegree of zero. The output gate(s) has no outgoing edges. A boolean circuit computes a boolean function. The same boolean function can be computed by infinitely many boolean circuits. ( Circuits are more economical because of the possibility of sharing. c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 152 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 154

circuit sat and circuit value circuit sat: Given a circuit, is there a truth assignment such that the circuit outputs true? n+5 choices circuit value: The same as circuit sat except that the circuit has no variable gates. circuit sat NP: Guess a truth assignment and then evaluate the circuit. circuit value P: Evaluate the circuit from the input gates gradually towards the output gate. mchoices m choices c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 155 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 157 Some Boolean Functions Need Exponential Circuits a Theorem 15 (Shannon (1949)) For any n 2, there is an n-ary boolean function f such that no boolean circuits with 2 n /(2n) or fewer gates can compute it. There are 2 2n different n-ary boolean functions. There are at most ((n + 5) m 2 ) m boolean circuits with m or fewer gates (see next page). But ((n + 5) m 2 ) m < 2 2n when m = 2 n /(2n). m log 2 ((n + 5) m 2 ) = 2 n (1 log 2 4n 2 n+5 2n ) < 2 n for n 2. a Can be strengthened to almost all boolean functions... Comments The lower bound is rather tight because an upper bound is n2 n (p. 149). In the proof, we counted the number of circuits. Some circuits may not be valid at all. Others may compute the same boolean functions. Both are fine because we only need an upper bound. We do not need to consider the outdoing edges because they have been counted in the incoming edges. c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 156 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 158

Examples of Proper Functions Most reasonable functions are proper: c, log n, polynomials of n, 2 n, n, n!, etc. If f and g are proper, then so are f + g, fg, and 2 g. Relations between Complexity Classes Nonproper functions when serving as the time bounds for complexity classes spoil the theory building. For example, TIME(f(n)) = TIME(2 f(n) ) for some recursive function f (the gap theorem). a Only proper functions f will be used in TIME(f(n)), SPACE(f(n)), NTIME(f(n)), and NSPACE(f(n)). a Trakhtenbrot (1964); Borodin (1972). c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 159 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 161 Proper (Complexity) Functions We say that f : N N is a proper (complexity) function if the following hold: f is nondecreasing. There is a k-string TM M f such that M f (x) = f( x ) for any x. a M f halts after O( x + f( x )) steps. M f uses O(f( x )) space besides its input x. M f s behavior depends only on x not x s contents. M f s running time is basically bounded by f(n). a This point will become clear in Proposition 16 on p. 164. Space-Bounded Computation and Proper Functions In the definition of space-bounded computations, the TMs are not required to halt at all. When the space is bounded by a proper function f, computations can be assumed to halt: Run the TM associated with f to produce an output of length f(n) first. The space-bound computation must repeat a configuration if it runs for more than c n+f(n) steps for some c (p. 183). So we can count steps to prevent infinite loops. c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 160 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 162

Precise Turing Machines A TM M is precise if there are functions f and g such that for every n N, for every x of length n, and for every computation path of M, M halts after precise f(n) steps, and All of its strings are of length precisely g(n) at halting. If M is a TM with input and output, we exclude the first and the last strings. If f is a time bound: The Proof (continued) The simulation of each step of M on x is matched by advancing the cursor on the clock string. M stops at the moment the clock string is exhausted even if M(x) stops before that time. The time bound is therefore O( x + f( x )). M can be deterministic or nondeterministic. c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 163 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 165 Precise TMs Are General Proposition 16 Suppose a TM a M decides L within time (space) f(n), where f is proper. Then there is a precise TM M which decides L in time O(n + f(n)) (space O(f(n)), respectively). M on input x first simulates the TM M f associated with the proper function f on x. M f s output of length f( x ) will serve as a yardstick or an alarm clock. a It can be deterministic or nondeterministic. If f is a space bound: The Proof (concluded) M simulates on M f s output string. The total space, not counting the input string, is O(f(n)). c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 164 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 166

Complements of Nondeterministic Classes Important Complexity Classes We write expressions like n k to denote the union of all complexity classes, one for each value of k. For example, NTIME(n k ) = j>0ntime(n j ). From p. 128, we know R, RE, and core are distinct. core contains the complements of languages in RE, not the languages not in RE. Recall that the complement of L, denoted by L, is the language Σ L. sat complement is the set of unsatisfiable boolean expressions. hamiltonian path complement is the set of graphs without a Hamiltonian path. c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 167 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 169 Important Complexity Classes (concluded) P = TIME(n k ), NP = NTIME(n k ), PSPACE = SPACE(n k ), NPSPACE = NSPACE(n k ), E = TIME(2 kn ), EXP = TIME(2 nk ), L = SPACE(log n), NL = NSPACE(log n). The Co-Classes For any complexity class C, coc denotes the class { L : L C}. Clearly, if C is a deterministic time or space complexity class, then C = coc. They are said to be closed under complement. A deterministic TM deciding L can be converted to one that decides L within the same time or space bound by reversing the yes and no states. Whether nondeterministic classes for time are closed under complement is not known (p. 82). c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 168 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 170

Comments Then coc is the class { L : L C}. So L C if and only if L coc. But it is not true that L C if and only if L coc. coc is not defined as C. For example, suppose C = {{2, 4, 6, 8, 10,...}}. Then coc = {{1, 3, 5, 7, 9,...}}. But C = 2 {1,2,3,...} {{2, 4, 6, 8, 10,...}}. H f TIME(f(n) 3 ) For each input M; x, we simulate M on x with an alarm clock of length f( x ). Use the single-string simulator (p. 66), the universal TM (p. 116), and the linear speedup theorem (p. 71). Our simulator accepts M; x if and only if M accepts x before the alarm clock runs out. From p. 70, the total running time is O(l M k 2 M f(n)2 ), where l M is the length to encode each symbol or state of M and k M is M s number of strings. As l M k 2 M = O(n), the running time is O(f(n)3 ), where the constant is independent of M. c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 171 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 173 The Quantified Halting Problem Let f(n) n be proper. Define H f = {M; x : M accepts input x after at most f( x ) steps}, where M is deterministic. Assume the input is binary. H f TIME(f( n/2 )) Suppose TM M Hf decides H f in time f( n/2 ). Consider machine D f (M): if M Hf (M; M) = yes then no else yes D f on input M runs in the same time as M Hf on input M; M, i.e., in time f( 2n+1 2 ) = f(n), where n = M. a a A student pointed out on October 6, 2004, that this estimation omits the time to write down M; M. c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 172 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 174

The Proof (concluded) First, D f (D f ) = yes D f ; D f H f D f does not accept D f within time f( D f ) D f (D f ) = no a contradiction The Space Hierarchy Theorem Theorem 19 (Hennie and Stearns (1966)) If f(n) is proper, then SPACE(f(n)) SPACE(f(n) log f(n)). Corollary 20 L PSPACE. Similarly, D f (D f ) = no D f (D f ) = yes. c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 175 c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 177 The Time Hierarchy Theorem Theorem 17 If f(n) n is proper, then TIME(f(n)) TIME(f(2n + 1) 3 ). The quantified halting problem makes it so. Corollary 18 P EXP. P TIME(2 n ) because poly(n) 2 n for n large enough. But by Theorem 17, TIME(2 n ) TIME((2 2n+1 ) 3 ) TIME(2 n2 ) EXP. c 2004 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 176