Class 21: Introducing Complexity David Evans cs302: Theory of Computation University of Virginia Computer Science.

Slides:



Advertisements
Similar presentations
Formal Models of Computation Part III Computability & Complexity
Advertisements

Lecture 10: Context-Free Languages Contextually David Evans
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 17: ProvingUndecidability.
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 13: Turing Machines.
Cs3102: Theory of Computation Class 22: Introducing Complexity Spring 2010 University of Virginia David Evans Exam 2: due now Read Chapter 7 (we skip Ch.
CS 345: Chapter 9 Algorithmic Universality and Its Robustness
CS 461 – Nov. 9 Chomsky hierarchy of language classes –Review –Let’s find a language outside the TM world! –Hints: languages and TM are countable, but.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
The Big Picture Chapter 3. We want to examine a given computational problem and see how difficult it is. Then we need to compare problems Problems appear.
Recap CS605: The Mathematics and Theory of Computer Science.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
January 5, 2015CS21 Lecture 11 CS21 Decidability and Tractability Lecture 1 January 5, 2015.
1 Introduction to Computability Theory Lecture14: Recap Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Chapter 3 Growth of Functions
CPSC 411, Fall 2008: Set 12 1 CPSC 411 Design and Analysis of Algorithms Set 12: Undecidability Prof. Jennifer Welch Fall 2008.
Complexity ©D.Moshkovitz 1 Turing Machines. Complexity ©D.Moshkovitz 2 Motivation Our main goal in this course is to analyze problems and categorize them.
CS 302: Discrete Math II A Review. An alphabet Σ is a finite set (e.g., Σ = {0,1}) A string over Σ is a finite-length sequence of elements of Σ For x.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 5 Reducibility Contents Undecidable Problems from Language Theory.
January 28, 2015CS21 Lecture 101 CS21 Decidability and Tractability Lecture 10 January 28, 2015.
CS21 Decidability and Tractability
Class 19: Undecidability in Theory and Practice David Evans cs302: Theory of Computation University of Virginia Computer.
1 Introduction to Computability Theory Lecture11: The Halting Problem Prof. Amos Israeli.
Final Exam Review Cummulative Chapters 0, 1, 2, 3, 4, 5 and 7.
Algorithm analysis and design Introduction to Algorithms week1
Asymptotic Notations Iterative Algorithms and their analysis
Context-Free Languages Regular Languages Violates Pumping Lemma For RLs Violates Pumping Lemma For CFLs Described by CFG, PDA 0n1n0n1n 0n1n2n0n1n2n Described.
Remaining Topics Decidability Concept 4.1 The Halting Problem 4.2
MA/CSSE 474 Theory of Computation The Halting Problem.
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
Lecture 2 Computational Complexity
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 2: Orders of Growth
Class 22: Classy Complexity Classes David Evans cs302: Theory of Computation University of Virginia Computer Science Office.
Review Byron Gao. Overview Theory of computation: central areas: Automata, Computability, Complexity Computability: Is the problem solvable? –solvable.
Introduction to CS Theory Lecture 15 –Turing Machines Piotr Faliszewski
Cs3102: Theory of Computation Class 24: NP-Completeness Spring 2010 University of Virginia David Evans.
David Evans CS588: Security and Privacy University of Virginia Computer Science Lecture 15: Complexity Notes This is selected.
MA/CSSE 474 Theory of Computation Enumerability Reduction.
David Evans CS150: Computer Science University of Virginia Computer Science Class 33: Computing with Photons From The.
Theory of Computing Lecture 21 MAS 714 Hartmut Klauck.
Cs3102: Theory of Computation Class 14: Turing Machines Spring 2010 University of Virginia David Evans.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 3: Levels of Abstraction
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 16: Universality and Undecidability.
Measuring complexity Section 7.1 Giorgi Japaridze Theory of Computability.
Time Complexity of Algorithms (Asymptotic Notations)
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
CSCI 2670 Introduction to Theory of Computing October 12, 2005.
David Evans Class 15: P vs. NP (Smiley Puzzles and Curing Cancer) CS150: Computer Science University of Virginia Computer.
CSCI 2670 Introduction to Theory of Computing October 13, 2005.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
Ch03-Algorithms 1. Algorithms What is an algorithm? An algorithm is a finite set of precise instructions for performing a computation or for solving a.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Decidable.
David Evans CS150: Computer Science University of Virginia Computer Science Class 32: Computability in Theory and Practice.
The Church-Turing Thesis Chapter Are We Done? FSM  PDA  Turing machine Is this the end of the line? There are still problems we cannot solve:
Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3
Time complexity Here we will consider elements of computational complexity theory – an investigation of the time (or other resources) required for solving.
CSE 105 theory of computation
Asymptotic Analysis.
Introduction to Algorithms
Busch Complexity Lectures: Reductions
Growth of functions CSC317.
HIERARCHY THEOREMS Hu Rui Prof. Takahashi laboratory
Asymptotic Analysis.
CS154, Lecture 12: Time Complexity
CS21 Decidability and Tractability
CSE 105 theory of computation
Intro to Theory of Computation
Presentation transcript:

Class 21: Introducing Complexity David Evans cs302: Theory of Computation University of Virginia Computer Science

2 Lecture 21: Introducing Complexity Exam 2

3 Lecture 21: Introducing Complexity Good News 96% of you got 1a (a language is a set of strings) correct Most people got most credit for: –2a (design a TM) –2b (cyclical TM) –3a (one-way simulation proof claiming equivalence)

4 Lecture 21: Introducing Complexity Confusing News? For question 1b (“Explain the essence of the Church-Turing Thesis in a way that would be understandable to a typical fifth grader”) more than half of you assumed a 5 th grader knows what a Turing machine is (and about ¼ assumed they know Lambda calculus also!) Coming up with a good answer for this question with time pressure is tough. A good answer would either explain C-T thesis without needing TMs (using things a 5 th grader already understands), or include an explanation of what a TM is. You can submit a new answer Tuesday. Or, find/make a 5 th grader who understands TMs well enough to actually understand your answer.

5 Lecture 21: Introducing Complexity Bad News Only 25/81 (>= 8 on 4b) and 24/81 (>= 8 on 4c) of you were able to get close to a convincing reduction proof. But, to solve complexity problem, you will need to do tougher reduction proofs! These were pretty tough questions, so many its actually good news that ~30% got them. Practicing more now would be a good idea!

6 Lecture 21: Introducing Complexity Good/Bad News You have an opportunity to improve your score on Exam 2 by submitting improved answers to these questions Good news: I will provide some hints how to get started next. Bad news: Since I have provided hints, and you have as much time as you need, I expect very clear, convincing, correct answers.

7 Lecture 21: Introducing Complexity 4b NOTSUB TM = { | A and B are descriptions of TMs and there is some string which is accepted by A that is not accepted by B }

8 Lecture 21: Introducing Complexity 4c L BusyBee = { | M describes a TM, k is the number of different FSM states M enters before halting on w }

9 Lecture 21: Introducing Complexity Computability and Complexity

10 Lecture 21: Introducing Complexity Classes 1-12 Regular Languages Context-Free Languages Violates Pumping Lemma For RLs Violates Pumping Lemma For CFLs Described by DFA, NFA, RegExp, RegGram Described by CFG, NDPDA 0n1n0n1n 0n1n2n0n1n2n 0n0n w Deterministic CFLs LL(k) Languages Described by LL(k) Grammar Indexed Grammars

11 Lecture 21: Introducing Complexity Classes Decidable by any mechanical computing machine Undecidable

12 Lecture 21: Introducing Complexity Today - End Decidable Undecidable Tractable: “Decidable in a reasonable amount of time and space”

13 Lecture 21: Introducing Complexity Computability Complexity Decidable Undecidable ~1800s – 1960s 1900: Hilbert’s Problems 1936: Turing’s Computable Numbers 1957: Chomsky’s Syntactic Structures (Mostly) “Dead” field Intractable Tractable 1960s – 2150? 1960s: Hartmanis and Stearns: Complexity class 1971: Cook/Levin, Karp: P=NP? 1976: Knuth’s O, Ω, Θ Very Open and Alive

14 Lecture 21: Introducing Complexity Complexity Classes Computability Classes: sets of problems (languages) that can be solved (decided/recognized) by a given machine Complexity Classes: sets of problems (languages) that can be solved (decided) by a given machine (usually a TM) within a limited amount of time or space How many complexity classes are there? Infinitely many! “Languages that can be decided by some TM using less than 37 steps” is a complexity class

15 Lecture 21: Introducing Complexity Interesting Complexity Classes “interesting” complexity classes (and counting)!

16 Lecture 21: Introducing Complexity The “Petting Zoo” “Under construction! Once finished, the Petting Zoo will introduce complexity theory to newcomers unready for the terrifying and complex beasts lurking in the main zoo.” cs302 We will only get to the entrance of the “Petting Zoo”. But, even here there are “terrifying and complex beasts lurking”!

17 Lecture 21: Introducing Complexity The Most Terrifying Beast: Subject of Ultimate Mystery Decidable Tractable NP Option 1: There are problems in Class NP that are not tractable Option 2: All problems in Class NP are tractable Decidable Tractable NP

18 Lecture 21: Introducing Complexity P = NP ? We need a couple more classes before explaining this (but will soon) This is an open question: no one knows the answer –If you can answer it, you will receive fame, fortune, and an A+ in cs302! –But, you should get some insight into what an answer would look like, and what it would mean

19 Lecture 21: Introducing Complexity Orders of Growth

20 Lecture 21: Introducing Complexity Order Notation O( f ),  ( f ), o( f ),  ( f ) Warning: you have probably seen some of these notations before in cs201 and cs216. What you learned about them there was probably (somewhat) useful but incorrect. (Note: if you learned them in cs150, then you learned them correctly.)

21 Lecture 21: Introducing Complexity Order Notation O( f ),  ( f ), o( f ),  ( f ) These notations define sets of functions –Generally: functions from positive integer to real We are interested in how the size of the outputs relates to the size of the inputs

22 Lecture 21: Introducing Complexity Big O Intuition: the set O(f) is the set of functions that grow no faster than f –More formal definition coming soon Asymptotic growth rate –As input to f approaches infinity, how fast does value of f increase –Hence, only the fastest-growing term in f matters: O(12n 2 + n)  O(n 3 ) O(n)  O(63n + log n – 423)

23 Lecture 21: Introducing Complexity Examples O(n3)O(n3) O(n2)O(n2) f(n) = n 2.5 f(n) = 12n 2 + n f(n) = n 3.1 – n 2 Faster Growing

24 Lecture 21: Introducing Complexity Formal Definition f  O (g) means: There are positive constants c and n 0 such that f(n)  cg(n) for all values n  n 0.

25 Lecture 21: Introducing Complexity O Examples x  O (x 2 ) ? Yes, c = 1, n 0 =2 works fine. 10x  O (x) ? Yes, c = 11, n 0 =2 works fine. x 2  O (x) ? No, no matter what c and n 0 we pick, cx 2 > x for big enough x f (n)  O (g (n)) means: there are positive constants c and n 0 such that f(n)  cg(n) for all values n  n 0.

26 Lecture 21: Introducing Complexity Lower Bound:  (Omega) f(n) is  (g (n)) means: There are positive constants c and n 0 such that f (n)  cg(n) for all n  n 0. Difference from O – this was 

27 Lecture 21: Introducing Complexity O(n3)O(n3) O(n2)O(n2) f(n) = n 2.5 f(n) = 12n 2 + n f(n) = n 3.1 – n 2 Where is  (n 2 ) ? (n2)(n2) Faster Growing

28 Lecture 21: Introducing Complexity (n3)(n3) (n2)(n2) f(n) = n 2.5 f(n) = 12n 2 + n f(n) = n 3.1 – n 2 O(n2)O(n2) Slower Growing Inside-Out

29 Lecture 21: Introducing Complexity Recap Big-O: the set O(f) is the set of functions that grow no faster than f –There exist positive integers c, n 0 > 0 such that f(n)  cg(n) for all n  n 0. Omega (  ): the set Ω(f) is the set of functions that grow no slower than f –There exist positive integers c, n 0 > 0 s.t. f(n)  cg(n) for all n  n 0.

30 Lecture 21: Introducing Complexity O(n3)O(n3) O(n2)O(n2) f(n) = n 2.5 f(n) = 12n 2 + n f(n) = n 3.1 – n 2 (n2)(n2) Faster Growing What else might be useful?

31 Lecture 21: Introducing Complexity Theta (“Order of”) Intuition: the set  (f ) is the set of functions that grow as fast as f Definition: f (n)   (g (n)) if and only if both: 1. f (n)  O (g (n)) and 2. f (n)   (g (n)) –Note: we do not have to pick the same c and n 0 values for 1 and 2 When we say, “ f is order g ” that means f (n)   (g (n))

32 Lecture 21: Introducing Complexity O(n3)O(n3) O(n2)O(n2) f(n) = n 2.5 f(n) = 12n 2 + n f(n) = n 3.1 – n 2 (n2)(n2) Faster Growing Tight Bound Theta (  ) (n2)(n2)

33 Lecture 21: Introducing Complexity Summary Big-O: there exist c, n 0 > 0 such that f(n)  cg(n) for all n  n 0. Omega (  ): there exist c, n 0 > 0 s.t. f(n)  cg(n) for all n  n 0. Theta (  ): both O and  are true When you were encouraged to use Big-O in cs201/cs216 to analyze the running time of algorithms, what should you have been using?

34 Lecture 21: Introducing Complexity Algorithm Analysis In Big-O notation, what is the running time of algorithm X? O(n n n n ) This is surely correct, at least for all algorithms you saw in cs201/cs216. Should ask: In Theta notation, what is the running time of algorithm X? Given an algorithm, should always be able to find a tight bound.

35 Lecture 21: Introducing Complexity Complexity of Problems So, why do we need O and Ω ? We care about the complexity of problems not algorithms. The complexity of a problem is the complexity of the best possible algorithm that solves the problem. Revised exam answers are due at beginning of class Tuesday.