Instructor: Aaron Roth

Slides:



Advertisements
Similar presentations
Algorithms Sipser 3.3 (pages ). CS 311 Fall Computability Hilbert's Tenth Problem: Find a process according to which it can be determined.
Advertisements

Turing Machines Memory = an infinitely long tape Persistent storage A read/write tape head that can move around the tape Initially, the tape contains only.
Variants of Turing machines
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)
CS5371 Theory of Computation Lecture 11: Computability Theory II (TM Variants, Church-Turing Thesis)
1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Rules have form String of variables and terminals String of variables and terminals.
Theory of Computing Lecture 20 MAS 714 Hartmut Klauck.
Prof. Busch - LSU1 Turing Machines. Prof. Busch - LSU2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
CS5371 Theory of Computation Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)
 Computability Theory Turing Machines Professor MSc. Ivan A. Escobar
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
TM Design Macro Language D and SD MA/CSSE 474 Theory of Computation.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
Fundamentals of Informatics Lecture 13 Reduction Bas Luttik.
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich
1 Section 13.1 Turing Machines A Turing machine (TM) is a simple computer that has an infinite amount of storage in the form of cells on an infinite tape.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
1 Introduction to Turing Machines
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 12 Mälardalen University 2007.
Chapter 9 Turing Machines What would happen if we change the stack in Pushdown Automata into some other storage device? Truing Machines, which maintains.
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Decidability.
Chapters 11 and 12 Decision Problems and Undecidability.
Cpt S 317: Spring 2009 Reading: Chapter 8
Turing’s Thesis Costas Busch - LSU.
8. Introduction to Turing Machines
More variants of Turing Machines
Busch Complexity Lectures: Turing Machines
Busch Complexity Lectures: Reductions
Reductions Costas Busch - LSU.
Turing Machines.
Pumping Lemma Revisited
CSE 105 theory of computation
Cpt S 317: Spring 2009 Reading: Chapter 8
LIMITS OF ALGORITHMIC COMPUTATION
Turing Machines 2nd 2017 Lecture 9.
CSE 105 theory of computation
Turing Machines Acceptors; Enumerators
Chapter 9 TURING MACHINES.
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
Jaya Krishna, M.Tech, Assistant Professor
Turing Machines (TM) Deterministic Turing Machine (DTM)
Decidable Languages Costas Busch - LSU.
8. Introduction to Turing Machines
CS21 Decidability and Tractability
MA/CSSE 474 Theory of Computation
Formal Languages, Automata and Models of Computation
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
CSE 105 theory of computation
CSE 105 theory of computation
Instructor: Aaron Roth
Decidability continued….
Instructor: Aaron Roth
Instructor: Aaron Roth
Variants of Turing machines
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
Instructor: Aaron Roth
CSE 105 theory of computation
Presentation transcript:

Instructor: Aaron Roth aaroth@cis.upenn.edu CIS 262 Automata, Computability, and Complexity Spring 2019 http://www.seas.upenn.edu/~cse262/ Instructor: Aaron Roth aaroth@cis.upenn.edu Lecture: March 11, 2019

Recap: Turing machines: Syntax A TM M consists of A finite set Q of states Initial state q0 (belongs to Q) Accepting state qa (belongs to Q) Rejecting state qr (belongs to Q and different from qa) Tape alphabet G Input alphabet S (a subset of G) Blank symbol _ (belongs to G \ S) Transition function d : Q x G  Q x G x {L, R} d(q, s) = (q’, g, L/R) means that in state q, if current tape cell contains s, then write g, move left/right, and goto state q’

Recap: Turing Machines: Semantics Consider TM M = (Q, q0, qa, qr, G, S, _, d ) Configuration C = (u, q, v) such that u, v are strings over G and q in Q Accepting configuration: q = qa Rejecting configuration: q = qr, or u = e and transition says move left Halting configuration: Accepting/rejecting configuration One-step execution semantics: for non-halting configuration C, Next(C) is the configuration resulting from executing one transition of M Execution of M on input w is the unique sequence of configurations C0, C1, C2, … such that 1. C0 = (e, q0 , w ) is the initial configuration 2. For each i, Ci+1 = Next ( Ci ) 3. Either sequence is infinite, or Ck is halting configuration L(M) = {w | Execution of M on w is finite ending in accepting configuration}

Halting Turing Machines A Turing machine M is said to be halting if for every input w, the execution of M on w is finite/terminating Halting TM == Programs that are guaranteed not to enter infinite loops Machine from last class for palindromes is a halting TM

Decidable Languages A language L is called “decidable” if there exists a halting Turing machine M such that L(M) = L that is, there is a TM M that given an input w, if w is in L, halts in the accepting state and otherwise, halts in the rejecting state Decidable language == Solvable problem Example: PALINDROMES = { w | w is a palindrome } is decidable

