1 Decidability continued…. 2 Theorem: For a recursively enumerable language it is undecidable to...
-
Upload
mayra-hinman -
Category
Documents
-
view
219 -
download
1
Transcript of 1 Decidability continued…. 2 Theorem: For a recursively enumerable language it is undecidable to...
2
Theorem:
For a recursively enumerable language Lit is undecidable to determine whether is finite L
Proof:
We will reduce the halting problemto this problem
3
Algorithm for finite languageproblem
M
YES
NO
Assume we have the finite language algorithm:
Let be the machine that accepts M L
)(ML
)(ML
finite
not finite
LML )(
4
Algorithm for Halting problem
M
w
YES
NO
halts onM w
We will design the halting problem algorithm:
doesn’t halt onM w
5
First construct machine : wM
When enters a halt state, accept any input (inifinite language)
M
Initially, simulates on input M w
Otherwise accept nothing (finite language)
7
Algorithm for halting problem:
Inputs: machine and string M w
1. Construct wM
2. Determine if is finite )( wML
YES: then doesn’t halt on
NO: then halts on
M w
M w
9
Theorem:
For a recursively enumerable language Lit is undecidable to determine whether contains two different strings of same length L
Proof:We will reduce the halting problemto this problem
10
Algorithm for two-stringsproblem
M
YES
NO
Assume we have the two-strings algorithm:
Let be the machine that accepts M L
)(ML
)(ML
contains
Doesn’t contain
LML )(
two equal length strings
11
Algorithm for Halting problem
M
w
YES
NO
halts onM w
We will design the halting problem algorithm:
doesn’t halt onM w
12
First construct machine : wM
When enters a halt state, accept symbols or
M
Initially, simulates on input M w
a b(two equal length strings)
14
Algorithm for halting problem:
Inputs: machine and string M w
1. Construct wM
2. Determine if accepts two strings of equal length
wM
YES: then halts on
NO: then doesn’t halt on
M w
M w
15
construct
wM
Check if)( wML
has twoequal lengthstrings
YES
NO
M
w
YES
NO
Machine for halting problem
17
Some undecidable problems forcontext-free languages:
• Is context-free grammar ambiguous?G
• Is ? )()( 21 GLGL
18
We need a tool to prove that the previousproblems for context-free languagesare undecidable:
The Post Correspondence Problem
20
There is a Post Correspondence Solutionif there is a sequence such that:kji ,,,
kjikji vvvwww
PC-solution
22
Example:00100 1000
0 11 011
1w 2w 3w
1v 2v 3v
:A
:B
There is no solution
Because total length of strings from is smaller than total length of strings from
BA
23
The Modified Post Correspondence Problem
Inputs: nwwwA ,,, 21
nvvvB ,,, 21
MPC-solution: kji ,,,,1
kjikji vvvvwwww 11
25
1. We will prove that the MPC problem is undecidable
2. We will prove that the PC problem is undecidable
26
1. We will prove that the MPC problem is undecidable
We will reduce the membership problemto the MPC problem
29
The reduction of the membership problemto the MPC problem:
For unrestricted grammar and string G w
we construct a pair such thatBA,
BA, has an MPC-solution if and only if )(GLw
30
A
FS
B
FF : special symbol
aa For every symbol
Grammar G
S : start variable
a
V V For every variable V
38
EcaaaCAabBAaSF
A
B
1w
aaacaACaABbS
10w
1v 10v
14w 2w 5w 12w
14v 2v 5v 12v 14v 2v 13v 9v
14w 2w 13w 9w
40
Algorithm for membership problem:
Input: unrestricted grammar string
Gw
Construct the pair BA,
If has an MPC-solution then BA, )(GLw
else )(GLw
42
2. We will prove that the PC problem is undecidable
We will reduce the MPC problemto the PC problem