Computational Models

Similar documents
Time Magazine (1984)

Theory of Computation Lecture 1. Dr. Nahla Belal

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

Computational Models Lecture 11, Spring 2009

Computational Models: Class 3

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lecture 1 : Introduction

Computational Models Lecture 9, Spring 2009

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

Automata Theory, Computability and Complexity

Computational Models Lecture 8 1

Introduction to Complexity Theory

Computational Models Lecture 8 1

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

Computational Models Lecture 8 1

Computational Models - Lecture 1 1

Computational Complexity

CS151 Complexity Theory. Lecture 1 April 3, 2017

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

BBM402-Lecture 11: The Class NP

The P-vs-NP problem. Andrés E. Caicedo. September 10, 2011

Proofs, Strings, and Finite Automata. CS154 Chris Pollett Feb 5, 2007.

CMSC 441: Algorithms. NP Completeness

Computational Models Lecture 7, Spring 2009

Computer Sciences Department

1a. Introduction COMP6741: Parameterized and Exact Computation

Computational Models - Lecture 5 1

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

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

Theory of Computation

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

CS 301. Lecture 17 Church Turing thesis. Stephen Checkoway. March 19, 2018

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

Turing Machines Part III

Notes for Lecture Notes 2

CS 154 Introduction to Automata and Complexity Theory

Automata Theory and Formal Grammars: Lecture 1

Understanding Computation

CS:4330 Theory of Computation Spring Regular Languages. Finite Automata and Regular Expressions. Haniel Barbosa

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

Problems, and How Computer Scientists Solve Them Manas Thakur

Homework. Staff. Happy and fruitful New Year. Welcome to CSE105. (Happy New Year) שנה טובה. and. Meeting Times

Lecture 13, Fall 04/05

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Homework. Staff. Happy and fruitful New Year. Welcome to CS105. (Happy New Year) שנה טובה. Meeting Times.

1 Computational Problems

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

Class Note #20. In today s class, the following four concepts were introduced: decision

Computational Models - Lecture 5 1

Computational Models - Lecture 4 1

Computational Models - Lecture 3 1

CSCI FOUNDATIONS OF COMPUTER SCIENCE

MATH 341, Section 001 FALL 2014 Introduction to the Language and Practice of Mathematics

Handouts. CS701 Theory of Computation

Computational Models: Class 1

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

Approximation Algorithms

CS 583: Algorithms. NP Completeness Ch 34. Intractability

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

CS173 Lecture B, November 3, 2015

What we have done so far

CS 208: Automata Theory and Logic

Computational Models Lecture 2 1

Tractable & Intractable Problems

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

CSCE 551: Chin-Tser Huang. University of South Carolina

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity

IS 709/809: Computational Methods for IS Research. Math Review: Algorithm Analysis

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Computational Models - Lecture 4

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

The Church-Turing Thesis

Algorithms Exam TIN093 /DIT602

CS 154 NOTES MOOR XU NOTES FROM A COURSE BY LUCA TREVISAN AND RYAN WILLIAMS

Theory of Computer Science

Complexity Theory Part I

Undecidability. Andreas Klappenecker. [based on slides by Prof. Welch]

Theory of Computation Chapter 1: Introduction

Theory of Computer Science. Theory of Computer Science. E1.1 Motivation. E1.2 How to Measure Runtime? E1.3 Decision Problems. E1.

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

34.1 Polynomial time. Abstract problems

Computational Models Lecture 2 1

Assignment #2 COMP 3200 Spring 2012 Prof. Stucki

Data Structures and Algorithms

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University

Mathematical Preliminaries. Sipser pages 1-28

NP Completeness and Approximation Algorithms

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

Computability and Complexity Theory

Computational Models: Class 5

Acknowledgments 2. Part 0: Overview 17

Principles of Computing, Carnegie Mellon University. The Limits of Computing

CMPT307: Complexity Classes: P and N P Week 13-1

Lecture Notes 4. Issued 8 March 2018

Complexity Theory Part II

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Introduction to CS 4104

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

Finish K-Complexity, Start Time Complexity

Lecture 14 - P v.s. NP 1

Transcription:

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models Inroduction to the Theory of Computing Instructor: Prof. Benny Chor (benny at cs dot tau dot ac dot il) Teaching Assistant: Mr. Rani Hod (ranihod at tau dot ac dot il) Tel-Aviv University Spring Semester, 2009. Mondays, 13 16. http://www.cs.tau.ac.il/ bchor/cm09/compute.html Site is our sole means of disseminating messages (no mailing list or forum).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 2 AdministraTrivia Course Requirements: 6 problem sets (10% of grade, best 5-out-of-6). Readable, concise, correct answers expected. Late submition will not be accepted. Assignments are 10% of grade, and are required. Solving assignments independently is highly recommended. Final exam is 90% of grade. Midterm exam (10% of midterm grade added to weighted average of final exam and homework).

