SlideShare a Scribd company logo
1 of 17
Halting
Problem
-Sampath Kumar S,
AP/CSE, SECE
Language Decidability
 A language is called Decidable or Recursive if there
is a Turing machine which accepts and halts on
every input string w.
 Every decidable language is Turing-Acceptable.
21 November 2017
Sampath Kumar S, AP/CSE, SECE
2
Decidable Problem
 A Problem is said to be decidable if there exist an
algorithm which can solve the problem in finite
amount of time.
 There are some specific problems that are
algorithmically unsolvable.
21 November 2017
Sampath Kumar S, AP/CSE, SECE
3
Decidable Problem
 A decision problem P is decidable if the
language L of all yes instances to Pis decidable.
 For a decidable language, for each input string, the
TM halts either at the accept or the reject state as
depicted in the following diagram −
21 November 2017
Sampath Kumar S, AP/CSE, SECE
4
Example 1:
 Find out whether the following problem is decidable or
not −
Is a number ‘m’ prime?
Solution
 Prime numbers = {2, 3, 5, 7, 11, 13, …………..}
 Divide the number ‘m’ by all the numbers between ‘2’
and ‘√m’ starting from ‘2’.
 If any of these numbers produce a remainder zero,
then it goes to the “Rejected state”, otherwise it goes to
the “Accepted state”. So, here the answer could be
made by ‘Yes’ or ‘No’.
 Hence, it is a decidable problem.
21 November 2017
Sampath Kumar S, AP/CSE, SECE
5
Example 2:
Given a regular language L and string w, how can
we check if w ∈ L?
Solution
 Take the DFA that accepts L and check if w is
accepted
21 November 2017
Sampath Kumar S, AP/CSE, SECE
6
Language:
 If a language L is decidable, then its
complement L' is also decidable.
 If a language is decidable, then there is an
enumerator for it.
21 November 2017
Sampath Kumar S, AP/CSE, SECE
7
Undecidable Languages
 For an undecidable language, there is no Turing
Machine which accepts the language and makes a
decision for every input string w (TM can make
decision for some input string though).
 A decision problem P is called “undecidable” if the
language L of all yes instances to P is not
decidable. Undecidable languages are not
recursive languages, but sometimes, they may be
recursively enumerable languages.
21 November 2017
Sampath Kumar S, AP/CSE, SECE
8
Example
 The halting problem of Turing machine
 The mortality problem
 The Post correspondence problem, etc.
21 November 2017
Sampath Kumar S, AP/CSE, SECE
9
Halting Problem:
 The output of TM can be:
 Halt: The machine will halt state (Accept/
Reject state) after a finite number of states.
 No Halt: The machine will never reach halt state
(Accept/Reject state), no matter how
long it runs.
21 November 2017
Sampath Kumar S, AP/CSE, SECE
10
Halting Problem:
 Now the question arises based on these 2
observation: Given an arbitrary TM and arbitrary
input for the machine, then is it possible to
determine whether the machine will ever halt on
given input? This is called halting problem.
 That means we are asking for a procedure which
enable us to solve the halting problem for every
pair(machine & input). The answer is “no”. That is
halting problem is unsolvable.
21 November 2017
Sampath Kumar S, AP/CSE, SECE
11
Halting Problem is unsolvable:
 Input − A Turing machine and an input string w.
 Problem − Does the Turing machine finish computing
of the string w in a finite number of steps? The answer
must be either yes or no.
 Proof − At first, we will assume that such a Turing
machine exists to solve this problem and then we will
show it is contradicting itself. We will call this Turing
machine as a Halting machine that produces a ‘yes’ or
‘no’ in a finite amount of time. If the halting machine
finishes in a finite amount of time, the output comes as
‘yes’, otherwise as ‘no’.
21 November 2017
Sampath Kumar S, AP/CSE, SECE
12
Cont..,
The following is the block diagram of a Halting
machine −
21 November 2017
Sampath Kumar S, AP/CSE, SECE
13
Cont..,
Now we will design an inverted halting machine
(HM)’ as −
 If H returns YES, then loop forever.
 If H returns NO, then halt.
 The following is the block diagram of an ‘Inverted