Every Regular Language is Decidable A language L is regular if there is a DFA M such that L(M) = L Clearly, a TM can do what a DFA can, and also guarantee halting More precisely, suppose M = (Q, S, q0, F, d) Corresponding halting TM M’: keep moving right over input updating state as M does upon _, i.e. end of input, accept or reject based on whether state is in F States = Q U {qa, qr } G = S U { _ } d’(q, s) = (d(q, s), s, R) d’(q, _ ) equals qa if q is in F and qr otherwise

Checking Primality PRIMES = { 0p | p is a prime number } Clearly there is a terminating program that checks whether the length is a prime number, so PRIMES must be decidable But let’s build a halting TM M

Checking Primality PRIMES = { 0p | p is a prime number } High-level algorithm: if p=0 or p=1, then accept else { i = 2; while (i < p) { if p is a multiple of i, then stop and reject; i = i+1; }; accept }

TM for PRIMES 0 0 … 0 _ _ _ _ First check if input is e or 0, accept if so If not, add # at the beginning, and replace first two 0’s by 1’s # 1 1 0 0 … 0 _ _ Given input # 1i 0j, (note: original p equals i+j) if j = 0, then p is a prime, accept else if j is a multiple of i, then p is not a prime, reject else replace first 0 by 1 (that is, increment i) and repeat

TM for PRIMES # 1 1 0 0 … 0 _ _ Given input # 1i 0j, with i>=2 and j!=0, check if j is a multiple of i High-level algorithm: Repeatedly subtract i from j till it becomes 0 Intermediate tape contents: # 1i 2a 0b , where a+b=j Initially: a=0 and b=j Repeat{ if (b=0) then stop, j is a multiple of i else if (b < i) then stop, j is not a multiple of i else { a = a+i; b = b-i } } Change 0 to 2 for each 1

TM for PRIMES # 1 … 1 0 … 0 _ _ s0 Given input # 1i 0j, with i>=2 and j!=0, check if j is a multiple of i Assume head is pointing to first 1 in state s0 Cross off 1 with x 1/x,R s0 s1

TM for PRIMES # x 1 … 1 0 … 0 _ _ Move right searching for 0 1/x,R If 0 found, replace it with 2 s0 s1 0/2,L x/R s2 And keep moving left till first 1 1, 2/ L

TM for PRIMES # x x … 1 2 … 2 0 … 0 _ _ s1 What if no 0 found in state s1? 1, 2/ R 1/x,R b (i.e. left over j) < i Conclude j is not a multiple of i s0 s1 _ / L 0/2,L x/R s3 s2 1, 2/ L

TM for PRIMES # x x … x 2 … 2 0 … 0 _ _ What if no 1 left in state s0 ? 1, 2/ R 1/x,R i has been subtracted from j: if more 0’s left, subtract again else j is a multiple of i s0 s1 _ / L 2/R 0/2,L x/R s3 2/R s4 s2 _ 1, 2/ L 0/L s5 qr

TM for PRIMES # x x … x 2 … 2 0 … 0 _ _ From state s5 go back left to 1/x,R s0 s1 _ / L 2/R 0/2,L x/R # / R s3 2/R s4 s2 _ 1, 2/ L 0/L s5 From state s5 go back left to subtract again in state s0 but make sure to restore i by changing x’s back to 1’s qr 2 /L x / 1, L

TM for PRIMES # x x … 1 2 … 2 … 2 _ _ State s3 : 1/x,R s0 s1 _ / L 2/R 0/2,L x/R 1,x/R 0/1,L # / R s3 s6 s7 2/R s4 s2 _ 0,1 /L x / 1, L 2/0, L 1, 2/ L 0/L s5 qr 2 /L x / 1, L State s3 : j is not a multiple of i clean-up: change 2’s to 0’s and x’s to 1’s increment i (change one 0 to 1)

TM for PRIMES # 1 … 1 0 … 0 _ _ State s7 : 0,1/ L # 1 … 1 0 … 0 _ _ s9 0 / L s7 # / R 1, 2/ R s8 1/R 1/x,R s0 s1 # / R _ / L 2/R 0/2,L 0/1,L x/R 1,x/R # / R s3 s6 s7 2/R s4 s2 _ 0,1 /L x / 1, L 2/0, L 1, 2/ L 0/L s5 qr 2 /L x / 1, L State s7 : if # encountered, should we go back to s0 ? only after checking j != 0 (i.e. there is a 0)

