1 L= { u u R where u  {a, b}* } Last class we designed a TM which accepts this language (that is, it halts if the input is in L and hangs or computes.

Slides:



Advertisements
Similar presentations
David Evans cs302: Theory of Computation University of Virginia Computer Science Lecture 17: ProvingUndecidability.
Advertisements

CS 461 – Nov. 9 Chomsky hierarchy of language classes –Review –Let’s find a language outside the TM world! –Hints: languages and TM are countable, but.
Problem: Give as many proofs as you can for the Pythagorean Theorem. i.e., a 2 + b 2 = c 2 holds for any right triangle with sides a & b and hypotenuse.
1 Section 14.1 Computability Some problems cannot be solved by any machine/algorithm. To prove such statements we need to effectively describe all possible.
January 5, 2015CS21 Lecture 11 CS21 Decidability and Tractability Lecture 1 January 5, 2015.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
Courtesy Costas Busch - RPI1 A Universal Turing Machine.
1 Module 2: Fundamental Concepts Problems Programs –Programming languages.
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
Lecture 8 Recursively enumerable (r.e.) languages
Lecture 2: Fundamental Concepts
1 Module 2: Fundamental Concepts Problems Programs –Programming languages.
Recursively Enumerable and Recursive Languages
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
Fall 2004COMP 3351 The Chomsky Hierarchy. Fall 2004COMP 3352 Non-recursively enumerable Recursively-enumerable Recursive Context-sensitive Context-free.
Tutorial CSC3130 : Formal Languages and Automata Theory Tu Shikui ( ) SHB 905, Office hour: Thursday 2:30pm-3:30pm
1 Foundations of Software Design Fall 2002 Marti Hearst Lecture 29: Computability, Turing Machines, Can Computers Think?
Fall 2005Costas Busch - RPI1 Recursively Enumerable and Recursive Languages.
Fall 2004COMP 3351 A Universal Turing Machine. Fall 2004COMP 3352 Turing Machines are “hardwired” they execute only one program A limitation of Turing.
February 4, 2015CS21 Lecture 131 CS21 Decidability and Tractability Lecture 13 February 4, 2015.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
CSE 311 Foundations of Computing I Lecture 30 Computability: Other Undecidable Problems Autumn 2012 CSE 3111.
1 Undecidability Reading: Chapter 8 & 9. 2 Decidability vs. Undecidability There are two types of TMs (based on halting): (Recursive) TMs that always.
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
Great Theoretical Ideas in Computer Science about AWESOME Some Generating Functions Probability Infinity Computability With Alan! (not Turing) Mind-
1 Which languages do the following TM’s accept over the alphabet Σ={a, b}? Recall: A TM M accepts a language L defined over an alphabet Σ if M halts on.
CSE 311 Foundations of Computing I Lecture 26 Computability: Turing machines, Undecidability of the Halting Problem Spring
CSE 311 Foundations of Computing I Lecture 29 Computability: Turing machines, Undecidability of the Halting Problem Autumn 2012 CSE 3111.
Great Theoretical Ideas in Computer Science.
Halting Problem and TSP Wednesday, Week 8. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have.
1 Give the machine schema of a TM which when started like this: (q 0, #w[#]) for some string w in {a, b}* halts like this: (h, #001[#])
CS 3813: Introduction to Formal Languages and Automata Chapter 12 Limits of Algorithmic Computation These class notes are based on material from our textbook,
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Russell’s Paradox and the Halting Problem Lecture 24 Section 5.4 Wed, Feb 23, 2005.
1 Suppose I construct a TM M f which: 1. Preserves its input u. 2. Simulates a machine M b on input ε. 3. If M b hangs on input ε, force an infinite loop.
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
SNU OOPSLA Lab. 1 Great Ideas of CS with Java Part 1 WWW & Computer programming in the language Java Ch 1: The World Wide Web Ch 2: Watch out: Here comes.
1 Announcements: There is no problem of the day today (handing in your assignment will be used to indicate attendance so please hand in a sheet with your.
Powerpoint Templates Page 1 Powerpoint Templates Impossible Math Problems (or should we say, undecidable) Math Club 4/16/2012.
CSE 311 Foundations of Computing I Lecture 28 Computability: Other Undecidable Problems Autumn 2011 CSE 3111.
1 M is a TM with start state s defined over the alphabet {#,(,),0,1,a,q,,}: NumStateHead 0hL 1sR 2t# 3( 4) a 8q 9, 2. Does M halt on input “M”?
Recursively Enumerable and Recursive Languages
CISC105 – General Computer Science Class 4 – 06/14/2006.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
Undecidability and The Halting Problem
The Church-Turing Thesis Chapter Are We Done? FSM  PDA  Turing machine Is this the end of the line? There are still problems we cannot solve:
Turing Machines- Cont. Theory of Computation Lecture 11 Tasneem Ghnaimat.
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Another famous undecidable problem: The halting problem.
1 Recursively Enumerable and Recursive Languages.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Undecidable.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
1 A Universal Turing Machine. 2 Turing Machines are “hardwired” they execute only one program A limitation of Turing Machines: Real Computers are re-programmable.
Fall 2013 Lecture 27: Turing machines and decidability CSE 311: Foundations of Computing.
CIS Automata and Formal Languages – Pei Wang
Recursively Enumerable and Recursive Languages
CSE 311 Foundations of Computing I
CS154, Lecture 11: Self Reference, Foundation of Mathematics
Great Theoretical Ideas in Computer Science
Reducibility The Chinese University of Hong Kong Fall 2010
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
CSE 311 Foundations of Computing I
Decidable Languages Costas Busch - LSU.
Formal Languages, Automata and Models of Computation
Instructor: Aaron Roth
CS154, Lecture 11: Self Reference, Foundation of Mathematics
CSE 311: Foundations of Computing
Cpt S 317: Spring 2009 Reading: Chapter 8 & 9
CIS Automata and Formal Languages – Pei Wang
Presentation transcript:

1 L= { u u R where u  {a, b}* } Last class we designed a TM which accepts this language (that is, it halts if the input is in L and hangs or computes forever when it is not). Design a TM to decide L instead: A TM M decides a language L if (s, # w [#]) ├ * (h, # Y [#]) for w  L and (s, # w [#]) ├ * (h, # N [#]) for w ∉ L. What algorithm will you use?

2 Announcements Possible final exam tutorial times: Wed. Dec. 8 (ending before 7:30pm), Thurs. Dec. 9, or Fri. Dec. 10? CSC 225: Fri. Dec. 10, 1pm-4pm Assignment #4, Due at beginning of class, Tues. Nov. 16, Next week: Our only class is on Tuesday. No tutorials next week.

3 Undecidable Problems Decidable problem: Yes/No Question such that there exists a TM (or equivalently a C or Java program) which halts on all inputs with the answer to the question. In this lecture, we give a proof that some problems are not decidable. Proving that our initial problem is not decidable requires self-reference.

4 Gödel, Escher, Bach: an Eternal Golden Braid is a Pulitzer Prize- winning book by Douglas Hofstadter, described by the author as "a metaphorical fugue on minds and machines in the spirit of Lewis Carroll". On its surface, it examines logician Kurt Gödel, artist M. C. Escher and composer Johann Sebastian Bach, discussing common themes in their work and lives. At a deeper level, the book is a detailed and subtle exposition of concepts fundamental to mathematics, symmetry, and intelligence. Through illustration and analysis, the book discusses how self-reference and formal rules allow systems to acquire meaning despite being made of "meaningless" elements. It also discusses what it means to communicate, how knowledge can be represented and stored, the methods and limitations of symbolic representation, and even the fundamental notion of "meaning" itself. From Wikipedia, the free encyclopedia.

5 Ascending and Descending by M. C. Escher

6 Print Gallery by M. C. Escher

7

8 A Strange Language L= { w : w is a valid C program that prints “no” as its first output on input w} Can we design a C program P which decides if a string w is in L or not? Such a program should halt on w with output “yes” if w is in L and “no” if w is not in L. A deciding program has no other outputs.

9 main() { int count; char c; /* Count number of a's in the input. */ count=0; while (scanf("%1c", &c)==1) { if (c== 'a') count++; } if (count == 6) printf("yes "); else printf("no "); printf("Number of a's is: %5d\n", count); } p1.c

10 To run p1.c on p1.c gcc p1.c a.out < p1.c The output is: yes Number of a's is: 6

11 main() { int count; char c; /* Count number of a's in the input. */ count=0; while (scanf("%1c", &c)==1) { if (c== 'a') count++; } if (count == 6) printf("yes "); else printf("no "); printf("Number of a's is: %5d\n", count); } yes Number of a's is: 6 p1.c

12 main() { int count; char c; /* Count the number of a's in the input. */ count=0; while (scanf("%1c", &c)==1) { if (c== 'a') count++; } if (count != 6) printf("yes "); else printf("no "); printf("Number of a's is: %5d\n", count); } no Number of a's is: 6 p2.c

13 /* 23 The program tells us if this number if prime */ main() { char *c; int i, n; /* Read in the "/" and then the "*" from the comment at the top. */ scanf("%1c", &c); scanf("%1c", &c); /* Read in the integer at the top. */ scanf("%d", &n); for (i=2; i < n; i++) { if (n % i == 0) { printf("no- %5d is a divisor of %5d\n", i, n); exit(0); } printf("yes- %5d is prime.\n", n); } p3.c yes- 23 is prime.

14 /* 35 The program tells us if this number if prime */ main() { char *c; int i, n; /* Read in the "/" and then the "*" from the comment at the top. */ scanf("%1c", &c); scanf("%1c", &c); /* Read in the integer at the top. */ scanf("%d", &n); for (i=2; i < n; i++) { if (n % i == 0) { printf("no- %5d is a divisor of %5d\n", i, n); exit(0); } printf("yes- %5d is prime.\n", n); } p4.c no- 5 is a divisor of 35

15 main() { int i for i from 2 to 6 do i++ } p5.c: In function `main': p5.c:6: syntax error before `for' p5.c

16 main() { int i; i= 1; while (i > 0) { if ( i==1 ) i++; else i--; // printf("i= %5d\n", i); } printf("no\n"); } p6.c

17 L= { w : w is a valid C program that prints “no” as its first output on input w} p1.c: yes Number of a's is: 6 no p2.c: no Number of a's is: 6 yes p3.c: yes- 23 is prime. no p4.c: no- 5 is a divisor of 35 yes p5.c: Does not compile no p6.c: No output- infinite loop no

18 L= { w : w is a valid C program that prints “no” as its first output on input w} What might P.c which decides L look like? 1.Read input into a string variable w. 2.Check if w is a valid C program using a compiler. If not, print “no” and stop. 3.Decide if w’s first output when the input is w is “no”- if this is true, print “yes” and stop, otherwise, print “no” and stop.

19 L= { w : w is a valid C program that prints “no” as its first output on input w} What output does this give: gcc P.c ; a.out < P.c Answer: it should have output “yes” or “no”. Case 1: The output is “yes”. If P.c is working correctly, this means P.c is in L. But being in L means that a.out < P.c should have “no” as its first output. CONTRADICTION. Case 2: The output is “no”. This means that P.c is not in L. But by the definition of L, the first output of a.out < P.c cannot be “no”. CONTRADICTION.

20 Conclusion It is impossible to design a C program P.c which decides if the input is in: L= { w : w is a valid C program that prints “no” as its first output on input w} Since any reasonable algorithm can be implemented in C, this means that no algorithm exists for deciding if a string w is in L. The problem: Given a string w, is w in L? is UNDECIDEABLE.