1 / 20

Introduction to CS Theory

This course explores basic discrete math concepts such as sets, functions, and logic, focusing on decision problems and languages. Topics include models of computation, Chomsky Hierarchy, and language operations.

dmicheal
Download Presentation

Introduction to CS Theory

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to CS Theory Lecture 1 – Introduction Piotr Faliszewski pf@cs.rit.edu

  2. Introduction • Instructor • Piotr Faliszewski • Office: 70-3575 • Email: pf@cs.rit.edu • Course website: • http://www.cs.rit.edu/~pf/theory/ • Office hours • Monday through Thursday • 2pm—4pm

  3. Logistics • Look at the courses website! • Important highlights • Cooperation on homeworks • Teams of two allowed • Both people get the same grade—you cannot complain about your teammate not working • Quizzes! • Disputing your grade • At most a week after you received the grade • Discrete math quiz • Next Monday

  4. Introduction • This is a course in mathematics! • Basic discrete math • Dealing with sets, functions, sequences etc. • Logic • Inductive proofs (!!!) • Goals of the course • Understand the nature of computation • Develop problem solving skills • Increase mathematical sophistication You should already be familiar with those, but we will review a bit as well

  5. Computer Science Needs Precision! From a letter of Charles Babbage to Alfred Tennyson in response to his poem "The Vision of Sin“: "In your otherwise beautiful poem, one verse reads, Every moment dies a man, Every moment one is born. ... If this were true, the population of the world would be at a standstill. In truth, the rate of birth is slightly in excess of that of death. I would suggest: Every moment dies a man, Every moment 1 1/16 is born. Strictly speaking, the actual figure is so long I cannot get it into a line, but I believe the figure 1 1/16 will be sufficiently accurate for poetry."

  6. Two fundamental questions about computation What can and cannot be computed? What can and cannot be computed efficiently? But, before we can answer these… What IS computation? What PROBLEMS do we want to solve? What is computation? Many different models of a computer Finite automata Push-down automata Turing machines Decision problems and languages What is this course about?

  7. Decision problem Name Input the mathematical entities about whose properties we ask Question A well-defined yes/no question Language A set of strings Languages encode decision problems Example Name: Connectivity Input: Graph G, vertices s and t Question: Are vertices s and t connected in G Languages and Decision Problems

  8. Our two fundamental questions What decision problems can and cannot be solved? What decision problem can and cannot be solved efficiently We focus on languages Chomsky Hierarchy Models of computation Regular languages / finite automata Context-free languages / push-down automata Turing machines Languages and Decision Problems

  9. Hierarchy of Languages All languages Recursive languages Finite languages Context-freelanguages

  10. Effectively Decidable Languages Recursive languages NP P Context-freelanguages Regularlanguages

  11. And now… • Let’s get some real work done! • Your responsibility: Part I of the book • But, I will cover: • Languages • Mathematical induction

  12. Language A set of strings over some alphabet Alphabet A finite set of indivisible objects, usually denoted as Σ Examples {0, 1, 2, …, 9} {0, 1} {a, b, c, …, z} {1} String A string over Σ is a finite, possibly empty, sequence of elements of Σ Some strings over {0,1}: ε empty string 0, 1, 001, 01010101 Examples of nonstrings (for alphabet {0,1}) 012011 11111… Length of a string x |x| Examples? 1.5 Languages

  13. Set of all strings Σ* -- set of all strings over Σ {0,1}* {a}* We can define languages via set operations Intersection, union Difference Complement operation L = Σ* - L Defining Languages • Examples of languages L1 = { x  {0,1}* | x contains at least as many 0s as 1s} L2 = { x  {0,1}* | x contains at least as many 1s as 0s} L3 = {ε} L4 = { x  {0,1}* | x viewed as an integer is a prime} L5 = L1  L2 L6 = L1

  14. Let x, y  Σ* Some operations on strings xy – concatenation xi – concatenation of x i times with itself x is a substring of y if there are strings w and z such that y=wxz x is a prefix of y if there is a string z such that y=xz x is a suffix of y if there is a string z such that y=zx Examples x = ab y = aabb xy = abaabb xε = x = εx x3 = xxx = ababab x0 = ??? x is a substring of y z = bb z is a suffix of y x is a prefix of x Operations on Strings

  15. Let L, L1, L2 be languages over the same alphabet Σ L1L2 = {xy | x in L1 and y in L2} – the concatenation of two languages Li – concatenation of i L’s What is L0? L* = L0  L1  L2  L3  …  Kleene’s starL+ = LL* = L*L Exercises Is there a language L such that L* is finite? Let L1, L2 be two finite languages. What is the cardinality of L1L2 Is there a language such that L = L*? Operations on Languages

  16. Mathematical induction Technique to prove facts about finite entities E.g., properties of integers Inductive proof: Base case Inductive step Intuition … a little like a for loop in a program: we construct the proof in iterations. Theorem. Let A be a finite set with n elements. There are 2n distinct subsets of A. Proof. Base: A =  Inductive step: Assume that the theorem holds for all natural numbers up to k. Let A be a set with k+1 elements and B an arbitrary subset of k elements of A. Let x be such that: A = B  {x} By the inductive assumption, B has 2k subsets. Thus A has 2k+1 subsets. (Why?) Mathematical Induction

  17. Let us prove the following: Σ = {0,1}, each string x such that x = 0y1, where y Σ*, contains 01 as a substring For every natural number n, n ≥ 2, n either is a prime or a product of two or more primes How about the following theorem: For every natural number n it holds that n! > 2n Mathematical Induction – Examples And I can prove by induction that all horses are of the same color!

  18. Recursive definition Define a small set of basic entities Show how to obtain larger ones from those already constructed A bit like induction! Examples Factorial 0! = 1 For each natural n, (n+1)! = (n+1)*n! Recursive definition of Σ*: εΣ* If x Σ* and a Σ then xa Σ* Nothing is in Σ* unless it is obtained by the two previous rules. Recursive Definitions

  19. Two exercises Give a recursive definition of the length of a string. Give a recursive definition of a reverse of a string. Palindromes A string is a palindrome if it reads the same backward and forward Let’s define a language of palindromes! Language L of palindromes, Σ = {a, b}. ε L If x  L then both axa and bxb belong to L. Nothing belongs to L unless it is obtained by rules 1 and 2. Recursive Definitions – Examples Hmm… This looks wrong to me!

  20. Language L of all strings with as many 0s as 1s. (Σ = {0,1}) ε L For any x in L it holds that each of: 0x1 1x0 01x 10x x01 x10 belongs to L. Is this definition correct? Exercise Prove that for each string x over alphabet Σ it holds that |x| = |xr| xr is the reverse of x Structural induction! Recursive Definitions – Examples

More Related