1
$\begingroup$

If I have a deterministic finite automaton (DFA) with a language $W$, and I need to create another DFA that returns all the strings that are a concatenation of an even number of strings in $W$, how would I solve this?

I was considering an approach where I alternate between accepted even multiples of the DFA and unaccepted odd multiples, and essentially connect two copies of the original DFA together to create the even-DFA. However, if I have multiple accept states within the original language this would complicate things as I would need to allow connections from all of these states, and would then need to consider the presence of self-loops.

This will be implemented in Haskell, but insight either from the logic point of view or the coding point of view would be greatly appreciated.

$\endgroup$
1
  • $\begingroup$ Do you mean: another DFA which accepts all the strings...? $\endgroup$ Commented Oct 16, 2023 at 3:07

1 Answer 1

1
$\begingroup$

The language you are considering is $(W^2)^*$, so you could combine standard constructions for the concatenation and the star operation.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.