AdministraTrivia II Midterm tentatively scheduled to Tue., April 7, 2009. Second final exam (Moed B): Same material and same averaging applies. Format may differ (e.g. proportion of closed/open problems). Prerequisites: Extended introduction to computer science Discrete mathematics course. Students from other disciplines with mathematical background encouraged to contact the instructor. Textbook (extensively used, highly recommended): Michael Sipser, Introduction to the theory of computation, 1st or 2nd edition. Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 3

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 4 Why Study Theory? Basic Computer Science Issues What is a computation? Are computers omnipotent? What are the fundemental capabilities and limitations of computers? Pragmatic Reasons Avoid intractable or impossible problems. Apply efficient algorithms when possible. Learn to tell the difference.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 5 Course Topics Automata Theory: What is a computer? Computability Theory: What can computers do? Complexity Theory: What makes some problems computationally hard and others easy? Coping with intractability: Approximation. Randomization. Fixed parameter algorithms. Heuristics.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 6 Automata Theory - Simple Models Finite automata. Related to controllers and hardware design. Useful in text processing and finding patterns in strings. Probabilistic (Markov) versions useful in modeling various natural phenomena (e.g. speech recognition). Push down automata. Titely related to a family of languages known as context free languages. Play important role in compilers, design of programming languages, and studies of natural languages.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 7 Computability Theory In the first half of the 20th century, mathematicians such as Kurt Göedel, Alan Turing, and Alonzo Church discovered that some fundemental problems cannot be solved by computers. Proof verication of statements can be automated. It is natural to expect that determining validity can also be done by a computer. Theorem: A computer cannot determine if mathematical statement true or false. Results needed theoretical models for computers. These theoretical models helped lead to the construction of real computers.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 8 Computability Theory a simplicial complex

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 9 Paths and Loops a path is a sequence of vertices connected by edges a loop is a path that ends and ends at the same vertex

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 10 Paths and Loops can be Deformed (v 0,v 1 ) (v 0,v 2,v 1 ) (v 0,v 0 ) (v 0 )

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 11 Contractibility contractible not contractible No algorithm can determine whether an arbitrary loop in an arbitrary finite complex is contractible.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 12 Some Other Undecidable Problems Does a program run forever? Is a program correct? Are two programs equivalent? Is a program optimal? Does an equation with one or more variables and integer coefficients (5x + 15y = 12) have an integer solution (Hilbert s 10th problem). Is a finitely-presented group trivial? Given a string, x, how compressible is it?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 13 Complexity Theory Key notion: tractable vs. intractable problems. A problem is a general computational question: description of parameters description of solution An algorithm is a step-by-step procedure a recipe a computer program a mathematical object We want the most efficient algorithms fastest (usually) most economical with memory (sometimes) expressed as a function of problem size

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 14 Example: Traveling Salesman Problem Input: set of cities set of inter-city distances

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 15 Example: Traveling Salesman Problem Goal: want the shortest tour through the cities example: a,b,d,c,a has length 27.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 16 Problem Size What is an appropriate measure of problem size? m nodes? m(m + 1)/2 distances? Use an encoding of the problem alphabet of symbols strings: a/b/c/d//10/5/9//6/9//3. Measures Problem Size: length of encoding (here: 23 ascii characters). Time Complexity: how long an algorithm runs, as function of problem size?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 17 Time Complexity - What is tractable? We say that a function f(n) is O(g(n)) if there is a constant c such that for large enough n, f(n) c g(n). A polynomial-time algorithm is one whose time complexity is O(p(n)) for some polynomial p(n), where n denotes the length of the input. An exponential-time algorithm is one whose time complexity cannot be bounded by a polynomial (e.g., n log n ).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 18 Tractability Basic distinction: Polynomial time = tractable. Exponential time = intractable. 10 20 30 40 50 60 n.00001.00002.00003.00004.00005.00006 second second second second second second n 2.00001.00004.00009.00016.00025.00036 second second second second second second n 3.00001.00008.027.064.125.216 second second second second second second n 5.1 3.2 24.3 1.7 5.2 13.0 second seconds seconds minute minutes minutes 2 n.001 1.0 17.9 12.7 35.7 366 second second minutes days years centuries 3 n.059 58 6.5 3855 2 10 8 1.3 10 13 second minutes years centuries centuries centuries

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 19 Effect of Speed-Ups Let s wait for faster hardware! Consider maximum problem size you can solve in an hour. present 100 times faster 1000 times faster n N 1 100N 1 1000N 1 n 2 N 2 10N 2 31.6N 2 n 3 N 3 4.64N 3 10N 3 n 5 N 4 2.5N 4 3.98N 4 2 n N 5 N 5 +6.64 N 5 +9.97 3 n N 6 N 6 +4.19 N 6 +6.29

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 20 NP-Completeness / NP-Hardness Your boss says: Get me an efficient traveling-salesman algorithm, or else... What are you going to do?

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 21 Response Yes Ma am, expect it this afternoon! Problem is All known algorithms (essentially) check all possible paths. Exhaustive checking is exponential. Good luck!

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 22 Response Hah! I will prove that no such algorithm is possible Problem is, proving intractability is very hard. Many important problems have no known tractable algorithms no known proof of intractability.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 23 Response I can t find an efficient algorithm. I guess I m just a pathetic loser. Bad for job security.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 24 Response The problem is NP-hard. I can t find an efficient algorithm, but neither can any of these famous people... Advantage is: The problem is just as hard as other problems smart people can t solve efficiently. So it would do your boss no good to fire you and hire a Technion/Hebrew Univ./MIT graduate.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 25 Response Would you settle for a pretty good, but not the best, algorithm? Intractability isn t everything. Find an approximate solution (is a solution within 10% of optimum good enough, ma am?). Use randomization. Fixed parameter algorithms may be applicable. Heuristics can also help. Approximation, randomization, etc. are among the hottest areas in complexity theory and algorithmic research today.

