Computability
مُقدَّم
5:58
نظرية الحوسبة والمترجمات
This course asks what machines can decide, and how text becomes meaning. The first three units are theory: automata and regular languages, context-free…
سرد باللغة الإنجليزية · ترجمة نصية بالإنجليزية و中文 يمكنك التبديل بينهما
في هذا الدرس
| English | المعنى |
|---|---|
| Turing machine/ˈtjʊərɪŋ məˈʃiːn/ | آلة تورينغ |
| halting problem/ˈhɒltɪŋ ˈprɒbləm/ | مشكلة التوقف |
| decider | |
| Diagonalisation/daɪˌæɡənəlaɪˈzeɪʃn/ | a proof method that builds an object different from every object in a list, so the list cannot be complete |
| Rice's theorem/ˈraɪsɪz ˈθɪərəm/ | every non-trivial question about what a program's behaviour is cannot be decided in general |
| decidable/dɪˈsaɪdəbl/ | a problem for which some algorithm always halts with the correct yes or no |
| Recognisable/ˈrekəɡnaɪzəbl/ | a language for which some machine halts and accepts every string in it, but may run for ever on others |
The formal algorithm
- The Turing machine 图灵机 (a tape, a head and states) is the formal meaning of "algorithm". The halting problem 停机问题 asks: does machine $M$ halt on input $w$?
- Suppose a decider $H$ exists. Build $D(M)$: run $H(M, M)$; if it says "halts", loop for ever; if it says "loops", halt. Now run $D$ on $D$. If $H$ says $D$ halts, $D$ loops; if $H$ says $D$ loops, $D$ halts. Either way $H$ is wrong, so $H$ cannot exist.

The halting problem proof builds D(M) that —
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
D flips the answer about itself - running D on D contradicts.
Put the steps of the halting-problem proof in order.
الصعوبة 3/5 · 200 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
If $D(D)$ halts, $H$ said it loops; if it loops, $H$ said it halts. The only assumption was $H$, so $H$ is what fails.
Diagonalisation, once
- List all machines and their descriptions in matching rows and columns. Diagonalisation 对角线论证 assumes a halting decider exists and uses it to build $D$ that does the opposite of each machine on its own description. Since $D$ is itself in the list, applying it to its own description gives a contradiction. The same idea underlies the proof that the real numbers cannot be listed.
- Rice's theorem 莱斯定理: every non-trivial property of the function computed by a program is undecidable. Separately, "does $P$ ever print banana?" is undecidable: a program that runs $M$ on $w$ (with $M$'s own output switched off) and then prints banana would turn any banana-checker into a halting-checker.
Rice's theorem covers —
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Every non-trivial property of what the program computes is undecidable.
A decidable cousin
- "Does DFA $D$ accept no string at all?" is decidable 可判定. Mark every state reachable from $q_0$ (a search in a finite graph); the answer is yes if no accepting state is marked.
- Finiteness makes the search possible. The infinite tape of a Turing machine is exactly what breaks this argument for the halting problem.
DFA emptiness is decidable because —
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Finite graph, finite search: mark reachable states, check accept.
Rice's theorem means no program can decide whether a DFA accepts the empty language.
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Rice's theorem is about semantic properties of Turing machines. DFA emptiness is decidable: search the finite state graph from $q_0$ and check whether any accepting state is reachable.
The decidability map
- Decidable: a machine always halts with yes or no, as for DFA emptiness or "does CFG $G$ generate $w$?".
- Recognisable 可识别: a machine says yes on every yes-instance but may run for ever on a no. Halting is recognisable (run $M$ on $w$ and accept if it stops) but not decidable.
- If a language and its complement are both recognisable, run both machines side by side: one of them must stop, so the language is decidable. So the complement of the halting problem is not even recognisable.
The halting problem is recognisable.
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Simulate M on w and accept if it halts; on a no-instance the simulation simply never ends.
Which question is decidable?
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
CYK answers CFG membership in polynomial time; the other questions are undecidable, including the print question by a reduction from halting.
Reduce halting to your problem
- To show that "does $M$ accept the empty string?" is undecidable, turn any halting question $(M, w)$ into a machine $M'$: ignore your input, run $M$ on $w$, then accept.
- $M'$ accepts the empty string exactly when $M$ halts on $w$. A decider 判定器 for the new problem would decide halting, so none exists. The arrow runs from halting to the new problem.
Which is decidable?
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Simulate 1000 steps and stop: the bound makes it finite.
Worked example: there are too few machines
- Every Turing machine 图灵机 is a finite string, so the machines can be listed: there are countably many. Languages over $\{0, 1\}$ are sets of strings, and there are uncountably many such sets.
- Even short strings give many languages: there are $1 + 2 + 4 + 8 = \mathbf{15}$ strings of length at most 3, and $2^{15}$ languages of them alone. Over all lengths, most languages have no machine at all.
How many binary strings have length at most 3 (including the empty string)?
الصعوبة 2/5 · 140 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
$1 + 2 + 4 + 8 = 15$.
Most languages over $\{0, 1\}$ are not decided by any Turing machine.
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Machines are countable; languages are not.
Marks that slip away
- Undecidable as never answerable. It means no single program answers every instance; many instances are easy.
- Recognisable as decidable. A recogniser may loop on a no-instance; a decider always halts.
- Reducing the wrong way. To prove a property undecidable, reduce the halting problem 停机问题 to it.
Recap
- The Turing machine is the formal meaning of "algorithm"; diagonalisation 对角线论证 shows the halting problem is undecidable.
- Rice: every non-trivial property of the function computed by a program is undecidable.
- Finite structures, such as DFAs, keep many questions decidable. The three machines of this course: a DFA has only its state, a pushdown automaton (PDA) adds a stack, and a Turing machine (TM) a tape.
| Machine | Accepts | Fails on |
|---|---|---|
| DFA | regular languages | $a^nb^n$ |
| PDA | context-free languages | $a^nb^nc^n$ |
| TM | anything computable | the halting problem |
ما المشكلة؟ لا يرى ذلك سوى فريق الموقع.