# DFA accepts common strings, reduction to NPcomplete

$B=\{\left<M_1,M_2,...,M_k\right>\text{ : Each$M_i$is a DFA and all of the$M_i$accept some common string.} \}$

I'm trying to show that B is NP-complete. I know I have to reduce it to another NP-complete problem, but I'm having a lot of trouble coming up with the algorithm that decides B.

I was thinking I could keep track of all the DFAs accepted by M1 and then check those in M2, any that accept there I'd feed to M3 and so on until I either ran through all the DFAs (accept) or ran out of accepted strings (reject). I'm not really convinced this runs in NP time though. How exactly do I prove that it does? Or is this a terrible algorithm?

Thank you!

• Your question is a very basic one. Since you did not include much of an attempt to solve it on your own, we have little to work with. Let me direct you towards our reference questions. Please work through the related questions listed there, try to solve your problem again and edit to include your attempts along with the specific problems you encountered. – D.W. Nov 25 '15 at 2:20
• Your paragraph beginning "I was thinking.." sounds confused about the difference between NP vs NP-complete; please see cs.stackexchange.com/q/9556/755. It also sounds like you are struggling to find a reduction; for that, please refer to cs.stackexchange.com/q/11209/755 and cs.stackexchange.com/q/1240/98. (possible dup? any community votes?) – D.W. Nov 25 '15 at 2:22
• Hint: Reduce SAT to your problem. Let each $M_i$ be in charge of a specific clause of the input SAT instance. – Yuval Filmus Nov 25 '15 at 8:16
• To show that your problem is hard, you do not reduce it to a known hard problem, you reduce the known hard problem to your problem. Could you for example reduce 3SAT to your problem? That is you are given clauses and you could derive DFAs $M_1,...,M_k$ that have a common string iff the set of clauses are satisfiable? – phs Nov 25 '15 at 11:22