halting machine’ −
21 November 2017
Sampath Kumar S, AP/CSE, SECE
14
Cont..,
 Further, a machine (HM)2 which input itself is
constructed as follows −
If (HM)2 halts on input, loop forever.
Else, halt.
 Here, we have got a contradiction. Hence, the
halting problem is undecidable.
21 November 2017
Sampath Kumar S, AP/CSE, SECE
15
21 November 2017
Sampath Kumar S, AP/CSE, SECE
16
நன்றி
21 November 2017
Sampath Kumar S, AP/CSE, SECE
17

More Related Content

What's hot

4.3 techniques for turing machines construction
4.3 techniques for turing machines construction4.3 techniques for turing machines construction
4.3 techniques for turing machines constructionSampath Kumar S
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of LanguageDipankar Boruah
 
Church Turing Thesis
Church Turing ThesisChurch Turing Thesis
Church Turing ThesisHemant Sharma
 
Type checking in compiler design
Type checking in compiler designType checking in compiler design
Type checking in compiler designSudip Singh
 
Context free grammars
Context free grammarsContext free grammars
Context free grammarsRonak Thakkar
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture NotesFellowBuddy.com
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler DesignKuppusamy P
 
The n Queen Problem
The n Queen ProblemThe n Queen Problem
The n Queen ProblemSukrit Gupta
 
9. chapter 8 np hard and np complete problems
9. chapter 8   np hard and np complete problems9. chapter 8   np hard and np complete problems
9. chapter 8 np hard and np complete problemsJyotsna Suryadevara
 

What's hot (20)

4.3 techniques for turing machines construction
4.3 techniques for turing machines construction4.3 techniques for turing machines construction
4.3 techniques for turing machines construction
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
 
Church Turing Thesis
Church Turing ThesisChurch Turing Thesis
Church Turing Thesis
 
Multi Head, Multi Tape Turing Machine
Multi Head, Multi Tape Turing MachineMulti Head, Multi Tape Turing Machine
Multi Head, Multi Tape Turing Machine
 
Theory of Computation Unit 5
Theory of Computation Unit 5Theory of Computation Unit 5
Theory of Computation Unit 5
 
Type checking in compiler design
Type checking in compiler designType checking in compiler design
Type checking in compiler design
 
Pumping lemma
Pumping lemmaPumping lemma
Pumping lemma
 
Context free grammars
Context free grammarsContext free grammars
Context free grammars
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Undecidabality
UndecidabalityUndecidabality
Undecidabality
 
Turing machine
Turing machineTuring machine
Turing machine
 
1.Role lexical Analyzer
1.Role lexical Analyzer1.Role lexical Analyzer
1.Role lexical Analyzer
 
The n Queen Problem
The n Queen ProblemThe n Queen Problem
The n Queen Problem
 
9. chapter 8 np hard and np complete problems
9. chapter 8   np hard and np complete problems9. chapter 8   np hard and np complete problems
9. chapter 8 np hard and np complete problems
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
First and follow set
First and follow setFirst and follow set
First and follow set
 

More from Sampath Kumar S

5.2 primitive recursive functions
5.2 primitive recursive functions5.2 primitive recursive functions
5.2 primitive recursive functionsSampath Kumar S
 
4.7. chomskian hierarchy of languages
4.7. chomskian hierarchy of languages4.7. chomskian hierarchy of languages
4.7. chomskian hierarchy of languagesSampath Kumar S
 
4.2 variantsof turing machines (types of tm)
4.2 variantsof turing machines (types of tm)4.2 variantsof turing machines (types of tm)
4.2 variantsof turing machines (types of tm)Sampath Kumar S
 
3.6 & 7. pumping lemma for cfl & problems based on pl
3.6 & 7. pumping lemma for cfl & problems based on pl3.6 & 7. pumping lemma for cfl & problems based on pl
3.6 & 7. pumping lemma for cfl & problems based on plSampath Kumar S
 
3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cflSampath Kumar S
 
