SlideShare a Scribd company logo
TOC Presentation
Turing Machine and Halting
Amartya Yandrapu - 19070122017
Sree Varsha Chanumolu - 19070122044
What is a Turing Machine?
A Turing Machine is a mathematical model which consists of an infinite length tape divided into cells on
which input is given. It consists of a head which reads the input tape. A state register stores the state of the
Turing machine.
After reading an input symbol, it is replaced with another symbol, its internal state is changed, and it
moves from one cell to the right or left. If the TM reaches the final state, the input string is accepted,
otherwise rejected.
A Turing Machine can be defined as a set of 7 tuples (Q, E, F, 8, qo, b, F)
Q→ Non empty set of States
ℷ → Non empty set of Symbols
⟌ → Non empty set of Tape Symbols
δ →Transition function defined as: QxE →⟌ x (R/L) x Q
q०→ Initial State
b→ Blank Symbol
F→ Set of Final states (Accept state & Reject State)
The Production rule of Turing Machine will be written as δ (qo, a) → (q1,Y,R)
Decidability and Undecidability
Recursive Language: A language L is said to be recursive if there exists a Turing machine which will accept
all the strings in ‘L’ and reject all the strings not in ‘L’. It will halt every time and give an answer (accepted or
rejected for each and every string input).
Recursively Enumerable Language: A language L is said to be a recursively enumerable language if there
exists a Turing machine which will accept (and therefore halt) for all input strings in L. But may or may not
halt for all input strings which are not in ‘L’.
Decidable Language: A language ‘L’ is decidable if it is a recursive language. All decidable languages are
recursive languages are vice-versa.
Partially decidable Language: A language L is partially decidable, if L is a recursively enumerable
language.
Undecidable Language: A language is undecidable if it is not decidable. It may be partially decidable but
not decidable. If a language is not even partially decidable, then there exists no Turing machine for that
language.
What is Halting?
Halting means that the program on certain input will accept it and halt / reject it and halt and it would never
go into an infinite loop. Basically halting means terminating.
Given a Turing Machine, will it halt when run on some particular given input string?
Given some program written in some language (Java,C,C++) will it ever get into on infinite loop or will it
always terminate?
Answer: In general, we can’t always know. The best we can do is run the program and see whether it halts.
For many programs, we can see that it will always halt or sometimes loop. But, for programs in general, the
question is undecidable.
Example: A machine can be designed which can accept all valid Java codes. It is a compiler. But, a machine
can’t be designed which can accept all Java codes and never goes into infinite loop.
Hypothesis and Testing
Can we design a machine, which if given a program can find out or decide if that program will always halt
or not halt on a particular input?
H(P,I) Halt
Not Halt
Hence, we can conclude from proof by contradiction that we cannot predict in general if a
program will halt or not on a particular input.
Let us assume that we can:
This allows us to write another program:
C(X)
If (H(X,X)==Halt)
Loop Forever;
Else
Return;
If we run ‘C’ on itself,
H(C,C)==Halt H(C,C)==Not Halt
Not Halt Halt
Thank You!
Ad

More Related Content

What's hot (20)

Turing Machine
Turing MachineTuring Machine
Turing Machine
Rahul Narang
 
COMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time EnvironmentsCOMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time Environments
Jyothishmathi Institute of Technology and Science Karimnagar
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
AniketKandara1
 
Lecture 12 intermediate code generation
Lecture 12 intermediate code generationLecture 12 intermediate code generation
Lecture 12 intermediate code generation
Iffat Anjum
 
Turing machine
Turing machineTuring machine
Turing machine
Kanis Fatema Shanta
 
5.2 primitive recursive functions
5.2 primitive recursive functions5.2 primitive recursive functions
5.2 primitive recursive functions
Sampath Kumar S
 
Context free grammar
Context free grammar Context free grammar
Context free grammar
Mohammad Ilyas Malik
 
Principle source of optimazation
Principle source of optimazationPrinciple source of optimazation
Principle source of optimazation
Siva Sathya
 
Theory of computing
Theory of computingTheory of computing
Theory of computing
Bipul Roy Bpl
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
Ratnakar Mikkili
 
Os services
Os servicesOs services
Os services
anilkumar_mca
 
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDAPush Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Ashish Duggal
 
STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
VENNILAV6
 
Synchronization hardware
Synchronization hardwareSynchronization hardware
Synchronization hardware
Saeram Butt
 
