CS151 Complexity Theory. Lecture 1 April 3, 2017

Similar documents
Umans Complexity Theory Lectures

CS21 Decidability and Tractability

The purpose here is to classify computational problems according to their complexity. For that purpose we need first to agree on a computational

Q = Set of states, IE661: Scheduling Theory (Fall 2003) Primer to Complexity Theory Satyaki Ghosh Dastidar

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

Theory of Computation

Lecture 16: Time Complexity and P vs NP

TURING MAHINES

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan August 30, Notes for Lecture 1

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

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

Turing Machine Recap

Finish K-Complexity, Start Time Complexity

Theory of Computation Time Complexity

Review of unsolvability

CS154, Lecture 13: P vs NP

NP, polynomial-time mapping reductions, and NP-completeness

Turing Machines. Lecture 8

Time-bounded computations

Essential facts about NP-completeness:

More Turing Machines. CS154 Chris Pollett Mar 15, 2006.

Computability Theory. CS215, Lecture 6,

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

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k.

CS154, Lecture 13: P vs NP

Notes for Lecture 3... x 4

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Design and Analysis of Algorithms

Harvard CS 121 and CSCI E-121 Lecture 20: Polynomial Time

Lecture 24: Randomized Complexity, Course Summary

Complexity: moving from qualitative to quantitative considerations

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

Exam Computability and Complexity

Great Theoretical Ideas in Computer Science. Lecture 7: Introduction to Computational Complexity

1 Circuit Complexity. CS 6743 Lecture 15 1 Fall Definitions

Advanced topic: Space complexity

6-1 Computational Complexity

Notes for Lecture Notes 2

NP-Completeness and Boolean Satisfiability

Lecture 12: Mapping Reductions

CSCI3390-Lecture 14: The class NP

Theory of Computation

CS294: Pseudorandomness and Combinatorial Constructions September 13, Notes for Lecture 5

1 Computational problems

Turing Machines and Time Complexity

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

Notes on Complexity Theory Last updated: December, Lecture 2

Computational complexity

1 Computational Problems

CSCE 551 Final Exam, Spring 2004 Answer Key

CS151 Complexity Theory

Lecture 3: Reductions and Completeness

7.1 The Origin of Computer Science

Computer Sciences Department

CSC 5170: Theory of Computational Complexity Lecture 5 The Chinese University of Hong Kong 8 February 2010

Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

conp, Oracles, Space Complexity

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

CSE 105 THEORY OF COMPUTATION

Turing Machine Variants

Time Complexity (1) CSCI Spring Original Slides were written by Dr. Frederick W Maier. CSCI 2670 Time Complexity (1)

On the Computational Hardness of Graph Coloring

1 Showing Recognizability

Lecture 25: Cook s Theorem (1997) Steven Skiena. skiena

ENEE 459E/CMSC 498R In-class exercise February 10, 2015

Definition: Alternating time and space Game Semantics: State of machine determines who

Acknowledgments 2. Part 0: Overview 17

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

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

CSE 135: Introduction to Theory of Computation NP-completeness

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

Intro to Theory of Computation

Chapter 3: The Church-Turing Thesis

Complexity Theory Part I

NP-Completeness. Algorithmique Fall semester 2011/12

Introduction to Turing Machines

Artificial Intelligence. 3 Problem Complexity. Prof. Dr. Jana Koehler Fall 2016 HSLU - JK

Decidability and Undecidability

Comparison of several polynomial and exponential time complexity functions. Size n

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

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

The Cook-Levin Theorem

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

The Church-Turing Thesis

CMSC 441: Algorithms. NP Completeness

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

Computability and Complexity

CS20a: Turing Machines (Oct 29, 2002)

CSCI 1590 Intro to Computational Complexity

Part I: Definitions and Properties

Decidability: Church-Turing Thesis

CS6901: review of Theory of Computation and Algorithms

CS3719 Theory of Computation and Algorithms

Undecidability and Rice s Theorem. Lecture 26, December 3 CS 374, Fall 2015

COMPUTATIONAL COMPLEXITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

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

Lecture Notes: The Halting Problem; Reductions

Transcription:

CS151 Complexity Theory Lecture 1 April 3, 2017

Complexity Theory Classify problems according to the computational resources required running time storage space parallelism randomness rounds of interaction, communication, others Attempt to answer: what is computationally feasible with limited resources? April 3, 2017 2

Complexity Theory Contrast with decidability: What is computable? answer: some things are not We care about resources! leads to many more subtle questions fundamental open problems April 3, 2017 3

The central questions Is finding a solution as easy as recognizing one? P = NP? Is every efficient sequential algorithm parallelizable? P = NC? Can every efficient algorithm be converted into one that uses a tiny amount of memory? P = L? Are there small Boolean circuits for all problems that require exponential running time? EXP P/poly? Can every efficient randomized algorithm be converted into a deterministic algorithm one? P = BPP? April 3, 2017 4

Central Questions We think we know the answers to all of these questions but no one has been able to prove that even a small part of this world-view is correct. If we re wrong on any one of these then computer science will change dramatically April 3, 2017 5