TM for PRIMES # 1 … 1 _ _ State s8 : if _ encountered, 0,1 / L # 1 … 1 _ _ s9 qa 0 / L s8 # / R _ 1, 2/ R s8 1/R 1/x,R s0 s1 # / R _ / L 2/R 0/2,L 0/1,L x/R 1,x/R # / R s3 s6 s7 2/R s4 s2 _ 0,1 /L x / 1, L 2/0, L 1, 2/ L 0/L s5 qr 2 /L x / 1, L State s8 : if _ encountered, j=0, i has reached p, p must be a prime

Completing the machine _ s9 qa q0 0 / L _ 0/#,R # / R _ 1, 2/ R s8 1/R q1 0/1,R 1/x,R s0 s1 # / R q2 _ / L _ /1,L 2/R 0/2,L 0/1,L 0/1,R x/R 1,x/R # / R s3 s6 s7 q3 2/R s4 s2 _ /0,L _ 0, 1 /L x / 1, L 2/0, L 0, R 1, 2/ L 0/L s5 qr 2 /L x / 1, L Initially, if input is e or 0, accept, else insert # at the beginning, and replace first two 0’s by 1’s

TM for PRIMES This TM M is a halting TM _ s9 qa q0 0 / L _ 0/#,R # / R _ 1, 2/ R s8 1/R q1 0/1,R 1/x,R s0 s1 # / R q2 _ / L _ /1,L 2/R 0/2,L 0/1,L 0/1,R x/R 1,x/R # / R s3 s6 s7 q3 2/R s4 s2 _ /0,L _ 0, 1 /L x / 1, L 2/0, L 0, R 1, 2/ L 0/L s5 qr 2 /L x / 1, L This TM M is a halting TM L(M) = PRIMES = { 0p | p is a prime }

Exercise: Checking Primality PRIMES = { 0p | p is a prime number } if p=0 or p=1, then accept else { i = 2; while (i < p) { if p is a multiple of i, then stop and reject; i = i+1; }; accept } If p is not a multiple of i, then we should cross off all i’ such that i’ < p and i’ is a multiple of i There is no need to check if p is a multiple of such i’ Modify the TM we just constructed to implement this optimization

Decidable Languages A language L is called “decidable” if there exists a halting Turing machine M such that L(M) = L Examples: PALINDROMES = { w | w is a palindrome } is decidable PRIMES All regular languages { w | count(w, a) = count(w, b) } … All problems that can be solved by correct, terminating programs

Beyond Decidable Languages Consider TM M L(M) = { w | M halts on w in its accepting state } A language L is called “recognizable” or equivalently, “recursively enumerable” (RE), if there exists a TM M such that L(M) = L Weaker notion than decidable languages: L is decidable implies that L is recognizable, but not conversely

Hilbert’s 10th problem Given a multi-variable polynomial with integer coefficients, are there integer values for the variables that make the polynomial 0 ? Input: x2 – 1 Answer: Yes Input: x2 + 1 Answer: No Input: x2y –yz3 +367xyz -1564 Answer: ?? Hilbert’s challenge (1900): Find a systematic procedure (i.e. an algorithm) for this problem

Hilbert’s 10th problem Given a multi-variable polynomial p(x1, x2, … xn) with integer coefficients, are there integer values for the variables that make the polynomial 0? Plausible strategy: Systematically try out all integer combinations of the values for the n variables, and for each combination, evaluate p, and stop saying YES if the result is 0 Challenge: when should we stop and conclude that there are no integer roots ?

Hilbert’s 10th problem HILBERT10 = {p(x1, x2, … xn) | there exist integers c1, c2, … cn such that p(c1, c2, … cn) = 0 } Program P to “solve” HILBERT10: k = 0; repeat { for all integer vectors [c1, c2, … cn] with –k <= ci <= +k, for each i, if p(c1, c2, … cn) = 0, then STOP and ACCEPT; k = k + 1 } Claim: if input polynomial belongs to HILBERT10, then P stops and accepts L(P) = HILBERT10 Using same idea, one can build a TM M such that L(M) = HILBERT10

Recognizable Languages There is a TM that accepts HILBERT10, though it is not a halting TM (and in fact, if input polynomial does not have integer roots, our machine will loop forever) This means that HILBERT10 is a recognizable language Is HILBERT10 a decidable language ? The fact that our solution was not a halting TM does not imply anything But… in 1970, Matiyasevich proved that HILBERT10 is undecidable ! there is no halting TM to solve this problem

Recognizable Languages L is recognizable intuitively means that it is possible to design a program/TM M such that M can systematically check if input meets the requirement of L but has no scheme for checking the negation M gives only correct answers, but may not terminate when input is not in L Why study this class? There are many interesting problems that are recognizable but not decidable Furthermore, there are many problems that are not even recognizable!

Problem Classification REGULAR DECIDABLE HILBERT10 a*b PRIMES RECOGNIZABLE ALL LANGUAGES