pushdown automata
pushdown automatapushdown automata
pushdown automata
Sujata Pardeshi
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
arwa wshyar
 
Types of Language in Theory of Computation
Types of Language in Theory of ComputationTypes of Language in Theory of Computation
Types of Language in Theory of Computation
Ankur Singh
 
Type Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLikeType Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLike
United International University
 
Multi dimensional turing machine
Multi dimensional turing machineMulti dimensional turing machine
Multi dimensional turing machine
NiteshSingh405
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
Anshuman Biswal
 

Similar to Turing machine and Halting Introduction (20)

COMPLEXITY CHAPTER 3 LECTURE FOR FOURTH YEAR.pptx
COMPLEXITY CHAPTER 3 LECTURE FOR FOURTH YEAR.pptxCOMPLEXITY CHAPTER 3 LECTURE FOR FOURTH YEAR.pptx
COMPLEXITY CHAPTER 3 LECTURE FOR FOURTH YEAR.pptx
RadielKassa
 
Unit v
Unit vUnit v
Unit v
TPLatchoumi
 
chapter 2.pptx
chapter 2.pptxchapter 2.pptx
chapter 2.pptx
sampathkumar912515
 
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptxTCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
userqwerty2612
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggg
adugnanegero
 
Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)
Siddharaj Junnarkar
 
Presentation.TOA.pptxjiihugydrawagkjiggkfgtsed
Presentation.TOA.pptxjiihugydrawagkjiggkfgtsedPresentation.TOA.pptxjiihugydrawagkjiggkfgtsed
Presentation.TOA.pptxjiihugydrawagkjiggkfgtsed
HassanShahg2
 
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdfTCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
userqwerty2612
 
Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207
Editor IJARCET
 
Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207
Editor IJARCET
 
Deterministic Finite Automata (DFA).pptx
Deterministic Finite Automata (DFA).pptxDeterministic Finite Automata (DFA).pptx
Deterministic Finite Automata (DFA).pptx
saicharanbala18
 
Theory of Automata and formal languages Unit 5
Theory of Automata and formal languages Unit 5Theory of Automata and formal languages Unit 5
Theory of Automata and formal languages Unit 5
Abhimanyu Mishra
 
Turing machine power point presentations
Turing machine power point presentationsTuring machine power point presentations
Turing machine power point presentations
latha2009
 
compatibility and complexity in the IS.ppt
compatibility and complexity in the IS.pptcompatibility and complexity in the IS.ppt
compatibility and complexity in the IS.ppt
MuhammadAbdullah311866
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languages
SOMNATHMORE2
 
Turing machine Introduction
Turing machine IntroductionTuring machine Introduction
Turing machine Introduction
Aram Rafeq
 
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHYFINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
nishimanglani
 
Turing machine
Turing machineTuring machine
Turing machine
MuhammadSamranTanvee
 
Presentation (5).pdf
Presentation (5).pdfPresentation (5).pdf
Presentation (5).pdf
Gaurav447273
 
Class 36: Halting Problem
Class 36: Halting ProblemClass 36: Halting Problem
Class 36: Halting Problem
David Evans
 
COMPLEXITY CHAPTER 3 LECTURE FOR FOURTH YEAR.pptx
COMPLEXITY CHAPTER 3 LECTURE FOR FOURTH YEAR.pptxCOMPLEXITY CHAPTER 3 LECTURE FOR FOURTH YEAR.pptx
COMPLEXITY CHAPTER 3 LECTURE FOR FOURTH YEAR.pptx
RadielKassa
 
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptxTCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
TCS MUBAI UNIVERSITY ATHARVA COLLEGE OF ENGINEERING.pptx
userqwerty2612
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggg
adugnanegero
 
Presentation.TOA.pptxjiihugydrawagkjiggkfgtsed
Presentation.TOA.pptxjiihugydrawagkjiggkfgtsedPresentation.TOA.pptxjiihugydrawagkjiggkfgtsed
Presentation.TOA.pptxjiihugydrawagkjiggkfgtsed
HassanShahg2
 
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdfTCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
TCS GOLDEN NOTES THEORY OF COMPUTATION .pdf
userqwerty2612
 
Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207
Editor IJARCET
 
Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207
Editor IJARCET
 
Deterministic Finite Automata (DFA).pptx
Deterministic Finite Automata (DFA).pptxDeterministic Finite Automata (DFA).pptx
Deterministic Finite Automata (DFA).pptx
saicharanbala18
 