Next Subject Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 26

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 27 A Very Short Math Review Graphs Strings and languages Mathematical proofs Mathematical notations (sets, sequences,... ) Functions and predicates = will be done in recitation.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 28 Graphs 1 4 1 5 2 4 3 3 2 G = (V,E), where V is set of nodes or vertices, and E is set of edges degree of a vertex is number of edges

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 29 Graphs graph 1 root tree 5 2 4 subgraph 3 leaves 4 path 1 5 1 cycle 2 3 2 4 3

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 30 Directed Graphs 1 2 5 6 4 3 scissors paper rock

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 31 Directed Graph and its Adjacency Matrix Which directed graph is represented by the following 6-by-6 matrix? 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 32 Strings and Languages an alphabet is a finite set of symbols a string over an alphabet is a finite sequence of symbols from that alphabet. the length of a string is the number of symbols the empty string ε reverse: abcd reversed is dcba. substring: xyz in xyzzy. concatenation of xyz and zy is xyzzy. x k is x x, k times. a language L is a set of strings.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 33 Proofs We will use the following basic kinds of proofs. by construction by contradiction by induction by reduction we will often mix them.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 34 Proof by Construction A graph is k-regular if every node has degree k. Theorem: For every even n > 2, there exists a 3-regular graph with n nodes. 1 0 2 5 3 4

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 35 Proof by Construction 1 0 2 5 3 4 Proof: Construct G = (V,E), where V = {0, 1,...,n 1} and E = {{i,i + 1} for 0 i n 2} {n 1, 0} {{i,i + n/2} for 0 i n/2 1}. Note: A picture is helpful, but it is not a proof!

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 36 Proof by Contradiction Theorem: 2 is irrational. Proof: Suppose not. Then 2 = m n relatively prime., where m and n are n 2 = m 2n 2 = m 2

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 37 Proof by Contradiction (cont.) So m 2 is even, and so is m = 2k. 2n 2 = (2k) 2 = 4k 2 n 2 = 2k 2 Thus n 2 is even, and so is n. Therefore both m and n are even, and not relatively prime! Reductio ad absurdam.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 38 Proof by Induction Prove properties of elements of an infinite set. N = {1, 2, 3,...} To prove that holds for each element, show: base step: show that (1) is true. induction step: show that if (i) is true (the induction hypothesis), then so is (i + 1).

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 39 Induction Example Theorem: All cows are the same color. Base step: A single-cow set is definitely the same color. Induction Step: Assume all sets of i cows are the same color. Divide the set {1,...,i + 1} into U = {1,...,i}, and V = {2,...,i + 1}. All cows in U are the same color by the induction hypothesis. All cows in V are the same color by the induction hypothesis. All cows in U V are the same color by the induction hypothesis.

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 40 Induction Example (cont.) Ergo, all cows are the same color. Quod Erat Demonstrandum (QED). (cows images courtesy of www.crawforddirect.com/ cows.htm)

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 41 Proof by Reduction We can sometime solve problem A by reducing it to problem B, whose solution we already know. Example: Maximal matching in bipartite graphs:

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 42 Proof by Reduction Reducing bipartite matching to MAX FLOW: Reduction: Put capacity 1 on each edge. Maximum flow corresponds to maximum matching. So if we have an algorithm that produces max flow, we can easily derive a maximum bipartite matching from it.