1 the chomsky hierarchy. 2 unrestricted grammars: rules have form string of variables and terminals...
Post on 20-Dec-2015
219 views
TRANSCRIPT
2
Unrestricted Grammars:
Rules have form vu
String of variablesand terminals
String of variablesand terminals
5
Context-Sensitive Grammars:
Rules have form vu
String of variablesand terminals
String of variablesand terminals
And: |||| vu
9
Non-recursively enumerable
Recursively-enumerable
Recursive
Context-sensitive
Context-free
regular
11
Consider problems with answer YES or NO
Examples:
• Does Machine have three states ?M
• Is string a binary number? w
• Does DFA accept any input? M
13
Some decidable problems:
• Does Machine have three states ?M
• Is string a binary number? w
• Does DFA accept any input? M
14
The machine that decides the problem:
• If the answer is YES then halts in a yes state
• If the answer is NO then halts in a no state
These states may not be final states
15
Difference between
Recursive Languages andDecidable problems
The YES halting states may not be final states
For decidable problems:
16
There are some problemswhich are undecidable:
There is no Turing Machine thatsolves all instances of the problem
20
THEOREM
The halting problem is undecidable
PROOF
Assume for contradiction thatthe halting problem is decidable
21
There exists Turing Machinethat solves the halting problem
H
HM
wYES or NO
YES: M accepts w
NO: M Doesn’t accept w
31
Another proof of the same theorem
If the halting problem was decidable thenevery recursively enumerable languagewould be recursive
32
THEOREM
The halting problem is undecidable
PROOF
Assume for contradiction thatthe halting problem is decidable
33
Turing Machine solves the halting problemH
For inputs: machine M and string w
H Returns:
M halts on input wYES: if
M doesn’t halt on inputwNO: if
34
Let be a recursively enumerable language L
Let be the Machine that acceptsM L
We will prove that is recursive L
We will describe a membership algorithm
37
Therefore L is recursive
But there are recursively enumerablelanguages which are not recursive
Contradiction!!!!
43
The state-entry problem
Inputs: M•Turing Machine
•State q
Question:
Does M
•String w
enter state q
on input ?w
45
THEOREM
The state-entry problem is undecidable
PROOF
Reduce the halting problem to
the state-entry problem
46
Suppose we have an algorithmfor the state-entry problem
We will construct an algorithmfor the halting problem
47
Inputs for the halting problem
•A machine M
•A string w
Algorithm for halting problem must determineif halts on inputM w
48
Modify machine :M
•Add new state q
•From any halting state add transitions to q
M q
halting statesSinglehalt state
M
50
Algorithm for halting problem:
Inputs: M wand
1. Construct with state M q
2. Run algorithm for state-entry problem with inputs: M wq, ,
52
Since the halting problem is undecidable,
the state-entry problem is also undecidable
END OF PROOF
54
The blank-tape halting problem
Input: MTuring Machine
Question:
Does M halt when started with
a blank tape?
56
THEOREM
PROOF
Reduce halting problem to
Blank-tape halting problem
The blank-tape halting problem is undecidable
57
Suppose we have an algorithmfor the blank-tape halting problem
We will construct an algorithmfor the halting problem
58
Inputs for the halting problem
•A machine M
•A string w
Algorithm for halting problem must determineif halts on inputM w
61
Algorithm for halting problem:
Inputs: M wand
1. Construct wM
2. Run algorithm for blank-tape halting problem with input
, ,
wM