TDDD65 Introduction to the Theory of Computation Lecture 1 Gustav Nordh Department of Computer and Information Science gustav.nordh@liu.se 2012-08-29 Outline - Lecture 1 Objectives and Motivation Contents Course Organization Basic Mathematical Notions Finite Automata Objectives and Motivation “Theoretical Computer Science (TCS) studies the inherent powers and limitations of computation, that is broadly defined to include both current and future, man-made and naturally arising computing phenomena.” Objectives and Motivation “Theoretical Computer Science (TCS) studies the inherent powers and limitations of computation, that is broadly defined to include both current and future, man-made and naturally arising computing phenomena.” The objective of this course is to give an introduction to 1 Formal Languages and Automata 2 Computability 3 Complexity Formal Languages and Automata What can be computed with very limited memory? Formal Languages and Automata What can be computed with very limited memory? Such memory restricted devices are all around us Formal Languages and Automata What can be computed with very limited memory? Such memory restricted devices are all around us Many applications within CS ranging from compiler construction and text search to computer opponents in video games Computability What can be computed at all? Computability What can be computed at all? Understanding the fundamental limits of computation including the limits of and any future “computers” Computability What can be computed at all? Understanding the fundamental limits of computation including the limits of and any future “computers” There are fundamental problems that cannot be solved. Complexity What can be computed efficiently? Complexity What can be computed efficiently? Understanding the fundamental limits of computation including the limits of and any future “computers” Complexity What can be computed efficiently? Understanding the fundamental limits of computation including the limits of and any future “computers” Some problems seems to require more resources to solve than others, for example coming up with a correct proof for a mathematical statement seems to take more time than verifying the correctness of a proof Complexity What can be computed efficiently? Understanding the fundamental limits of computation including the limits of and any future “computers” Some problems seems to require more resources to solve than others, for example coming up with a correct proof for a mathematical statement seems to take more time than verifying the correctness of a proof One of the most important open questions in all of mathematics Contents 1 Formal Languages and Automata (6h) Finite Automata and Regular Languages Pushdown Automata and Context-free Languages 2 Computability (3h) Turing machines and the notion of an Algorithm Problems that cannot be solved (Undecidability) 3 Complexity (6h) Big-O notation and analysis of algorithms Time-complexity classes, P, NP NP-completeness Space complexity? P vs NP? Course Organization Course Book: Michael Sipser. Introduction to the Theory of Computation, (2nd ed.), Thomson 2006 Webpage: www.ida.liu.se/∼TDDD65 Lectures Problem Solving Sessions Homeworks (1 ECTS) Exam (3 ECTS) Course Organization: Homeworks (1 ECTS) Two batches of obligatory homework The grade is pass/fail and to pass (and get your 1 ECTS) you need to pass both batches To pass a batch of homeworks you need to make a real effort on every problem and solve more than 2/3 of the problems correctly If you fail, you will have to wait and do the homeworks for next years course You need to sign up in webreg so that I can report your grade (follow the link on the homepage) Course Organization: Homeworks (1 ECTS) Collaboration policy: “General discussions about the homework problems is allowed (and encouraged). However, you must write up your own solutions separately. If your solution is heavily inspired by someone else’s ideas, please give proper credit in your write-up to the people with whom you worked. If you consult any reference material other than the textbook, please note on your homework which sources you used for each problem. You MUST understand all the solutions in your write-up and be prepared to explain them to me!” Course Organization: Exam (3 ECTS) Written exam: October (January, August, October,...) The grades are Fail/3/4/5 and will be your final grade for the course Basic Mathematical Notions: Strings and Languages Basic Mathematical Notions: Strings and Languages An alphabet is a finite set of symbols (denoted Σ, Γ) A string over Σ is a finite sequence of symbols from Σ Basic Mathematical Notions: Strings and Languages An alphabet is a finite set of symbols (denoted Σ, Γ) A string over Σ is a finite sequence of symbols from Σ Example 1010 is a string over Σ1 = {0, 1} theory is a string over Σ2 = {a, b, c, . . . , z} Basic Mathematical Notions: Strings and Languages An alphabet is a finite set of symbols (denoted Σ, Γ) A string over Σ is a finite sequence of symbols from Σ Example 1010 is a string over Σ1 = {0, 1} theory is a string over Σ2 = {a, b, c, . . . , z} The length of a string w (denoted |w|) is the number of symbols it contains. |1010| = 4, |theory | = 6 The empty string (denoted ε) is the string of length 0 The concatenation of strings x and y is written xy . x = slum and y = dog gives xy = slumdog. x k denotes the concatenation of x with itself k times. 015 0 = 0111110, x 2 y = slumslumdog. Basic Notions: Strings and Languages A language is a set of strings over an alphabet Σ∗ is the language consisting of all strings over Σ Basic Notions: Strings and Languages A language is a set of strings over an alphabet Σ∗ is the language consisting of all strings over Σ Union and intersection: A ∪ B = {x | x ∈ A or x ∈ B}, A ∩ B = {x | x ∈ A and x ∈ B} Complement: A = {x ∈ Σ∗ | x ∈ / A} Concatenation: AB = {xy | x ∈ A and y ∈ B} Basic Notions: Strings and Languages A language is a set of strings over an alphabet Σ∗ is the language consisting of all strings over Σ Union and intersection: A ∪ B = {x | x ∈ A or x ∈ B}, A ∩ B = {x | x ∈ A and x ∈ B} Complement: A = {x ∈ Σ∗ | x ∈ / A} Concatenation: AB = {xy | x ∈ A and y ∈ B} Ak denotes the concatenation of A with itself k times (note: A0 = {ε}) Star: A∗ = A0 ∪ A1 ∪ A2 ∪ . . . Examples of Languages Examples of Languages the set of odd binary numbers the set of prime numbers the set of syntactically correct Java programs the set of positive integer solutions to x n + y n = z n for n>2 the set of true mathematical statements