Introduction You already know about two complexity classes P = the set of problems decidable in polynomial time NP = the set of problems with witnesses that can be checked in polynomial time and notion of NP-completeness Useful tool Deep mathematical problem: P = NP? Course should be both useful and mathematically interesting April 3, 2017 6

A question Given: polynomial f(x 1, x 2,, x n ) as arithmetic formula (fan-out 1): * multiplication (fan-in 2) addition (fan-in 2) negation (fan-in 1) * - x 1 x 2 x 3 * + - x n Question: is f identically zero? April 3, 2017 7

A question Given: multivariate polynomial f(x 1, x 2,, x n ) as an arithmetic formula. Question: is f identically zero? Challenge: devise a deterministic polytime algorithm for this problem. April 3, 2017 8

A randomized algorithm Given: multivariate degree r poly. f(x 1, x 2,, x d ) note: r = deg(f) size of formula Algorithm: pick small number of random points if f is zero on all of these points, answer yes otherwise answer no (low-degree non-zero polynomial evaluates to zero on only a small fraction of its domain) No efficient deterministic algorithm known April 3, 2017 9

Derandomization Here is a deterministic algorithm that works under the assumption that there exist hard problems, say SAT. solve SAT on all instances of length log n 1 1 0 0 1 1 1 0 0 1 encode using error-correcting code (variant of a Reed-Muller code) 1 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 1 April 3, 2017 10

Derandomization 1 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 run randomized alg. using these strings in place of random evaluation points if f is zero on all of these points, answer yes otherwise answer no This works. (proof in this course) April 3, 2017 11

Derandomization This technique works on any randomized algorithm. Gives generic derandomization of randomized procedures. April 3, 2017 12

A surprising fact Is finding a solution as easy as recognizing one? P = NP? probably FALSE Is every sequential algorithm parallelizable? P = NC? probably FALSE Can every efficient algorithm be converted into one that uses a tiny amount of memory? P = L? probably FALSE Are there small Boolean circuits for all problems that require exponential running time? EXP P/poly? probably FALSE Can every randomized algorithm be converted into a deterministic algorithm one? P = BPP? probably TRUE April 3, 2017 13

Outline Should be mostly review 1. Problems and Languages 2. Complexity Classes 3. Turing Machines 4. Reductions 5. Completeness April 3, 2017 14

Problems and Languages Need formal notion of computational problem. Examples: Given graph G, vertices s, t, find the shortest path from s to t Given matrices A and B, compute AB Given an integer, find its prime factors Given a Boolean formula, find a satisfying assignment April 3, 2017 15

Problems and Languages One possibility: function from strings to strings function problem: f: *! * given x, compute f(x) decision problem: f: *! {yes, no} given x, accept or reject April 3, 2017 16

Problems and Languages simplification doesn t give up much: Given an integer n, find its prime factors Given an integer n and an integer k, is there a factor of n that is < k? Given a Boolean formula, find a satisfying assignment Given a Boolean formula, is it satisfiable? solve function problem efficiently using related decision problem (how?) We will work mostly with decision problems April 3, 2017 17

Problems and Languages decision problems: f: *! {yes, no} equivalent notion: language L µ * L = set of yes instances Examples: set of strings encoding satisfiable formulas set of strings that encode pairs (n,k) for which n has factor < k decision problem associated with L: Given x, is x in L? April 3, 2017 18

Problems and Languages An aside: two encoding issues 1. implicitly assume we ve agreed on a way to encode inputs (and outputs) as strings sometimes relevant in fine-grained analysis (e.g. adj. matrix vs. adj. list for graphs) almost never an issue in this class avoid silly encodings: e.g. unary April 3, 2017 19

Problems and Languages 2. some strings not valid encodings of any input -- treat as no invalid L yes no * invalid yes no * officially: co-l April 3, 2017 20

Problems and Languages 2. some strings not valid encodings of any input -- treat as no invalid L yes no * invalid * yes no What we usually mean by co-l April 3, 2017 21

Complexity Classes complexity class = class of languages set-theoretic definition no reference to computation (!) example: TALLY = languages in which every yes instance has form 0 n e.g. L = { 0 n : n prime } April 3, 2017 22

Complexity Classes complexity classes you know: P = the set of languages decidable in polynomial time NP = the set of languages L where L = { x : 9 y, y x k, (x, y) R } and R is a language in P easy to define complexity classes April 3, 2017 23

Complexity Classes harder to define meaningful complexity classes: capture genuine computational phenomenon (e.g. parallelism) contain natural and relevant problems ideally characterized by natural problems (completeness more soon) robust under variations in model of computation possibly closed under operations such as AND, OR, COMPLEMENT April 3, 2017 24

Complexity Classes need a model of computation to define classes that capture important aspects of computation Our model of computation: Turing Machine a b a b read/write head finite control... infinite tape April 3, 2017 25

