Acredito que encontrei uma redução no caminho Hamiltoniano , provando o problema NP-difícil.
Chame a palavra w ∈ Σ * uma testemunha de A , se satisfizer a condição da questão (para cada L ∈ A , há m ≥ 1 tal que { w m + i | 0 ≤ i < | L | } = L ) .w∈Σ∗AL∈Am≥1{wm+i∣0≤i<|L|}=L
Considere a versão de decisão do problema original, ou seja, decida se para alguns A e k ≥ 0 , há uma testemunha de A no máximo k . Esse problema pode ser resolvido usando o problema original como um oráculo no tempo polinomial (encontre a menor testemunha e compare seu comprimento com k ).Ak≥0Akk
Agora, o núcleo da redução. Seja G = ( V , E ) um gráfico simples, não direcionado e conectado. Para cada v ∈ V , deixar L v = { v } ∪ { e ∈ E | v ∈ e } o conjunto contendo o vértice v e todos os seus bordos adjacentes. Defina Σ = E e A = { L v ∣ v ∈ V } . Então GG=(V,E)v∈VLv={v}∪{e∈E∣v∈e}vΣ=EA={Lv∣v∈V}Gpossui um caminho hamiltoniano se, e somente se, houver uma testemunha de A no máximo 2 | E | + 1 .A2|E|+1
Proof. Let v1e1v2…en−1vnv1e1v2…en−1vn be a Hamiltonian path in GG and H={e1,e2,…,en−1}H={e1,e2,…,en−1} the set of all edges on the path. For each vertex vv, define the set Uv=Lv∖HUv=Lv∖H. Choose an arbitrary ordering αvαv for each UvUv. The word w=αv1e1αv2e2…en−1αvnw=αv1e1αv2e2…en−1αvn is a witness for AA, since Lv1Lv1 is represented by the substring α1e1α1e1, LvnLvn by en−1αnen−1αn, and for each vivi, i∉{1,n}i∉{1,n}, LviLvi is represented by ei−1uvieiei−1uviei. Furthermore, each edge in EE occurs twice in ww with the exception of |V|−1 edges in H, which occur once, and each vertex in V occurs once, giving |w|=2|E|+1.
For the other direction, let w be an arbitrary witness for A of length at most 2|E|+1. Clearly, each e∈E and v∈V occurs in w at least once. Without loss of generality, assume that each e∈E occurs in w at most twice and each v∈V occurs exactly once; otherwise a shorter witness can be found by removing elements from w.
Let H⊆E be the set of all edges occurring in w exactly once. Given the assumptions above, it holds that |w|=2|E|−|H|+|V|.
Consider a contiguous substring of w of the form ue1e2…ekv, where u,v∈V, ei∈E. We say that u,v are adjacent. Notice that if ei∈H, then ei={u,v}, because ei occurs only once, yet it is adjacent to two vertices in G. Therefore, at most one of ei can be in H. Similarly, no edge in H can occur in w before the first vertex or after the last vertex.
Now, there are |V| vertices, therefore |H|≤|V|−1. From there, it follows that |w|≥2|E|+1. Since we assume |w|≤2|E|+1, we get equality. From there we get |H|=|V|−1. By pigeonhole principle, there is an edge from H between each pair of vertices adjacent in w. Denote h1h2…hn−1 all elements from H in the order they appear in w. It follows that v1h1v2h2…hn−1vn is a Hamiltonian path in G. ◻
Since the problem of deciding the existence of Hamiltonian path is NP-hard and the above reduction is polynomial, the original problem is NP-hard too.