Universal Algebra and Computational Complexity Lecture 1

Similar documents
Computational Complexity for Algebraists

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

Complexity Theory 112. Space Complexity

1 Computational Problems

Advanced topic: Space complexity

Notes for Lecture Notes 2

Computability and Complexity Theory: An Introduction

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

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

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

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

CSCI 1590 Intro to Computational Complexity

Spring Lecture 21 NP-Complete Problems

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

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

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

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

Undirected ST-Connectivity in Log-Space. Omer Reingold. Presented by: Thang N. Dinh CISE, University of Florida, Fall, 2010

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

CSE200: Computability and complexity Space Complexity

6.045 Final Exam Solutions

Apropos of an errata in ÜB 10 exercise 3

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size.

Computational Complexity

Computational Complexity Theory

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.

Logarithmic space. Evgenij Thorstensen V18. Evgenij Thorstensen Logarithmic space V18 1 / 18

Database Theory VU , SS Complexity of Query Evaluation. Reinhard Pichler

The Complexity of Optimization Problems

CS151 Complexity Theory. Lecture 4 April 12, 2017

Computational complexity

Introduction to Computational 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).

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

Lecture 20: conp and Friends, Oracles in Complexity Theory

Complexity of domain-independent planning. José Luis Ambite

Lecture 5: The Landscape of Complexity Classes

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

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

1 PSPACE-Completeness

Introduction to Complexity Classes. Marcin Sydow

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

CMSC 441: Algorithms. NP Completeness

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

P, NP, NP-Complete, and NPhard

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

Lecture 8: Complete Problems for Other Complexity Classes

Turing Machines and Time Complexity

CSCI3390-Lecture 14: The class NP

Lecture 6: Oracle TMs, Diagonalization Limits, Space Complexity

Space and Nondeterminism

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

conp, Oracles, Space Complexity

COL 352 Introduction to Automata and Theory of Computation Major Exam, Sem II , Max 80, Time 2 hr. Name Entry No. Group

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

Umans Complexity Theory Lectures

Complexity: moving from qualitative to quantitative considerations

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

CS 241 Analysis of Algorithms

Computational Complexity. IE 496 Lecture 6. Dr. Ted Ralphs

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

Design and Analysis of Algorithms

Turing Machine Recap

Lecture 4. 1 Circuit Complexity. Notes on Complexity Theory: Fall 2005 Last updated: September, Jonathan Katz

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

CS151 Complexity Theory. Lecture 1 April 3, 2017

Theory of Computation Time Complexity

CSCE 551 Final Exam, April 28, 2016 Answer Key

CSC 1700 Analysis of Algorithms: Warshall s and Floyd s algorithms

CSCI 1590 Intro to Computational Complexity

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

1 Computational problems

BBM402-Lecture 11: The Class NP

Computability and Complexity CISC462, Fall 2018, Space complexity 1

A An Overview of Complexity Theory for the Algorithm Designer

INAPPROX APPROX PTAS. FPTAS Knapsack P

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

Complexity (Pre Lecture)

CS151 Complexity Theory

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

Computability and Complexity

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

Decidability. Linz 6 th, Chapter 12: Limits of Algorithmic Computation, page 309ff

Lecture 7: Polynomial time hierarchy

Lecture 18: P & NP. Revised, May 1, CLRS, pp

CSCE 551 Final Exam, Spring 2004 Answer Key

Lecture 16: Time Complexity and P vs NP

Sparse analysis Lecture II: Hardness results for sparse approximation problems

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

Algorithms and Theory of Computation. Lecture 19: Class P and NP, Reduction

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

6.841/18.405J: Advanced Complexity Wednesday, February 12, Lecture Lecture 3

Theory of Computation

Friday Four Square! Today at 4:15PM, Outside Gates

ITCS:CCT09 : Computational Complexity Theory Apr 8, Lecture 7

Notes on Complexity Theory Last updated: December, Lecture 2

Intelligent Agents. Formal Characteristics of Planning. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University

Computational Complexity

Transcription:

Universal Algebra and Computational Complexity Lecture 1 Ross Willard University of Waterloo, Canada Třešt, September 2008 Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 1 / 23

Outline Lecture 1: Decision problems and Complexity Classes Lecture 2: Nondeterminism, Reductions and Complete problems Lecture 3: Results and problems from Universal Algebra Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 2 / 23

Three themes: problems, algorithms, efficiency A Decision Problem is A YES/NO question parametrized by one or more inputs. Inputs must: range over an infinite class. be finitistically described What we seek: An algorithm which correctly answers the question for every possible inputs. What we ask: How efficient is this algorithm? Is there a better (more efficient) algorithm? Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 3 / 23

Directed Graph Reachability problem (PATH) INPUT: A finite directed graph G = (V, E) Two distinguished vertices v start, v end V. QUESTION: Does there exist in G a directed path from v start to v end? (i.e., a sequence v start = v 0, v 1, v 2,, v k = v end of vertices such that (v i, v i+1 ) E for all 0 i < k.) Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 4 / 23

An Algorithm for PATH v start = Answer: NO v end = Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 5 / 23

Efficiency of this algorithm How long does this algorithm take? I.e., how many steps? as a function of the size of the input graph. I ll give three answers to this. Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 6 / 23

First answer Heuristics Only action is changing a vertex s color. Only changes possible are white red red blue blue green. So if n = V, then the algorithm requires at most 3n vertex-color changes. Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 7 / 23

Second answer pseudo-code Assume that V = {0, 1,, n 1} and E is encoded by the adjacency matrix M E = [e i,j ] where { 1 if (i, j) E, e i,j = 0 else. For i < n let c i be a variable recording the color of vertex i. Also let Greenvar be a variable storing whether there are green-colored vertices. Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 8 / 23

Second answer pseudo-code Algorithm: Input n, M E, start and end. For i = 0 to n 1 set c i := white. Set c start = green. Set GreenVar := yes. While GreenVar = yes do: For i = 0 to n 1; for j = 0 to n 1 if e i,j = 1 and c i = green and c j = white then set c j := red. For i = 0 to n 1 If c i = green then set c i := blue Set GreenVar := no For i = 0 to n 1 If c i = red then (set c i := green and set GreenVar := yes) If c end = blue then output YES; else output NO. n loops n 2 cases O(n 3 ) steps if n = V Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 9 / 23

Third answer machine implementation Again assume V = {0, 1,, n 1}. Assume also that v start = 0 and v end = 1. Assume the adjacency matrix is presented as a binary string of length n 2. Implement the algorithm on a Turing machine. Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 10 / 23

Turing machine Input (ROM): 0 0 1 1 0 1 1 1 0 0 1 0 0 1 0 1 0 1 1 0 0 1 1 0 0 1 R/W Tape 1: a a c e c a a e c a e e a c a e e a c c c e c e c a a e a a c R/W Tape 2: R/W Tape 3: R/W Tape 4: 7 0 3 2 5 3 0 0 1 6 7 2 3 0 1 5 1 5 0 0 0 6 7 2 3 1 3 4 0 1 0 x o x x o o o o x x o x x o A C H X X OO 1 P L E A S E S E N D H E L P A R G G H H R/W Tape 5: Output bit: 0 0 1 1 0 1 1 1 0 0 1 0 0 1 0 1 0 1 1 0 0 1 3 state Tape char 1 st? In 1 2 3 4 5 1 c 1 x E Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 11 / 23

Implementing the algorithm for PATH Input: Tape 1: Tape 2: Tape 3: Tape 4: Tape 5: } {{ } [e i,j ] } {{ } c i }{{} n }{{} i }{{} j = 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 # 0 0 1 1 # 0 0 0 0 # 0 0 0 0 # 1 GreenVar # Main loop: For i, j = 0 to n 1 Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 12 / 23

Pseudo-code revisited Point: overhead needed to keep track of i, j, c i, c j. Thus: While GreenVar = yes do: For i = 0 to n 1; for j = 0 to n 1 if e i,j = 1 and c i = green and c j = white then set c j := red. n loops n 2 cases O(n log n) steps SUMMARY: on an input graph G = (V, E) with V = n, our algorithm decides the answer to PATH using: Heuristics Pseudo-code Turing machine 3n color changes O(n 3 ) operations O(n 4 log n) steps (Time) O(n) memory cells (Space) Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 13 / 23

Turing machine complexity Let f : N N be given. Definition A decision problem D (with a specified encoding of its inputs) is: 1 in TIME(f (N)) if there exists a Turing machine solving D in at most O(f (N)) steps on inputs of length N. 2 in SPACE(f (N)) if there exists a Turing machine solving D requiring at most O(f (N)) memory cells (not including the input tape) on inputs of length N. Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 14 / 23

Complexity of PATH Recall that our Turing machine solves PATH on graphs with n vertices in Time: O(n 4 log n) steps Space: O(n) memory cells. Since length N of input = n 2 (when n = V ), we have Theorem PATH TIME(N 2+ɛ ) PATH SPACE( N) (Question: can we do better? ) Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 15 / 23

Another problem: Boolean Formula Value (FVAL) INPUT: A boolean formula ϕ in propositional variables x 1,, x n. A sequence c = (c 1,, c n ) {0, 1} n. QUESTION: Is ϕ(c) = 1? Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 16 / 23

An algorithm for FVAL ϕ = ((((x 2 x 4 ) ( (x 3 ))) ((x 1 x 4 ) (x 3 x 2 ))) ( (x 3 (x 1 x 3 )))), c = (1,0,1,1). 0 1 0 1 1 1 1 0 1 1 1 1 x 3 0 1 1 1 1 1 0 1 1 x 2 x 4 x 3 x 1 x 4 x 3 x 2 x 1 x 3 Seems to use TIME(N) and SPACE(N). But space can be re-used. In this example, 3 memory bits suffice. Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 17 / 23

Complexity of FVAL In general, a bottom-up computation, always computing a larger subtree first, can be organized to need only O(log ϕ ) intermediate values. A careful implementation on a Turing machine yields: Theorem Theorem (Nancy Lynch, 1977). FVAL TIME(N 2+ɛ ) FVAL SPACE(log N). Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 18 / 23

A third problem: Graph 3-Colorability (3COL) INPUT: a finite graph G = (V, E). QUESTION: Is it possible to color the vertices red, green or blue, so that no two adjacent vertices have the same color? Equivalently: does there exist a homomorphism χ :? G K 3 Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 19 / 23

An algorithm for 3COL Brute force search algorithm: For each function χ : V K 3 : Test if χ works. 3 V = 2 O( N) loops O(N 2 ) time, O( N) space Theorem This at least proves: 3COL TIME(2 O( N) ) 3COL SPACE( N) Open problem: can 3COL be solved in polynomial time? Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 20 / 23

A fourth problem: Clone membership (CLO) INPUT: A finite algebra A = A; f 1,, f k. An operation g : A n A. QUESTION: Is g a term operation of A? All known algorithms essentially generate the full n-generated free algebra in V (A), and test whether g F n. F n A (An ) In the worst case this could require as much as A (An) = 2 O( A n) time and space. Theorem: We cannot solve CLO in polynomial time. Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 21 / 23

Some important complexity classes Definition 1 P = PTIME = k=1 TIME(Nk ) = TIME(N O(1) ). 2 PSPACE = k=1 SPACE(Nk ) = SPACE(N O(1) ). Problems known to be in P are said to be feasible or tractable. Definition 3 EXPTIME = k=1 TIME(2Nk ) = TIME(2 NO(1) ). 4 L = LOGSPACE = SPACE(log(N)). L P PSPACE EXPTIME PATH FVAL 3COL CLO Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 22 / 23

Tomorrow L P PSPACE EXPTIME PATH FVAL 3COL CLO In tomorrow s lecture I will: Introduce nondeterministic versions of these 4 classes. Introduce problems which are hardest for each class. Ross Willard (Waterloo) Algebra and Complexity Třešt, September 2008 23 / 23