2.8 normal forms gnf & problems
2.8 normal forms   gnf & problems2.8 normal forms   gnf & problems
2.8 normal forms gnf & problemsSampath Kumar S
 
2.7 normal forms cnf & problems
2.7 normal forms  cnf & problems2.7 normal forms  cnf & problems
2.7 normal forms cnf & problemsSampath Kumar S
 
2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammars2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammarsSampath Kumar S
 
2.4 derivations and languages
2.4 derivations and languages2.4 derivations and languages
2.4 derivations and languagesSampath Kumar S
 
2.3 context free grammars and languages
2.3 context free grammars and languages2.3 context free grammars and languages
2.3 context free grammars and languagesSampath Kumar S
 
2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammarSampath Kumar S
 
1.10. pumping lemma for regular sets
1.10. pumping lemma for regular sets1.10. pumping lemma for regular sets
1.10. pumping lemma for regular setsSampath Kumar S
 
1.9. minimization of dfa
1.9. minimization of dfa1.9. minimization of dfa
1.9. minimization of dfaSampath Kumar S
 
1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressionsSampath Kumar S
 
1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expression1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expressionSampath Kumar S
 
1.4. finite automaton with ε moves
1.4. finite automaton with ε   moves1.4. finite automaton with ε   moves
1.4. finite automaton with ε movesSampath Kumar S
 
1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automatonSampath Kumar S
 
1.3.1 deterministic finite automaton
1.3.1 deterministic finite automaton1.3.1 deterministic finite automaton
1.3.1 deterministic finite automatonSampath Kumar S
 

More from Sampath Kumar S (20)

5.2 primitive recursive functions
5.2 primitive recursive functions5.2 primitive recursive functions
5.2 primitive recursive functions
 
4.7. chomskian hierarchy of languages
4.7. chomskian hierarchy of languages4.7. chomskian hierarchy of languages
4.7. chomskian hierarchy of languages
 
4.2 variantsof turing machines (types of tm)
4.2 variantsof turing machines (types of tm)4.2 variantsof turing machines (types of tm)
4.2 variantsof turing machines (types of tm)
 
4.1 turing machines
4.1 turing machines4.1 turing machines
4.1 turing machines
 
3.6 & 7. pumping lemma for cfl & problems based on pl
3.6 & 7. pumping lemma for cfl & problems based on pl3.6 & 7. pumping lemma for cfl & problems based on pl
3.6 & 7. pumping lemma for cfl & problems based on pl
 
3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl3.5 equivalence of pushdown automata and cfl
3.5 equivalence of pushdown automata and cfl
 
3.4 deterministic pda
3.4 deterministic pda3.4 deterministic pda
3.4 deterministic pda
 
2.8 normal forms gnf & problems
2.8 normal forms   gnf & problems2.8 normal forms   gnf & problems
2.8 normal forms gnf & problems
 
2.7 normal forms cnf & problems
2.7 normal forms  cnf & problems2.7 normal forms  cnf & problems
2.7 normal forms cnf & problems
 
2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammars2.5 ambiguity in context free grammars
2.5 ambiguity in context free grammars
 
2.4 derivations and languages
2.4 derivations and languages2.4 derivations and languages
2.4 derivations and languages
 
2.3 context free grammars and languages
2.3 context free grammars and languages2.3 context free grammars and languages
2.3 context free grammars and languages
 
2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar
 
1.10. pumping lemma for regular sets
1.10. pumping lemma for regular sets1.10. pumping lemma for regular sets
1.10. pumping lemma for regular sets
 
1.9. minimization of dfa
1.9. minimization of dfa1.9. minimization of dfa
1.9. minimization of dfa
 
1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions1.8. equivalence of finite automaton and regular expressions
1.8. equivalence of finite automaton and regular expressions
 
1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expression1.5 & 1.6 regular languages & regular expression
1.5 & 1.6 regular languages & regular expression
 
1.4. finite automaton with ε moves
1.4. finite automaton with ε   moves1.4. finite automaton with ε   moves
1.4. finite automaton with ε moves
 
1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton
 
1.3.1 deterministic finite automaton
1.3.1 deterministic finite automaton1.3.1 deterministic finite automaton
1.3.1 deterministic finite automaton
 

