0

I've got homework to design NFA to accept a set of strings over {a,b,c} in which each string of the language satisfies: "cac" is a substring and "cc" is not a substring and the length of the string is even.
I tried to approach the problem by looking at the shortest strings of the language and building a template for the automata, so I took for example the strings : "acac" and "cacb" which both of them belong to the language and started drawing:
skeleton

Then I continued to develop it and finally got to: final

But I am not sure how to test the correctness other than trying a lot of different strings, I have to mention that on my course I don't have to prove the correctness of the automata most of the time, and in this case, I don't need also but I'll be happy to learn about some ways that will increase my confidence when designing automata's. Thanks.

Source: https://mega.nz/folder/0Sg0iD4B#0OPF1JJgFjtYoJuStlsCtA/folder/JPBX0K6J

Yarin
  • 275
  • 1
  • 7
  • https://cs.stackexchange.com/q/1331/755, https://cs.stackexchange.com/q/11315/755 – D.W. Apr 01 '23 at 15:44
  • @D.W. Thanks, do you know if there's any informal way/algorithm that can be easily implemented and might imply correctness other than testing a lot of strings? – Yarin Apr 01 '23 at 16:37
  • Yes, use proof by induction. Random testing on a million random strings is also probably a pretty good test. – D.W. Apr 01 '23 at 23:30
  • @Yarin There is certainly no harm "looking at the shortest strings of the language". However, the right way to build a finite state automaton for a given language that is specified by some properties is to think in terms of state by those properties. – John L. Apr 02 '23 at 06:15

0 Answers0