LearnViz CompSci
Home / Learn / Theory & Discrete Math / Decidability

Intermediate Topic 30 of 51 Theory & Discrete Math

Decidability

Whether an algorithm can always answer a yes/no question.

How it works

A problem is decidable if there is an algorithm that always halts and correctly answers yes or no for every input. A language is recognizable if a machine accepts exactly its members, but may loop on non-members; it is decidable if some machine also always halts. Many natural problems are decidable, such as whether a string matches a regular expression, whereas others are undecidable, such as the halting problem, equivalence of context-free grammars and whether a program has a given property.

Step-by-step walkthrough

  1. A decision problem asks a yes or no question.
  2. It is decidable if an algorithm always halts with the right answer.
  3. The algorithm answers on every input.
  4. Some problems have no such algorithm.
  5. Undecidable problems exist, the halting problem is the classic example.

Where it is used

Decidability results show what compilers, verifiers and static analyzers can and cannot do in general, motivating approximations, restricted languages and semi-decision procedures.

Common pitfall

Undecidable means no algorithm works for all inputs, not that every instance is hard. Many specific instances can be solved, and tools work heuristically. Confusing recognizable with decidable, or decidable with efficient, is common. To show undecidability, reduce from a known undecidable problem such as halting.

Where it fits in the course

Decidability is topic 30 of 51 in Theory & Discrete Math, rated Intermediate. It follows Church-Turing Thesis. The next topic is Halting Problem.

Practice and explore

How to study this topic

  1. Read the explanation above and restate the definition in your own words.
  2. Open the interactive lesson and answer its mini quiz.
  3. Read the common pitfall, then write a short example that avoids it.
  4. Check your understanding in the Theory & Discrete Math quiz, and revisit the topic if you miss a question.

Frequently asked questions

What is Decidability?
Whether an algorithm can always answer a yes/no question. It belongs to Theory & Discrete Math and is an intermediate-level topic.
Where do people use Decidability?
Decidability results show what compilers, verifiers and static analyzers can and cannot do in general, motivating approximations, restricted languages and semi-decision procedures.
What is the most common mistake with Decidability?
Undecidable means no algorithm works for all inputs, not that every instance is hard.
What should I learn before this topic?
Start with Church-Turing Thesis, the topic just before it in Theory & Discrete Math.
How can I practice it?
Answer the mini quiz in the interactive lesson, then take the Theory & Discrete Math quiz.
Is Decidability hard to learn?
It is an Intermediate topic. Be comfortable with the Beginner topics in this area first, then read the common pitfall carefully, since it is where most mistakes happen.
How long does it take to learn Decidability?
Most learners can read the explanation and finish the interactive lesson in under an hour. Fluency comes from applying the idea, so plan a few short practice sessions with the quiz.
Which topics are related to Decidability?
Church-Turing Thesis, Halting Problem, Turing Machines are closely connected. The full list is in the related topics section of this page.
What should I study after Decidability?
Continue with Halting Problem, the next topic in Theory & Discrete Math.

Related topics