Unit 7 Undecidability
Unit 7 Undecidability
(W-24)
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.
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.
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.
Real-Life Analogy
Like arranging your books alphabetically — simple, fast, and done
using clear rules.
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.
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.
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.
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.