Q finite set of states Turing Machines alphabet including blank: _ q start, q accept, q reject in Q δ : Q x! Q x x {L, R, -} transition fn. input written on tape, head on 1 st square, state q start sequence of steps specified by δ if reach q accept or q reject then halt April 3, 2017 26

Turing Machines three notions of computation with Turing machines. In all, input x written on tape function computation: output f(x) is left on the tape when TM halts language decision: TM halts in state q accept if x L; TM halts in state q reject if x L. language recognition: TM halts in state q accept if x L; may loop forever otherwise. April 3, 2017 27

Example: q σ δ(q,σ) start 0 (start, 0, R) start 1 (start, 1, R) start _ (t, _, L) start # (start, #, R) q σ δ(q,σ) t 0 (accept, 1, -) t 1 (t, 0, L) t # (accept, #, R) # 0 1 start # 0 1 start # 0 1 start # 0 1 start # 0 1 t # 0 0 t # 1 0 accept April 3, 2017 28

Turing Machines multi-tape Turing Machine: a b a b a a (input tape)... finite... k tapes control b b c d... δ:q x k! Q x k x {L,R,-} k Usually: read-only input tape write-only output tape k-2 read/write work tapes April 3, 2017 29

Multitape TMs simulation of k-tape TM by single-tape TM: a b a b a a b b c d (input tape)......... add new symbol x for each old x marks location of virtual heads # a b a b # a a # b b c d #... April 3, 2017 30

Multitape TMs a b a b a a b b c d.. Repeat:. O(t(n)) times...... scan tape, remembering the symbols under each virtual head in the state O(k t(n)) = O(t(n)) make changes to reflect 1 step of M; if hit #, shift to right to make room. O(k t(n)) = O(t(n)) when M halts, erase all but output string O(k t(n)) = O(t(n)) # a b a b # a a # b b c d #... April 3, 2017 31

Extended Church-Turing Thesis the belief that TMs formalize our intuitive notion of an efficient algorithm is: The extended Church-Turing Thesis everything we can compute in time t(n) on a physical computer can be computed on a Turing Machine in time t O(1) (n) (polynomial slowdown) quantum computers challenge this belief April 3, 2017 32

Extended Church-Turing Thesis consequence of extended Church-Turing Thesis: all reasonable physically realizable models of computation can be efficiently simulated by a TM e.g. multi-tape vs. single tape TM e.g. RAM model April 3, 2017 33

Turing Machines Amazing fact: there exist (natural) undecidable problems HALT = { (M, x) : M halts on input x } Theorem: HALT is undecidable. April 3, 2017 34

Turing Machines Proof: Suppose TM H decides HALT Define new TM H : on input <M> if H accepts (M, <M>) then loop if H rejects (M, <M>) then halt Consider H on input <H >: if it halts, then H rejects (H, <H >), which implies it cannot halt if it loops, then H accepts (H, <H >) which implies it must halt contradiction. April 3, 2017 35

Turing Machines H : Y n inputs n Diagonalization Y n n Y Y n Y Y n April 3, 2017 36 n Y box (M, x): does M halt on x? The existence of H which tells us yes/no for each box allows us to construct a TM H that cannot be in the table.

Turing Machines Back to complexity classes: TIME(f(n)) = languages decidable by a multitape TM in at most f(n) steps, where n is the input length, and f :N! N SPACE(f(n)) = languages decidable by a multi-tape TM that touches at most f(n) squares of its work tapes, where n is the input length, and f :N! N Note: P = k >= 1 TIME(n k ) April 3, 2017 37

Interlude In an ideal world, given language L state an algorithm deciding L prove that no algorithm does better we are pretty good at part 1 we are currently completely helpless when it comes to part 2, for most problems that we care about April 3, 2017 38

Interlude in place of part 2 we can relate the difficulty of problems to each other via reductions prove that a problem is a hardest problem in a complexity class via completeness powerful, successful surrogate for lower bounds April 3, 2017 39

Reductions reductions are the main tool for relating problems to each other given two languages L 1 and L 2 we say L 1 reduces to L 2 and we write L 1 L 2 to mean: there exists an efficient (for now, poly-time) algorithm that computes a function f s.t. x L 1 implies f(x) L 2 x L 1 implies f(x) L 2 April 3, 2017 40

Reductions yes f yes no positive use: given new problem L 1 reduce it to L 2 that we know to be in P. Conclude L 1 in P (how?) e.g. bipartite matching max flow formalizes L 1 as easy as L 2 f no L 1 L 2 April 3, 2017 41

Reductions yes f yes no negative use: given new problem L 2 reduce L 1 (that we believe not to be in P) to it. Conclude L 2 not in P if L 1 not in P (how?) e.g. satisfiability graph 3-coloring formalizes L 2 as hard as L 1 f no L 1 L 2 April 3, 2017 42

Reductions Example reduction: 3SAT = { φ : φ is a 3-CNF Boolean formula that has a satisfying assignment } (3-CNF = AND of OR of 3 literals) IS = { (G, k) G is a graph with an independent set V µ V of size k } (ind. set = set of vertices no two of which are connected by an edge) April 3, 2017 43