1 / 29

15-453 FLAC Lecture 19 Turing Machines and Real Life * Reductions

15-453 FLAC Lecture 19 Turing Machines and Real Life * Reductions. Mihai Budiu March 3, 2000. A Turing Machine solves one problem. We must distinguish between The set of all strings A problem (e.g. the language to be accepted) A problem instance (e.g. a word from the language)

seanna
Download Presentation

15-453 FLAC Lecture 19 Turing Machines and Real Life * Reductions

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. 15-453 FLACLecture 19Turing Machines and Real Life*Reductions Mihai Budiu March 3, 2000

  2. A Turing Machine solves one problem • We must distinguish between • The set of all strings • A problem (e.g. the language to be accepted) • A problem instance (e.g. a word from the language) • A TM solves each instance presented as input S* L w FLAC: Reductions

  3. First computers: custom computing machines Input tape (read only) Control Work tape (memory) 1950 -- Eniac: the control is hardwired manually for each problem. Output tape (write only) FLAC: Reductions

  4. Input tape (read only) Control Work tape (memory) Output tape (write only) TMs can be described using text • Program • n states • s letters for alphabet • transition function: • d(q0,a) = (q1, b, L) • d(q0,b) = (q1, a, R) • …. Consequence: There is a countable number of Turing Machines FLAC: Reductions

  5. There is a TM which can simulate any other TM(Alan Turing, 1930) Input tape Program Universal TM Work tape (memory) Output tape Interpreter FLAC: Reductions

  6. The Digital Computer: a UTM Machine code Input Universal TM Memory + disk Output Machine-code Interpreter FLAC: Reductions

  7. Random Access Memories x x Row access Sequential access tape Column access Address FLAC: Reductions

  8. Turing machines as functions S* w Input word TM f S* Output word f(w) A function f is a computable function if a TM with word w as input halts with f(w) as output. FLAC: Reductions

  9. Computable functions • Many functions encountered in everyday life are computable: • Addition : binary strings * binary strings -> binary strings • Sort : sequence of strings -> sequence of strings • Roots : polynomial -> sequence of integer roots [pg 144] • A TM which decides a language computes a function from the set of all words to {y,n} • There are many uncomputable functions: • |funs : N -> N| = uncountable • |TMs| = countable FLAC: Reductions

  10. Compilers: computable functions Translator TM Compiler FLAC: Reductions

  11. Multiple levels of virtualization Ex: running a BASIC interpreter written in Java Basic program Basic interpreter Java interpreter CPU FLAC: Reductions

  12. The operating system: another (multi-tape) universal turing machine OS Process 1 Process 2 Operating system CPU FLAC: Reductions

  13. The operating system = dovetailing We used this technology in the proof of the last theorem during the last lecture: Theorem: L is decidable if and only if L and ~L are recognizable. Proof: execute in parallel recognizers for L and ~L and stop when the first stops. Process 1 Process 2 Operating system CPU FLAC: Reductions

  14. Reconfigurable Hardware Interconnection network Universal gates and/or storage elements Switches 0 0 0 1 a0 data a0 0 1 a1 & a2 a1 a1 1 1 Universal gate = RAM A switch is controlled by a 1-bit RAM cell FLAC: Reductions

  15. Reconfigurable hardware If (a) c = 2; Program Compiler Compiler Custom hardware (configuration) Generate a TM for a specific problem! Back to ENIAC! FLAC: Reductions

  16. < m Reductions between languages f : S* ->S*, computable f reduces L1 to L2 iff w in L1 <=> f(w) in L2 S* S* f L1 L2 f is called reduction. We write L1L2. FLAC: Reductions

  17. < m Reductions are useful • Notice that neither L1 or L2 must be decidable. • Theorem: if L1L2 and L2 is decidable • then L1 is decidable. • Proof: If M decides L2 and N computes a reductionf from L1 to L2, build a TM P which on input w: • Computes f(w) using N • Runs M on f(w) • Outputs the result of M. FLAC: Reductions

  18. < m Using reductions to prove undecidability • Use the converse of the previous theorem:if AB and A is undecidable, then B is undecidable. • We have seen two techniques to proveundecidability • The “diagonalization” proof • Reductions using this theorem. FLAC: Reductions

  19. Undecidability • We know that most problems are undecidable • Turing exhibited one natural undecidable problem: the Halting Problem (does a TM halt when given an input w?) • More than that: many important problems are undecidable • When you face a problem, you should be aware that it may be unsolvable: • You can search a solution • You can try to prove it has no solution (usu. by reduction) FLAC: Reductions

  20. Some undecidable problems • Does the TM M accept the word w? • Is a mathematical statement true? • Does a Diofantine equation have any roots? • Does a TM accept a regular language? • Does a CFG generate all words in S*? • Will a parallel system of processes ever deadlock? • Is there a smaller TM implementing the same function? • Are two programs computing the same thing? FLAC: Reductions

  21. Compilers and undecidability • The HP is about a language describing TMs • Many other problems concerning TMs are undecidable • Compilers cannot prove some properties of programs: • Does a C program access an array out of bounds? • Will ever a print instruction be executed? • Can these two pointers point to the same location? • Will a LISP program crash with a type error? • Can this memory location be garbage collected at some point? • Compilers behave conservatively FLAC: Reductions

  22. The full-employment theorem for compiler-writers Theorem: There is no best optimizing compiler for a general-purpose language. Proof: by reduction to the HP. Theorem: For any compiler, there’s a better one. Proof: we can always hardcode a program which doesn’t terminate. FLAC: Reductions

  23. Research in programming languages • Contrast the decision problems for regular and context-free languages with Turing machines. • Research in programming languages tries to get the best of both worlds: • Languages powerful enough to express useful computations • But restricted enough to guarantee program properties FLAC: Reductions

  24. < < m m Reduction examples Definition:FIN = { M | L(M) is finite } Theorem: FIN is not Turing-recognizable. ~FIN is not Turing-recognizable. Proof: We will show ~HP FIN ~HP ~FIN Notice that HP is Turing-recognizable HP is not Turing-decidable So ~HP is not Turing-recognizable. FLAC: Reductions

  25. A reduction from ~HP to FIN S* S* M#x f(M#x) f ~HP FIN • f(M#x) is the description of a TM M’ which on input y: • Erases the input y • Writes x on the input tape • Runs M on x • Accepts if M halts on x FLAC: Reductions

  26. Reducing ~HP to FIN (end) • f(M#x) is the description of a TM M’ which on input y: • Erases the input y • Writes x on the input tape • Runs M on x • accepts if M halts on x Notice that M halts on x L(M’) = S* M does not halt on x L(M’) = F (finite) Notice that f is computable: f does not run M, f just writes down a machine M’ which calls M on x FLAC: Reductions

  27. Part 2: Reducing ~HP to ~FIN S* S* M#x g g(M#x) ~HP FIN ~FIN • g(M#x) is the description of a TM M’’ which on input y: • Saves y • Writes x on the input tape • Runs M on x for |y| steps • Accepts if M does not halt before |y| steps FLAC: Reductions

  28. Reducing ~HP to ~FIN (end) • g(M#x) is the description of a TM M’’ which on input y: • Saves y • Writes x on the input tape • Runs M on x for |y| steps • Accepts if M does not halt before |y| steps M halts on x M does not halt on x L(M’’) = { y | |y| < run-time of M on input x } finite L(M’’) = S* Again: g is a computable function it just manipulates machine descriptions. FLAC: Reductions

  29. To remember • The theoretical notion of TM has profoundly influenced computer engineering • There are many important undecidable problems • Reductions are a tool to prove problems being undecidable (Note: we will see reductions again in complexity theory; we will use them to prove a problem is the hardest in a class of problems) FLAC: Reductions

More Related