Decidability
- 把一类问题转换为一种语言,使图灵机检测是否可判断,对应这类问题是否有解。
- For decidability purposes, it is equivalent to present the Turing machine with a DFA, an NFA, or a regular expression because the machine can convert one form of encoding to another.
- Using a TM as a subroutine in another TM
正则语言的可判定性问题
- DAF接受性问题:={ ⟨B, w⟩ | B是 DFA 并且接受输入串 w }
- NFA接受性问题:={ ⟨B, w⟩ | B 是 NFA 并且接受输入串 w }
- 正则派生性问题:={ ⟨R, w⟩ | R 是 正则表达式,w 是串,R 派生 w }
- DFA空性问题:={ ⟨A⟩ | A 是 DFA 并且 L(A) }
DFA等价性问题:={ ⟨A, B⟩ | A 和 B 都是 DFA 并且 L(A)=L(B) }
,其中 A 和 B 都是 DFA:
- 构造 ,只接受
- 在输入 上运行判断 DFA 空性使用的图灵机
- 如果 接受,则接受;如果T拒绝,则拒绝。”
两个 DFA 都接受相同的串不能证明它们两个相等,只能利用构造补集,如果这个集合是空的,才说明它们等价。
上下文无关语言的可判定性问题
- CFG派生性问题:={ ⟨G, w⟩ | G 是 CFG, w是串,G派生w }
- CFG空性问题:={⟨G⟩ | G 是 CFG 并且 L(G) }
不可判定性问题
TM 接受性问题
= { ⟨M, w⟩ | M 是图灵机且接受串 w }
是不可判定的 是不可识别的( 是可识别的)
可数性
A set is countable if either it is finite or it has the same size as .
Example: Let be the set of natural numbers and let be the set of even natural numbers .
The correspondence mapping to is simply . Using Cantor’s definition of size, we can see that and have the same size. We can visualize f more easily with the help of a table.
对角化方法
If we have two infinit sets, how can we tell whether one is larger than the other or whether they are of the same size?
If we let be the set of positive rational numbers, seems to be much larger than . Yet these two sets are the same size according to our definition. We give a correspondence with to show that is countable.
Now we turn this matrix into a list. One (bad) way to attempt it would be to begin the list with all the elements in the first row. That isn’t a good approach because the first row is infinite, so the list would never get to the second row.
Instead we list the elements on the diagonals. We avoid causing a repetition (such as ) by skipping an element.
Continuing in this way, we obtain a list of all the elements of .
不可数性
After seeing the correspondence of and , you might think that any two , you might think that any two infinite sets can be shown to have the same size. However, for some infinite sets, no correspondence with exists. These sets are simply too big. Such sets are called uncountable.
is uncountable.
We show that no correspondence exists between and . The proof is by contradiction.
Suppose that a correspondence existed between and . Our job is to show that fails to work as it should.
We construct the desired .
Our objective is to ensure that for any .
The following table shows a few values of a hypothetical correspondence .
例子
证明可识别
Turing-Recognizable Languages are also called Recursively Enumerable Languages.
- 一个语言是图灵可识别的,如果存在一个图灵机(算法),当给定属于语言的字符串时,该图灵机会最终接受它并停机。然而,当给定不属于语言的字符串时,该图灵机可能永远运行下去(不一定停机和拒绝)。
Show that is Turing-recognizable.
The following TM recognizes .
= “On input , where M is a TM:
- Test input on , where be a list of all strings in
- Accept if accept any of ”
💡 By enumerating strings in Σ∗
- 空集的补集即能存在某个元素能被接受就行,而不要求所有元素
- “可判定”的 otherwise 是拒绝; “可识别”要求能接受即可
Show that is co-Turing-recognizable.
The following TM recognizes
= “On input〈G1,G2〉, where A and B are both CFG:
- Examine if G1, G2 are valid Context Free Grammars. If at least one does not, accept.
- Else, transform G1, G2 into corresponding CNF and repeat the below step for i = 1, 2, 3…
- Examine if both G1 and G2 produce which is the string in
- If exactly one of them does and the other doesn’t, accept.”
💡 By enumerating strings in Σ∗
- 补集只是部分否定
证明可判断
Decidable Languages are also called Recursive Languages.
- 一个语言是可判定的,如果存在一个图灵机,当给定任何输入时,它会停止并正确确定该输入是否属于该语言。
Show that is decidable.
We already know is decidable, so there exists a TM that can decide it
Construct a TM that decides as follows:
= “On input , where A is a DFA:
- Construct a DFA such that .
- Test input on
- Accept if accept, otherwise reject.”
是已知可判定的,
所以图灵机 才能产生确切的结果,
从而确定 也是可判定的
- 借助 是否可行 🧐❔
Show that is decidable.
参考答案
The following decides .
=“On input〈G〉, where G is a is a CFG:
- Construct a CFG equivalent in CNF
- Accept if contains the rule , otherwise reject.
个人版本
We already know is decidable, so there exists a TM that can decide it
Construct a TM that can decide as follows:
= “On input〈A〉, where A is a CFG:
- Run on input
- If accept, then accept. Else, reject.”
Show that is a DFA that doesn't accept any string containing an odd number of 1 is decidable.
Construct a DFA that accepts every string containing an odd number of 1s
and a TM that decides
“On input which is a DFA:
- Run on input which is a DFA accepting
- If accepts (i.e. ), then accept. Else, reject.
利用 测试 是否相等
如果相等接受, 则拒绝 ❌
回顾 的证明过程
证明可数性
Show that is countable
Define a set
For , there are finite triples that has sum equal to .
For example, enumerating the triples with
….
Thus, set is finite for every . (存在对应关系)
Hence, is countable.
Show that (the set of all infinite sequences over {0, 1}) is uncountable
Suppose is countable and a correspondence existed between and .
For example,
Define the infinite sequence where for each . Thus, and it does not equal to for any n, which is contradiction.
Hence, is uncountable.