Theory of Automata and formal languages Unit 5
Theory of Automata and formal languages Unit 5Theory of Automata and formal languages Unit 5
Theory of Automata and formal languages Unit 5
Abhimanyu Mishra
 
Turing machine power point presentations
Turing machine power point presentationsTuring machine power point presentations
Turing machine power point presentations
latha2009
 
compatibility and complexity in the IS.ppt
compatibility and complexity in the IS.pptcompatibility and complexity in the IS.ppt
compatibility and complexity in the IS.ppt
MuhammadAbdullah311866
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languages
SOMNATHMORE2
 
Turing machine Introduction
Turing machine IntroductionTuring machine Introduction
Turing machine Introduction
Aram Rafeq
 
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHYFINITE STATE MACHINE AND CHOMSKY HIERARCHY
FINITE STATE MACHINE AND CHOMSKY HIERARCHY
nishimanglani
 
Presentation (5).pdf
Presentation (5).pdfPresentation (5).pdf
Presentation (5).pdf
Gaurav447273
 
Class 36: Halting Problem
Class 36: Halting ProblemClass 36: Halting Problem
Class 36: Halting Problem
David Evans
 
Ad

Recently uploaded (20)

Smart City is the Future EN - 2024 Thailand Modify V1.0.pdf
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdfSmart City is the Future EN - 2024 Thailand Modify V1.0.pdf
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdf
PawachMetharattanara
 
Deepfake Phishing: A New Frontier in Cyber Threats
Deepfake Phishing: A New Frontier in Cyber ThreatsDeepfake Phishing: A New Frontier in Cyber Threats
Deepfake Phishing: A New Frontier in Cyber Threats
RaviKumar256934
 
Optimizing Reinforced Concrete Cantilever Retaining Walls Using Gases Brownia...
Optimizing Reinforced Concrete Cantilever Retaining Walls Using Gases Brownia...Optimizing Reinforced Concrete Cantilever Retaining Walls Using Gases Brownia...
Optimizing Reinforced Concrete Cantilever Retaining Walls Using Gases Brownia...
Journal of Soft Computing in Civil Engineering
 
Mode-Wise Corridor Level Travel-Time Estimation Using Machine Learning Models
Mode-Wise Corridor Level Travel-Time Estimation Using Machine Learning ModelsMode-Wise Corridor Level Travel-Time Estimation Using Machine Learning Models
Mode-Wise Corridor Level Travel-Time Estimation Using Machine Learning Models
Journal of Soft Computing in Civil Engineering
 
Construction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil EngineeringConstruction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil Engineering
Lavish Kashyap
 
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
Jimmy Lai
 
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
ijdmsjournal
 
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdfML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
rameshwarchintamani
 
David Boutry - Specializes In AWS, Microservices And Python
David Boutry - Specializes In AWS, Microservices And PythonDavid Boutry - Specializes In AWS, Microservices And Python
David Boutry - Specializes In AWS, Microservices And Python
David Boutry
 
Applications of Centroid in Structural Engineering
Applications of Centroid in Structural EngineeringApplications of Centroid in Structural Engineering
Applications of Centroid in Structural Engineering
suvrojyotihalder2006
 
2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt
rakshaiya16
 
acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Environment .................................
Environment .................................Environment .................................
Environment .................................
shadyozq9
 
Automatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and BeyondAutomatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and Beyond
NU_I_TODALAB
 
AI Chatbots & Software Development Teams
AI Chatbots & Software Development TeamsAI Chatbots & Software Development Teams
AI Chatbots & Software Development Teams
Joe Krall
 
Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
Modeling the Influence of Environmental Factors on Concrete Evaporation Rate
Modeling the Influence of Environmental Factors on Concrete Evaporation RateModeling the Influence of Environmental Factors on Concrete Evaporation Rate
Modeling the Influence of Environmental Factors on Concrete Evaporation Rate
Journal of Soft Computing in Civil Engineering
 
Working with USDOT UTCs: From Conception to Implementation
Working with USDOT UTCs: From Conception to ImplementationWorking with USDOT UTCs: From Conception to Implementation
Working with USDOT UTCs: From Conception to Implementation
Alabama Transportation Assistance Program
 
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
Guru Nanak Technical Institutions
 
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdf
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdfSmart City is the Future EN - 2024 Thailand Modify V1.0.pdf
Smart City is the Future EN - 2024 Thailand Modify V1.0.pdf
PawachMetharattanara
 
