0% found this document useful (0 votes)
14 views7 pages

Unit 7 Undecidability

Decidable problems can be solved using algorithms and always provide a yes/no answer, while undecidable problems cannot be solved for all cases and may not yield an answer. Decidable languages have Turing machines that halt for every input, whereas undecidable languages do not. Examples include checking even numbers for decidable and the Halting Problem for undecidable.

Uploaded by

krishna vekariya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views7 pages

Unit 7 Undecidability

Decidable problems can be solved using algorithms and always provide a yes/no answer, while undecidable problems cannot be solved for all cases and may not yield an answer. Decidable languages have Turing machines that halt for every input, whereas undecidable languages do not. Examples include checking even numbers for decidable and the Halting Problem for undecidable.

Uploaded by

krishna vekariya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Mention the difference between decidable and undecidable problems.

(W-24)

No Decidable Problems Undecidable Problems


.
1 problem that can be solved using A problem that cannot be
a step-by-step method solved for all cases using any
(algorithm). algorithm.

2 Can be solved by a computer Cannot be solved by any


program computer program
3 Always give a yes/no answer May not give a yes/no answer
4 Turing machine halts for all Turing machine may not halt
inputs for some inputs
5 Example: Checking even Example: Halting problem
number
6 Also called recursive problems Also called non-recursive
problems
7 Can be proved as solvable Impossible to prove solvable
8 Follow a fixed method to reach No general method to reach
answer answer
9 Used in real-life applications Mostly in theoretical studies

When we say a problem is decidable? Give an example of


an undecidable problem.(W-24)

What is a Decidable Problem?


1. A problem that can be solved using a step-by-step method
(algorithm).
2. The computer always gives an answer (yes or no).
3. The program always halts (stops) after some time.
4. These problems are also called recursive problems.
5. They are used in real-life applications.
Example:
 Check if a number is even or odd.
 Check if a string is accepted by a DFA.
What is an Undecidable Problem?
1. A problem that cannot be solved for all cases using any algorithm.
2. The computer may not give an answer or may run forever.
3. These problems are also called non-recursive problems.
4. They are mostly used in theoretical computer science.
5. No fixed method works for every input.
Example:
 Halting Problem – Will a program stop or run forever?
 Post Correspondence Problem (PCP) – Does a match exist between
string pairs?

When can we say that the language is decidable or undecidable?(S-23)

Decidable Language:
1. A language is decidable if there is a Turing machine that can accept
all strings in the language and reject all strings not in the language.
2. The machine will always halt (stop) for every input.
3. It gives a yes or no answer for every string.
4. These languages are also called recursive languages.
Example:
 Language accepted by a DFA (Deterministic Finite Automaton).

Undecidable Language:
1. A language is undecidable if there is no Turing machine that can
decide it for all inputs.
2. The machine may loop forever on some inputs.
3. No algorithm can give a correct answer for every string.
4. These are also called non-recursive languages.
Example:
 Language related to the Halting Problem.

Explain the concept of undecidable problems.(S-24)

What is an Undecidable Problem?


1. A problem that cannot be solved for all cases using any algorithm.
2. The computer may not give an answer or may run forever.
3. These problems are also called non-recursive problems.
4. They are mostly used in theoretical computer science.
5. No fixed method works for every input.

1. Undecidable Problems in RE Languages (Recursively


Enumerable)
RE Language:
 Languages that a TM can accept, but may not halt for all inputs.
Undecidable Problems:
 Acceptance Problem:
o Given a TM M and input w, does M accept w?
o This is semi-decidable (TM halts if accepted, else runs forever).
o Undecidable

2. Undecidable Problems in Context-Free Languages


(CFLs)
Context-Free Language:
 Languages generated using Context-Free Grammar (CFG) and
accepted by Pushdown Automata (PDA).
Undecidable Problems:
 Intersection Emptiness:
o Given two CFGs G1 and G2, is L(G1) ∩ L(G2) = Ø?
o Undecidable

3. Undecidable Problems in Turing Machines (TMs)


Turing Machine:
 A mathematical model that can perform any computation.
 Most powerful model, but not all problems are solvable.
Undecidable Problems:
 Halting Problem:
o Will TM M halt on input w or run forever?
o Undecidable
Mention the difference between P and NP problems.(W-24)

No P Problems NP Problems
.
1 P = Polynomial time NP = Non-deterministic
Polynomial time
2 Easy to solve Hard to solve
3 Quick solution Slow solution
4 Solvable in polynomial Verifiable in polynomial time
time
5 Example: Sorting Example: Sudoku puzzle
numbers
6 All P problems are in Not all NP problems are in P
NP
7 Algorithm known Algorithm may not be known
8 Less complex More complex
9 Fast solution No guarantee of fast solution
guaranteed
10 Used in real-time Used in cryptography, puzzles,
systems etc.

Explain in detail: Class P and Class NP.(W-22)

P Problems
What is P?
1. P stands for Polynomial time. These are problems that can be solved
quickly and efficiently using algorithms.
2. They are easy to solve using a clear step-by-step process.
3. The time taken grows slowly as the input size increases.
4. These problems are common in basic computer science tasks.

Key Features of P Problems


 Easy to solve and also easy to check.
 Fast algorithms are already known.
 Used in everyday applications and real-time systems.
Example: Sorting Numbers
1. You are given a list like [9, 5, 1, 7].
2. The task is to arrange them in increasing order.
3. Algorithms like Merge Sort or Bubble Sort solve this efficiently.
4. The solution is quick and works even for large lists.
5. Therefore, sorting numbers is a P problem.

Real-Life Analogy
 Like arranging your books alphabetically — simple, fast, and done
using clear rules.

Explain NP-complete problems with an example(W-24)

NP-Complete Problems
What is NP-Complete?
1. NP stands for Non-deterministic Polynomial time. It means
problems whose solution can be verified quickly (in polynomial time)
even if finding the solution is hard.
2. NP-Complete problems are the hardest problems in NP.
3. If any NP-Complete problem can be solved quickly, all problems in
NP can also be solved quickly.
4. NP-Complete problems are both in NP and NP-Hard.

Key Features of NP-Complete Problems


 Hard to solve, but easy to check if a solution is correct.
 No known fast algorithm to solve all of them.
 Used in computer science, optimization, cryptography, etc.

Example: Travelling Salesman Problem (TSP)


1. You are a salesperson who needs to visit a list of cities.
2. You must visit each city once and return to the starting city.
3. The goal is to find the shortest path that covers all cities.
4. It is easy to check if a given path is short, but hard to find the
shortest path when cities increase.
5. Hence, it is an NP-Complete problem.

Real-Life Analogy
 Like trying to solve a complex jigsaw puzzle — once it’s complete,
it's easy to see it's correct, but putting it together is very difficult.

3. Relation Between P and NP:


P ⊆ NP
All problems that are in P are also in NP, because if you can solve a problem quickly, then of
course you can check the answer quickly.
Big Question:
Is P = NP?
 We don’t know yet.
 If someone proves that every NP problem can be solved quickly,
then P = NP.
 It’s one of the biggest open problems in computer science.

Discuss Post’s Correspondence Problem with example.(W-22)

What is PCP?
1. Post’s Correspondence Problem (PCP) is a famous problem in
Theory of Computation.
2. It was introduced by Emil Post.
3. You are given two lists of strings (like cards with a top and bottom).
4. The goal is to find a sequence of cards where the top and bottom
strings become equal when joined.
5. PCP is undecidable – there is no general algorithm to solve every
case.

How PCP Works


 You are given two lists:
o List A (Top strings): A1, A2, A3, …
o List B (Bottom strings): B1, B2, B3, …
 You can use any sequence of indexes, and even repeat them.
 If the combined top and bottom strings are exactly the same, then
it's a solution.

Example of PCP
Let’s say:
 List A (Top): a | ab | b
 List B (Bottom): aab | b | a
Try the sequence: 1, 2, 3
 Top: A1 + A2 + A3 = a + ab + b = aabb
 Bottom: B1 + B2 + B3 = aab + b + a = aabba
Since aabb ≠ aabba, this is not a match.
Try other sequences to check for a match.

Key Points of PCP


 PCP checks if two string sequences match exactly.
 Cards can be reused and rearranged.
 PCP is undecidable – you can’t always find an answer.
 It helps us understand the limits of algorithmic computation.

You might also like