Recently uploaded

Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 

Recently uploaded (20)

Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 

4.6 halting problem

  • 2. Language Decidability  A language is called Decidable or Recursive if there is a Turing machine which accepts and halts on every input string w.  Every decidable language is Turing-Acceptable. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 2
  • 3. Decidable Problem  A Problem is said to be decidable if there exist an algorithm which can solve the problem in finite amount of time.  There are some specific problems that are algorithmically unsolvable. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 3
  • 4. Decidable Problem  A decision problem P is decidable if the language L of all yes instances to Pis decidable.  For a decidable language, for each input string, the TM halts either at the accept or the reject state as depicted in the following diagram − 21 November 2017 Sampath Kumar S, AP/CSE, SECE 4
  • 5. Example 1:  Find out whether the following problem is decidable or not − Is a number ‘m’ prime? Solution  Prime numbers = {2, 3, 5, 7, 11, 13, …………..}  Divide the number ‘m’ by all the numbers between ‘2’ and ‘√m’ starting from ‘2’.  If any of these numbers produce a remainder zero, then it goes to the “Rejected state”, otherwise it goes to the “Accepted state”. So, here the answer could be made by ‘Yes’ or ‘No’.  Hence, it is a decidable problem. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 5
  • 6. Example 2: Given a regular language L and string w, how can we check if w ∈ L? Solution  Take the DFA that accepts L and check if w is accepted 21 November 2017 Sampath Kumar S, AP/CSE, SECE 6
  • 7. Language:  If a language L is decidable, then its complement L' is also decidable.  If a language is decidable, then there is an enumerator for it. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 7
  • 8. Undecidable Languages  For an undecidable language, there is no Turing Machine which accepts the language and makes a decision for every input string w (TM can make decision for some input string though).  A decision problem P is called “undecidable” if the language L of all yes instances to P is not decidable. Undecidable languages are not recursive languages, but sometimes, they may be recursively enumerable languages. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 8
  • 9. Example  The halting problem of Turing machine  The mortality problem  The Post correspondence problem, etc. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 9
  • 10. Halting Problem:  The output of TM can be:  Halt: The machine will halt state (Accept/ Reject state) after a finite number of states.  No Halt: The machine will never reach halt state (Accept/Reject state), no matter how long it runs. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 10
  • 11. Halting Problem:  Now the question arises based on these 2 observation: Given an arbitrary TM and arbitrary input for the machine, then is it possible to determine whether the machine will ever halt on given input? This is called halting problem.  That means we are asking for a procedure which enable us to solve the halting problem for every pair(machine & input). The answer is “no”. That is halting problem is unsolvable. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 11
  • 12. Halting Problem is unsolvable:  Input − A Turing machine and an input string w.  Problem − Does the Turing machine finish computing of the string w in a finite number of steps? The answer must be either yes or no.  Proof − At first, we will assume that such a Turing machine exists to solve this problem and then we will show it is contradicting itself. We will call this Turing machine as a Halting machine that produces a ‘yes’ or ‘no’ in a finite amount of time. If the halting machine finishes in a finite amount of time, the output comes as ‘yes’, otherwise as ‘no’. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 12
  • 13. Cont.., The following is the block diagram of a Halting machine − 21 November 2017 Sampath Kumar S, AP/CSE, SECE 13
  • 14. Cont.., Now we will design an inverted halting machine (HM)’ as −  If H returns YES, then loop forever.  If H returns NO, then halt.  The following is the block diagram of an ‘Inverted halting machine’ − 21 November 2017 Sampath Kumar S, AP/CSE, SECE 14
  • 15. Cont..,  Further, a machine (HM)2 which input itself is constructed as follows − If (HM)2 halts on input, loop forever. Else, halt.  Here, we have got a contradiction. Hence, the halting problem is undecidable. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 15
  • 16. 21 November 2017 Sampath Kumar S, AP/CSE, SECE 16
  • 17. நன்றி 21 November 2017 Sampath Kumar S, AP/CSE, SECE 17

Editor's Notes

  1. School of EECS, WSU