Deepfake Phishing: A New Frontier in Cyber Threats
Deepfake Phishing: A New Frontier in Cyber ThreatsDeepfake Phishing: A New Frontier in Cyber Threats
Deepfake Phishing: A New Frontier in Cyber Threats
RaviKumar256934
 
Construction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil EngineeringConstruction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil Engineering
Lavish Kashyap
 
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
Jimmy Lai
 
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
ijdmsjournal
 
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdfML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
rameshwarchintamani
 
David Boutry - Specializes In AWS, Microservices And Python
David Boutry - Specializes In AWS, Microservices And PythonDavid Boutry - Specializes In AWS, Microservices And Python
David Boutry - Specializes In AWS, Microservices And Python
David Boutry
 
Applications of Centroid in Structural Engineering
Applications of Centroid in Structural EngineeringApplications of Centroid in Structural Engineering
Applications of Centroid in Structural Engineering
suvrojyotihalder2006
 
2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt
rakshaiya16
 
acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Environment .................................
Environment .................................Environment .................................
Environment .................................
shadyozq9
 
Automatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and BeyondAutomatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and Beyond
NU_I_TODALAB
 
AI Chatbots & Software Development Teams
AI Chatbots & Software Development TeamsAI Chatbots & Software Development Teams
AI Chatbots & Software Development Teams
Joe Krall
 
Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
Ad

Turing machine and Halting Introduction

  • 1. TOC Presentation Turing Machine and Halting Amartya Yandrapu - 19070122017 Sree Varsha Chanumolu - 19070122044
  • 2. What is a Turing Machine? A Turing Machine is a mathematical model which consists of an infinite length tape divided into cells on which input is given. It consists of a head which reads the input tape. A state register stores the state of the Turing machine. After reading an input symbol, it is replaced with another symbol, its internal state is changed, and it moves from one cell to the right or left. If the TM reaches the final state, the input string is accepted, otherwise rejected.
  • 3. A Turing Machine can be defined as a set of 7 tuples (Q, E, F, 8, qo, b, F) Q→ Non empty set of States ℷ → Non empty set of Symbols ⟌ → Non empty set of Tape Symbols δ →Transition function defined as: QxE →⟌ x (R/L) x Q q०→ Initial State b→ Blank Symbol F→ Set of Final states (Accept state & Reject State) The Production rule of Turing Machine will be written as δ (qo, a) → (q1,Y,R)
  • 4. Decidability and Undecidability Recursive Language: A language L is said to be recursive if there exists a Turing machine which will accept all the strings in ‘L’ and reject all the strings not in ‘L’. It will halt every time and give an answer (accepted or rejected for each and every string input). Recursively Enumerable Language: A language L is said to be a recursively enumerable language if there exists a Turing machine which will accept (and therefore halt) for all input strings in L. But may or may not halt for all input strings which are not in ‘L’. Decidable Language: A language ‘L’ is decidable if it is a recursive language. All decidable languages are recursive languages are vice-versa. Partially decidable Language: A language L is partially decidable, if L is a recursively enumerable language. Undecidable Language: A language is undecidable if it is not decidable. It may be partially decidable but not decidable. If a language is not even partially decidable, then there exists no Turing machine for that language.
  • 5. What is Halting? Halting means that the program on certain input will accept it and halt / reject it and halt and it would never go into an infinite loop. Basically halting means terminating. Given a Turing Machine, will it halt when run on some particular given input string? Given some program written in some language (Java,C,C++) will it ever get into on infinite loop or will it always terminate? Answer: In general, we can’t always know. The best we can do is run the program and see whether it halts. For many programs, we can see that it will always halt or sometimes loop. But, for programs in general, the question is undecidable. Example: A machine can be designed which can accept all valid Java codes. It is a compiler. But, a machine can’t be designed which can accept all Java codes and never goes into infinite loop.
  • 6. Hypothesis and Testing Can we design a machine, which if given a program can find out or decide if that program will always halt or not halt on a particular input? H(P,I) Halt Not Halt
  • 7. Hence, we can conclude from proof by contradiction that we cannot predict in general if a program will halt or not on a particular input. Let us assume that we can: This allows us to write another program: C(X) If (H(X,X)==Halt) Loop Forever; Else Return; If we run ‘C’ on itself, H(C,C)==Halt H(C,C)==Not Halt Not Halt Halt
  翻译: