90 likes | 201 Views
CS 461 – Nov. 14. Section 5.2 – Undecidable problems starting from A TM : Matching sets of strings Ambiguity of CFGs. String matching. Formal name is the Post Correspondence Problem , (by mathematician Emil Post) Given a set of dominoes Each contains a string on the top and bottom
E N D
CS 461 – Nov. 14 • Section 5.2 – Undecidable problems starting from ATM: Matching sets of strings Ambiguity of CFGs
String matching • Formal name is the Post Correspondence Problem, (by mathematician Emil Post) • Given a set of dominoes • Each contains a string on the top and bottom • Use the dominoes so that the strings on the top and bottom match. • You may use each domino as many times as you like. But there must be one domino. • The solution is the sequence of dominoes (e.g. 1,2,3) 11 111 100 001 111 11
Another PCP • Can you find a solution to this one? 1 111 10111 10 10 0 Or this one? 10 101 011 11 101 011
Undecidability • To show the problem is undecidable in general, we draw a parallel with ATM, which we know is undecidable. • Take any TM with an input word. If we follow the TM’s steps, there is a parallel sequence of dominoes! Accept there is a match, and reject there is no match. • For each possible TM action, we specify what the dominoes look like.
Example • This is best seen via an example. Let’s say we have a TM that accepts the language 1*00*1(0+1)*, and we feed it the word 01. [s1] 0 1 0 [s2] 1 0 1 [acc]
There are 7 kinds of dominoes we need. The first domino represents the initial configuration of the TM, which is [s1] 0 1 0 [s2] 1 0 1 [acc] Create dominoes! # #[s1] 0 1 #
Second type of domino represents moves to the right. In our case we see [s1] 0 1 0 [s2] 1 0 1 [acc] Dominoes (2,3) [s1] 0 0 [s2] [s2] 1 1 [acc] The third type of domino would represent moves going left, but we don’t have any of these. In general, right moves are qa/br and left moves are cqa/rcb.
Allow ourselves to do nothing to a tape symbol away from the read-write head. [s1] 0 1 0 [s2] 1 0 1 [acc] Dominoes (4, 5) 0 0 1 1 _ _ Also, allow use to put a delimiter (#) between steps, and put blanks on either side of the input as needed. # # # # _ # _ #
Allow ourselves to eat the tape once we accept! There will be 6 dominoes like this: [s1] 0 1 0 [s2] 1 0 1 [acc] Dominoes (6, 7) 0 [acc] [acc] [acc] 0 [acc] And finally, we need a special case domino to “eat” the accept state notation on the tape. [acc] # # #