CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.

Slides:



Advertisements
Similar presentations
Complexity Classes: P and NP
Advertisements

CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Department of Computer Science & Engineering
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
The Theory of NP-Completeness
Lecture 21 Nondeterministic Polynomial time, and the class NP FIT2014 Theory of Computation Monash University Faculty of Information Technology Slides.
Umans Complexity Theory Lectures Lecture 2a: Reductions & Completeness.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
Complexity Theory CSE 331 Section 2 James Daly. Reminders Project 4 is out Due Friday Dynamic programming project Homework 6 is out Due next week (on.
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Definition of complexity class NP –Nondeterministic computation –Problems.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
NP-complete and NP-hard problems
Analysis of Algorithms CS 477/677
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 24 Instructor: Paul Beame.
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 2015.
Halting Problem. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have a tool that would warn us.
Theory of Computing Lecture 19 MAS 714 Hartmut Klauck.
Theory of Computation 1 Theory of Computation Peer Instruction Lecture Slides by Dr. Cynthia Lee, UCSD are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Difficult Problems. Polynomial-time algorithms A polynomial-time algorithm is an algorithm whose running time is O(f(n)), where f(n) is a polynomial A.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Computational Complexity Theory Lecture 2: Reductions, NP-completeness, Cook-Levin theorem Indian Institute of Science.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
NP Complexity By Mussie Araya. What is NP Complexity? Formal Definition: NP is the set of decision problems solvable in polynomial time by a non- deterministic.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 33.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
CSCI 2670 Introduction to Theory of Computing December 1, 2004.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
COMPSCI 102 Introduction to Discrete Mathematics.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
NP-Complete problems.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
1 Suppose I construct a TM M f which: 1. Preserves its input u. 2. Simulates a machine M b on input ε. 3. If M b hangs on input ε, force an infinite loop.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Computability NP complete problems. Space complexity. Homework: [Post proposal]. Find PSPACE- Complete problems. Work on presentations.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
CSC 413/513: Intro to Algorithms
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P.
1 1. Which of these sequences correspond to Hamilton cycles in the graph? (a) (b) (c) (d) (e)
1 The Theory of NP-Completeness 2 Review: Finding lower bound by problem transformation Problem X reduces to problem Y (X  Y ) iff X can be solved by.
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.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
NP-Completeness A problem is NP-complete if: It is in NP
The NP class. NP-completeness
NP-Completeness Yin Tat Lee
Intro to Theory of Computation
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP Completeness
NP-Completeness Yin Tat Lee
CSE 6408 Advanced Algorithms.
CSE 589 Applied Algorithms Spring 1999
Instructor: Aaron Roth
Presentation transcript:

CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Based on a work at Permissions beyond the scope of this license may be available at

CONSEQUENCES OF P ≠/= NP WHAT’S AT STAKE? Wonderful!!! Doom!!! 2

If P = NP, what would the consequences be? a)Many cryptographic systems are no longer secure, so all your Facebook, Gmail and online credit card transactions become insecure in a way they weren’t before b)Many important optimizations may now be computationally practical, improving our lives and efficiency in many things c)It takes as long to verify the correctness of an answer to problems in NP as it does to find the correct answer in the first place d)Other/None/More than one 3

GRAPH COLORING ANOTHER NP-COMPLETE PROBLEM 4

Graph 3-Coloring (G3C) G3C = { | G is a graph, and there is a coloring of vertices such that adjacent vertices don’t have the same color} This is a decision problem? A language? “Is this graph G 3-colorable?” = “Is in G3C”? 5

Is this graph 3-colorable? 6 Individual vote only: A for YES; B for NO

Is this graph 3-colorable? 7 Individual vote only: A for YES; B for NO

Another NP-Complete Problem Want to show: G3C is NP-complete. What do we need to show? a)Graph 3-Coloring is in NP b)SAT G3C c)G3C SAT d)None or more than one of the above 8

“G3C is in NP” How could we prove this? a)Give a deterministic poly-time TM that decides G3C b)Give a nondeterministic poly-time TM that decides G3C c)Give a deterministic poly-time TM that can verify a solution to G3C d)Give a nondeterministic poly-time TM that can verify a solution to G3C e)None or more than one of the above 9

“G3C is in NP” Let’s use choice c) Give a deterministic poly-time TM that can verify a solution to G3C. Any ideas? 10

