Download presentation
Presentation is loading. Please wait.
Published byEdgar Christopher Oliver Modified over 9 years ago
1
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics
2
Computability Theory Decidability
3
Motivation Turing machines: a general purpose computer; Formalizes the notion of an algorithm (Church-Turing thesis) We now turn our attention into the power of algorithms (i.e. Turing machines) to solve problems Try to understand the limitation of computers
4
Is studying decidability useful? An example of a decidable problem: Is a string a member of a context-free language? This problem is at the heart of the problem of recognizing and compiling programs in a programming language
5
Preliminaries Acceptance problem: Does DFA B accept input string w? For convenience we use languages to represent various computational problems So, the acceptance problem can be expressed as a language A DFA = { | B is a DFA that accepts input string w}
6
Preliminaries A DFA = { | B is a DFA that accepts input string w} The problem of testing whether a DFA B accepts a string w is the same as testing whether is a member of the language A DFA Thus, showing that the language is decidable is the same as showing that the computational problem is decidable!
7
Examples of Decidable Languages A DFA = { | B is a DFA that accepts input string w} Theorem: A DFA is a decidable language Proof idea: Design a TM M that decides A DFA How? On input Simulate B on input w If simulation ends in accepting state, accept, otherwise reject
8
Examples of Decidable Languages A NFA = { | B is a NFA that accepts input string w} Theorem: A NFA is a decidable language Proof idea: Design a TM M that decides A NFA How? On input Convert NFA B into equivalent DFA C Run previous TM on input If that TM accepts, accept, otherwise reject
9
Examples of Decidable Languages A REX = { | R is a regular expression that generates string w} Theorem: A REX is a decidable language Proof idea: Design a TM M that decides A REX How? On input Convert R into equivalent NFA C Run previous TM on input If that TM accepts, accept, otherwise reject
10
Examples of Decidable Languages A CFG = { | G is a CFG that generates string w} Theorem: A CFG is a decidable language Proof idea: Design a TM M that decides A CFG How? (Interested students can read the book p. 156)
11
Examples of Decidable Languages Theorem: Every CFG is a decidable
12
Relationships among classes of languages regular Context-free decidable enumerable
13
The Haling Problem One of the most philosophically important theorems of the theory of computation Computers (and computation) are limited ina very fundamental way Common, every-day problem are unsolvable Does a program sort an array of integers? Both program and specification are precise But, automating the verification is undecidable No computer program can perform the task of checking the program against the specification!
14
Halting Problem Halting problem: Does a Turing machine accept a string? A TM = { | M is a Turing machine that accepts string w} Theorem: A TM is undecidable
15
Halting Problem Before proving that A TM is undecidable, note that A TM is enumerable How? Design a Turing Machine U that recongnizes A TM On input Simulate M on w If M ever enters its accept state, accept, and if M ever enters its reject state reject U is called a universal Turing machine
16
Diagonalization Diagonalization: a very crucial technique that is useful to prove undecidability A TM Question: what does it mean to say that two infinite sets are the same size? Answered by Georg cantor in 1873 How? Pair them off!
17
Correspondence Recall a correspondence f: A B is a bijection: Injective Surjective Question: what does it mean to say that two infinite sets are the same size? Answer: A and B are the same size if there is a correspondence from A to B
18
Correspondence Question: in a crowded room, how can we tell if there are more people than chairs, or more chairs than people?
19
Correspondence Question: in a crowded room, how can we tell if there are more people than chairs, or more chairs than people? Answer: Establish a correspondence: ask everyone to sit down!
20
Correspondence Claim: The set of Natural numbers has the same size as the set of even numbers!
21
Correspondence Claim: The set of Natural numbers has the same size as the set of even numbers! Proof: Establish a correspondence Let f(i)=2i Remark: a proper subset of A can be the same size as A!!!!
22
Countable Definition: A set A is countable iff Either it is finite, or It has the same size as N, the set of natural numbers We have just seen that the set of even numbers is countable Claim: The set Z of integers is countable Proof: Define f:N Z by f(i)=i/2 If i is even f(i)=-(ceil(i/2) +1) if i is odd
23
Challenge In Heaven, there is a hotel with a countable number of rooms One day, the society of Prophets, Oracles, and AI researchers hold a convention that books every room in the hotel Then one more guest arrives, angrily demanding a room You are the manager. What to do?
24
Challenge Then one more guest arrives, angrily demanding a room You are the manager. What to do? Answer: Ask the guest in room i to move to room i+1, and put the new comer in room 1!
25
Challenge Then a countable number of guests arrive, all angrily demanding a room Now What to do?
26
Challenge Then a countable number of guests arrive, all angrily demanding a room Now What to do? Answer: Ask the guest in room i to move to room 2i, and put the new comers in odd numbered rooms !!!! (Infinity is such an amazing thing!!)
27
Rational Numbers Let Q ={m/n | m and n are natural numbers} Theorem: Q is countable What is the correspondence between N and Q?
28
Rational Numbers 1/11/21/31/41/51/61/71/8 …….. 2/12/22/32/42/52/62/72/8 …….. 3/13/23/33/43/53/63/73/8 …….. 4/14/24/34/44/54/64/74/8 ……......................................
29
Rational Numbers 1/11/21/31/41/51/61/71/8 …….. 2/12/22/32/42/52/62/72/8 …….. 3/13/23/33/43/53/63/73/8 …….. 4/14/24/34/44/54/64/74/8 …….. Enumerate numbers along Northeast and Southwest diagonals, and skip duplicates
30
Rational Numbers 1/11/21/31/41/51/61/71/8 …….. 2/12/22/32/42/52/62/72/8 …….. 3/13/23/33/43/53/63/73/8 …….. 4/14/24/34/44/54/64/74/8 …….. Does this mean that every infinite set is countable?
31
The Real Numbers Theorem: R, the set of reals is uncountable Cantor introduced the diagonalization method to prove this theorem!
32
The Real Numbers Theorem: R, the set of reals is uncountable Proof: By contradiction Assume there is a correspondence between N and R Write it down We show now that there a number x not in the list! n f(n) 13.143…… 255.435…. 33456.75… 4456.655…
33
Diagonalization Proof: By contradiction Pick x between 0 and 1, so non-zero digits follow decimal point First fractional digit of f(1) is 1 Pick first fractional digit of x to be different, say 2 Second fractional digit of f(2) is 4 Pick second fractional digit of x to be different, say 6 And so on …. X=0.2487…. Thus x is not the image of any natural which is a contradiction So, R is uncountable! n f(n) 13.143…… 255.435…. 33456.75… 4456.655…
34
Important implications Previous theorem has an important application to the theory of computation It shows that some languages are not decidable! Or even Turing machine recognizable There are languages that are not enumerable The set of Turing machines is countable The set of languages is uncountable
35
Important implications Theorem: The halting problem is undecidable Proof uses diagonalization technique (see bok those interested) Theorem: A language is decidable if and only if it is both Turing-recognizable and co-Turing recognizable In other words, a language is decidable if and only if it and its compliment are Turing- recognizable (enumerable)
36
enumerable A non-enumerable language Corollory: if L is not decidable, then either L or its compliment is not enumerable Co-enumerable decidable ????
37
Conclusions Decidable languages Halting problem diagonalization method undecidable example
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.