Dies ist wahrscheinlich ziemlich einfach, aber betrachten Sie das Standard-Post-Korrespondenz-Problem:
Gegeben und β 1 , ... , β N , findet sie eine Folge von Indizes i 1 , ... , i K , so dass & agr; i 1 ⋯ α i K = β i 1 ⋯ β i K . Das ist natürlich nicht zu entscheiden.
Nun, ich nenne das eine "Variante", aber es ist nicht wirklich - es wirft im Wesentlichen "Korrespondenz" weg. Betrachten Sie auf jeden Fall die folgende Variante:
Given and , find two sequences of indices such that . What can be said about this variant? If this is trivial, my apologies!
Antworten:
This new version - whereK=K′ - is decidable.
Let's show that the languageL:=⋃k≥1(Ak ∩ Bk) is a CFL. Then the decidability follows from the decidability of the emptiness of a CFL.
We'll design a PDA to acceptL . On input x , this PDA will try to construct two factorizations of x , one using words of A , and the other using words of B . It will use a counter on the stack to ensure these two factorizations are of the same length. Conceptually I will refer to the A -factorization of x so far as sitting on top of x and the B -factorization as sitting on the bottom of x . Then the stack will contain n counters iff the absolute value of the difference of the number of words matched on the top, minus the number of words on the bottom, is n . We need another state of the PDA to record what the appropriate sign is corresponding to n (which tells us if the A -factorization is longer than the B -factorization, or vice versa).
As we scan the letters ofx , we nondeterministically guess a word t of A and a word u of B to which this letter begins. Once we guess, we are committed to matching the rest of t and u against x ; if at any point our match fails, we halt in this nondeterministic choice. So we also maintain, in the state of our PDA, the suffix of t and u that remains to match.
As we scan further letters, we continue matching until we hit the end oft or the end of u (or both). When we hit the end of a word, we update the stack appropriately, and then guess a new word to match in either the top or bottom (or both).
We accept if the suffixes remaining to be matched are both empty in top and bottom, and the stack contains no counters.
We can construct this PDA effectively, so we can effectively decide if it accepts anything or not (for example, by converting effectively to a grammarG and then using the usual method to see if G generates anything).
Edit: One can also turn this into an upper bound on how bigk can be, in the worst case. I think it should give an upper bound of something roughly like 2O(l2) , where l is the sum of the lengths of the words in A and B .
Edit: I see now that the requirement thatA and B be finite sets can also be relaxed, to the requirement that A and B be regular (possibly infinite). In this case, instead of maintaining the suffix remaining to be matched in "top" and "bottom", instead we maintain the states of the respective DFA we are in, after processing the prefix of a possible matched word. If we hit a final state in either "top" or "bottom", we can nondeterministically choose to go back to the initial state for a new guessed word.
quelle
Edit: This solves an earlier version, in which we have to decide whether there is an equality of the formαi1⋯αiK=βj1⋯βjK′ . The new version has K=K′ .
The languageA generated by all strings of the form αi1⋯αiK is regular. The language B generated by all strings of the form βj1⋯βjK′ is regular. You're asking whether A∩B is empty. Since A,B are regular, this is decidable (in fact, in at most exponential time).
quelle