3SAT G3C In order to show this reduction, you need to do WHAT? a)Take an arbitrary Boolean formula, and turn it into a graph that can be 3-colored iff the formula can be satisfied. b)Take an arbitrary graph and turn it into a Boolean formula that can be satisfied iff the graph can be 3-colored 11

3SAT G3C Normal people use colors like: red, blue, green, vivid tangerine… We’re going to use the “colors” T, F, and S. – Believe me, it’s going to make things way easier. 12

3SAT G3C Take a Boolean formula, and turn it into a graph that can be 3-colored iff the formula can be satisfied First step: create nodes called T, F, and S. Assume those are actually the colors. (How?) 13 S F T

3SAT G3C Second step: create a node for each possible literal (x i and ~x i ). – Connect all of them to S. (Why?) – Connect x i to ~x i. (Why?) 14 ~x 1 x1x1 ~x 2 x2x2 ~x 3 x3x3 ~x n xnxn S …

3SAT G3C Third step: For each clause, create this gadget: Connect the 3 literals in that clause to the black nodes Connect the yellow nodes to T 15

WHY this gadget?! Connect the 3 literals in that clause to the black nodes Connect the yellow nodes to T Suppose the 3 literals are colored F. For a 3- coloring, what color is the WHITE node? a) T b) F c) S d) White e) Other 16

So, the implication is this: The resulting graph can be colored iff at least 1 literal in each clause is colored T – In other words: the resulting graph can be 3- colored iff each clause is satisfiable – In other other words: the resulting graph can be 3-colored iff the entire formula is satisfiable. Mission Accomplished. 17

Does anyone actually care about graph coloring? Yes, people who color maps for a living (duh) But also: other problems. – Nodes are UCSD classes – Put an edge between 2 classes if there’s at least 1 student who’s in both (CSE 105 and CSE 130, for example) – Colors are exam time slots 18

WRAPPING UP…. 19

CSE 105: What have we done? We studied several computational models – Starting with the most simple: DFA’s, RE’s – Ending with the most complex: Turing machines, as powerful as computers we use daily 20

CSE 105: What have we done? These models were both simple and powerful: – Powerful enough to model real, meaningful computation (especially TM’s) – Simple enough to make precise mathematical statements about what can and can’t be done with them 21

CSE 105: What have we done? We showed what models CAN do: – They can solve specific types of problems (classes of languages) – (For example, CFG’s can be used to parse XML) – One model (Turing machines) is appropriate for making statements about “real computation” 22

CSE 105: What have we done? We showed what models CAN’T do: – For each language class we studied There are problems NOT in that language class! – Regular expressions can’t parse XML – PDA’s can’t check if a number is square – TM’s can’t solve the Halting Problem! 23

Beyond CSE 105 Most of CSE 105 is about computability: what can and cannot be computed Most of this week was an introduction to complexity: for things that can be computed, how difficult is it? – We talked about P and NP, but there are tons of others: PSPACE, EXPTIME, NL, etc. – There’s also an unresolved question: what about problems that are not decision problems? 24

Beyond CSE 105 There are also other related models of computation, and other classes of languages based on those: – Randomized Turing machines – Quantum Turing machines – Circuit-based models Tons of open problems in here. 25

Beyond CSE 105 Many of these topics are explored in CSE 200. – Yes, it’s a graduate course, but if you did well in CSE 105, it is not out of reach! – In my experience, I have found that undergrads who succeed in CSE 105 at UCSD are at least as prepared as grad students who came from elsewhere. (I have also found this true, perhaps more so, with CSE 101 and 202). 26

Beyond CSE 105 There are also lots of other “Theoretical CS” classes that are NOT related to 105. CSE 101, 202: Algorithms Cryptography – Cryptosystems are proven secure using…reductions! – “If you can break the cryptosystem, then you can also solve Wicked Hard Problem X” You may also enjoy math classes, especially probability, combinatorics, and discrete math. 27

What to do if you hated CSE 105: You almost certainly won’t have to build Turing machines or prove things co-recognizable anywhere else. BUT, throughout your studies and career, you will encounter a few things, guaranteed: – Parsing XML and CFG’s for programming languages – NP-complete problems – Regular expressions – “Is this program stuck, or is it just taking a long time?” Lucky for you, you now know how to deal with these. Leave CAPE feedback: what can be done better? 28

What to do if you liked CSE 105: Consider taking CSE 200, or other theoretical CS courses Consider applying to be a CSE 105 tutor Leave positive CAPE feedback …and feel free to ask me about anything 29

That’s all, folks! See you at the final: – Tuesday 6/12, 11:30am, right here – Good luck studying! 30