how to intuitively think while Designing an NFA

1.2k views Asked by At

I don't know whether this question is right to be asked, But I definitely felt that it should be asked. I did see a lot of nice and informative questions, articles on inter-net and on StackOverflow itself, of-course. But I found all the questions or articles following a specific rule or a pattern to explain the topic. I mean , when a question was asked on NFA, DFA or Regular Expression , a solution was presented to the question abiding by the theorems / rules of these topics(Theory of Computation).

 But what I feel is that, as most of the questions on DFA/NFA are of the type 
 "Design an NFA...." or "design a DFA..." , i feel that developing/Designing DFA/NFA
 must be an ART. 

And where there is ART I feel there is an intuition. If these problems involve "DESIGNING" something ,then everyone must have their own way( of-course not going out-of-the-way of theorems or rules as such) of solving or attacking these problems. One should have developed a thinking process (over the years of practise ) to solve these problems.

 So I would like all the experts over this Site to share their knowledge (preferably in
  simple words) how they think over the problems (simple ones) of these topics.

I would like to elaborate the question with a simple example.

consider the problem:

Let F be the language of all strings over {0,1} that do not contain a pair of 1s that
are separated by an odd number of symbols. Give the state diagram of a DFA with
five states that recognizes F . 

OR

Design an NFA to find a 4-state NFA for the complement of F .

(the questions are from the Sipser's book and I have also found the solutions for them myself)

I just want to know , how one can develop an intuition for solving the problems.

I am asking this question considering to develop the skills and thinking process of all the Beginners (like me) who face difficulty while solving these problems even though they (including me) have sufficient theoretical knowledge of the topics.

Any "constructive" Answers are profusely welcome!! thankyou.

1

There are 1 answers

0
stmfunk On

I tend to start out with a regular expression and work backwards. That usually helps you get into the correct mindset for the problem. From there it is relatively easy to build up the correct solution and compare the two. For more complicated problems you can use Thompson's Construction algorithm. Also to find the complement of an NFA simply swap the accepting states for the non accepting states.