170 likes | 176 Views
Computability. Universal Turing Machine. Countability . Halting Problem. Homework: Show that the integers have the same cardinality (size) as the natural numbers. Postings. Enumerator definition?. Need to describe parts… Transition function Output. Universal Turing Machine.
E N D
Computability Universal Turing Machine. Countability. Halting Problem. Homework: Show that the integers have the same cardinality (size) as the natural numbers. Postings.
Enumerator definition? • Need to describe parts… • Transition function • Output
Universal Turing Machine … is a Turing Machine U in which the input comes in two parts: • Description/encoding of a Turing Machine M and • Input string w U (<M,w>) is the same as M(<w>) • Accepts if M accepts w • Rejects if M rejects w • Loops (fails to halt) if M fails to halt
Claim We can build such a U. • Use 3 tapes. • For initial information (definition of M and w) • Hold status info for which state of M and position in w • Working tape. • First step is to set up tape 2 with initial state and starting position and tape 3 with w. • Operation: states of U use status to simulate M operating on tape 3.
Stored program • The notion of a universal [Turing] machine MAY have helped in development of stored programs. • Note: calculators do not have stored programs. • The notion of a program being treated as data, such as done when compiling or interpreting code, was critical in the development of computers. • Topic: research idea.
Last class • Atm = {<M,w>|M is a TM and w is a string and M accepts w} is • Turing recognizable because U recognizes it. • May not halt because U [only] simulates M and M may not halt. • But maybe another technique could be better than M... • This is the halting problem
Digression: infinite sets • How do we compare infinite sets? • Certainly, • the counting numbers (1, 2, 3, …) are contained in • the integers( 0, 1, 2, …, -1, -2, …) are contained in • the rationals (all numbers of the form p/q, where p and q are integers) are contained in • the reals (numbers with decimals, possibly infinite)
New concept: cardinality [Note: Sipser uses size.] Georg Cantor (1873) noticed that two finite sets are the same size if the elements in each can be paired. Definition: Two sets A & B have the same cardinality (size?) if there exists a function f: A → B, that is 1 to 1 and onto1 to 1 means: if f(a) = f(b) then a=b. onto means: if b is in B, then there is an a such that f(a) = b
Example • The natural numbers N are the same cardinality as the even natural numbers! • Let f(n) = 2* n. This is 1 to 1 and onto!
Countable • A set is countable if it is finite OR if it has the same cardinality as the natural numbers. • My words: a set of countable if you can put all the elements in a list (describe the list in the case of an infinite set).
Rationals are countable! Construct a table. Redundant numbers will be removed. Red line represents the list…. 1/1 ½ 1/3 ¼ 1/5 … 2/1 2/2 2/3 2/4 2/5 …. 3/1 3/2 3/3 ¾ 3/5 …
Are the reals countable? Proof by contradiction. • Suppose there is a list: 1.0000000000… 3.14159…… .111222333… …. Let x by a number such with whole number 1 and number at ith position from decimal point is NOT equal to the ith position of the ith element on the list. Avoid 0 or 9. Then x is NOT on the list!
Diagonalization • General technique, possible only if there is a list….
Halting Problem Atm = {<M,w>|M is a TM and w is a string and M accepts w} is undecidable. Proof: assume that H is a decider for Atm. Define a new Turing Machine D as follows: D(<M>) : run H on (M, <M>). Output reject if H accepts and accept if H rejects. (Like the diagonalization). Claim: if H exists, then we can build D that calls it as a subroutine.
Proof, continued Then, what is D(<D>)? Run H(D, <D>). By definition, this is D running on <D>. If H returns accept (D running on <D> accepts) then H rejects. If it rejects, then accept. Contradiction! Contradiction arises because H could not be built to be used by D.
Practical implications • Before there were computers, mainly stored program computers, there is a result that there can't be full-proof debuggers/checkers.
Homework • Produce proof that the integers are countable. • Posting on practical implications of Halting problem. • Posting on history / origin of stored program concepts.