4.2 Counting Machines and Languages How many different Turing Machines are there? How many different Languages are there? If you could show that there are more Languages than there are TMs, what could you conclude about languages that are not Turing Recognizable? How do you compare the sizes of two finite sets? How can you compare the sizes of two finite sets without counting? pair each item from one set with an item from the other Show the two sets are the same size. A = {a, b, c} B = {x, y, z} How do you define this pairing using a function from A to B? two sets A and B can be paired (are same size) if there is a correspondence (bijection) from A to B What's a correspondence (bijection)? a total function that is both one-to-one and onto What's a one-to-one function? if a != b then f(a) != f(b) always maps different domain values to different range values What's an onto function? for every b in B there is an a in A such that f(a) = b maps something to every value in the range How do you compare the sizes of two infinite sets? Can you count the number of items in each set? Are the two sets the same size? Isn't set A larger than set B (since B is a proper subset of A)? A = {0, 1, 2, 3, ...} B = {1, 2, 3, ...} f(n) = n+1 is a bijection from A to B so A and B are the same size What's a Countable set? a set A is countable if it is either finite or has the same size as N (natural numbers) (there is a bijection from N to A) the items from A can be listed, such that every item appears exactly once Is the set N x N countable? (N x N = { (i,j) | i,j > 0 }) (N x N is the set of pairs of natural numbers) Isn't this set much larger than N? How do you show that N x N is countable (the same size as N)? make an infinite two-dimensional table row i and column j in the table contains the pair (i,j) list the elements from table along diagonals starting in the corner (1,1), (2,1), (1,2), (3,1), (2,2), (1,3), ... For a given finite alphabet Sigma, is the set Sigma* countable? How do you show that Sigma* is countable? since there are a finite number of strings of each length list the strings of length 0, then length 1, length 2, etc Is the set of all TMs countable? How do you show that the set of all TMs is countable? each TM M can be encoded into a string the set of all TMs is a set of strings list all strings that are legal encodings of TMs How many different Turing Machines are there? Is every infinite set countable? Is every infinite set the same size? What's an Uncountable set? an infinite set that can't be paired with N What's the set of Real Numbers? Is the set of Real Numbers countable? How do you show that the set of Real Numbers is uncountable? Why is this called a diagonalization argument? assume the set R is countable (proof by contradiction) then you can list all the reals so that each appears once list the reals in an infinite table, one number per row position a[i][j] in the table is the jth digit of the ith number construct a real number x that can't be in the table make the kth digit of x different from digit a[k][k] in the table then x must be different from every number in the table Construct a number different from any in the table. 1.1 1 1 1 ... 0.1 2 3 4 ... 0.1 2 4 8 ... 2.4 4 4 4 ... What's an infinite binary sequence? an unending sequence of 0s and 1s Is the set of all infinite binary sequences countable? How do you show that the set of all infinite binary sequences is uncountable? use a diagonalization argument problem 4.7 on the homework What's the set of all languages over an alphabet Sigma? a set of sets of strings from Sigma* Is the set of all languages over an alphabet Sigma countable? Suppose you list Sigma* as an infinite list of strings {s1, s2, s3, ...}. How can you use this list and an infinite binary string to define a language? bits in the binary string indicate which strings are in the language if s[i] is in the language, the ith bit is 1 if s[i] is not in the language, the ith bit is 0 Is it possible to pair every language with a unique infinite binary sequence? Is there a correspondence (bijection) between the set of languages and the set of infinite binary sequences? What do you conclude about the set of languages? How many different Turing Machines are there? How many different Languages are there? How do the number of Turing Machines compare to the number of languages? What do you conclude about Languages?