943,865 Members | Top Members by Rank

Ad:
Jun 28th, 2007
0

create non deterministic finite automaton

Expand Post »
Hi there. I must create a NDFA which accepts the language ((0*|1)(1*0))*. The problem is i've done only few exercises about NDFA and i'm confused.
Does this language means that: 0*1*0 or 11*0 -> many times?

Do you know if this one is fine??
[img=http://img245.imageshack.us/img245/5189/helper2.th.jpg]

It's too difficult for me to find any resources and even a similar problem. Any help appreciated!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kantze is offline Offline
9 posts
since Feb 2007
Jun 29th, 2007
1

Re: create non deterministic finite automaton

Try a textbook on the theory of computation. They explain these quite clearly.

As for your first question, the answer is yes (from what I remember).

As for your second question, the answer is no, yours is not fine. In particular, the string 1 would pass your NFA, while it wouldn't pass the above language since every non-empty string in that language ends with 0.

Edit: Er, what was I thinking.

To make an NFA, note that essentially each node in the NFA corresponds to a point in between characters (the 0s and 1s) in the regular expression string. * corresponds to a lambda connection pointing back to the beginning of whatever it's starring (and at the beginning you have a choice of entering the subexpression or moving on) and | corresponds to a pair of lamba connections pointing to two different starting points.
Last edited by Rashakil Fol; Jun 29th, 2007 at 11:17 am.
Team Colleague
Reputation Points: 1135
Solved Threads: 171
Super Senior Demiposter
Rashakil Fol is offline Offline
2,478 posts
since Jun 2005
Nov 3rd, 2008
0

Re: create non deterministic finite automaton

Hi,

I am Varun Gupta, a student at San jose State university and am working on finite automata.
I am totally new to the concept of finite automata.
Can anybody please provide me with a code in C or C++ or may b JAVA, that converts regular expression into finite automata?

That would be of a great help to me or if anyone can please give me a link for the same?

Thanks,
Varun
Reputation Points: 10
Solved Threads: 0
Newbie Poster
varungupta is offline Offline
1 posts
since Nov 2008
Nov 21st, 2008
-2

Re: create non deterministic finite automaton

i give u a DFA that accepts (a/b)*abb in 'C' .
i think this will helpfull to u.....(Varun Gupta.)

/*
To Check Whether Input String form DFA for (a/b)*abb */
#include<conio.h>
#include<stdio.h>
void main()
{
int i,state=1,n,len;
char a[21];
clrscr();
printf("Enter string to check DFA with Max 20 character \n");
scanf("%s",&a);
len=strlen(a);
if(len>20)
{
printf("Limit Exeeded");
getch();
exit(0);
}
a[len+1]=NULL;
for(i=0;i<len;i++)
{
if(a[i]>98 || a[i] <97)
{
printf("Not Valid");
getch();
exit(0);
}
}
i=0;
while(a[i]!=NULL)
{
if(a[i]=='a' && (state==1 || state==2 || state==3 || state==4))
state=2;
else if(a[i]=='b' && (state==1 || state==4))
state=1;
else if(a[i]=='b' && state==2)
state=3;
else if(a[i]=='b' && state==3)
state=4;
else if(a[i]==NULL && state==4)
state=4;
i=i+1;
}
if(state==4)
printf("Input string Form DFA for (a/b)*abb");
else
printf("Input string NOT Form DFA for (a/b)*abb");

getch();
}
Reputation Points: 6
Solved Threads: 2
Newbie Poster
pushkar honey is offline Offline
13 posts
since Feb 2008
Nov 21st, 2008
0

Re: create non deterministic finite automaton

Click to Expand / Collapse  Quote originally posted by varungupta ...
Hi,

I am Varun Gupta, a student at San jose State university and am working on finite automata.
I am totally new to the concept of finite automata.
Can anybody please provide me with a code in C or C++ or may b JAVA, that converts regular expression into finite automata?

That would be of a great help to me or if anyone can please give me a link for the same?

Thanks,
Varun
It shouldn't be too hard, there is an algorithm to do it in "Introduction to Computation" by Michael Sipser in chapter 1. It gives you a step-by-step process which seemed simple enough for me since you have the closure properties all the operators proven by construction.

For instance, the op's problem ((0*1*0)U(11*0))* can be tackled by taking into account the order of operations. We start by building NFA for empty string (sometimes called lambda or epsilon), then we build NFA for accepting single characters '0' and '1'.
Next, we use the proof of closure-property of * operator to build 0* and 1*.
Afterwards, we build two new NFA's

One, were we concatenate 0* with 1* with '0'. Using the epsilon-transitions are helpful in this matter.

The other NFA is done in a similar fashion, where we connect the NFA which accepts a single '1' with 1* using the epsilon-transition, then with the NFA which accepts a single '0' as well.

Then, using the closure-property of union, we unite 0*1*0 with 11*0. Again, epsilon-transitions make this much easier for us.

Finally, we add a new start state (as apart of the algorithm for making NFA's which mimicks * operator listed in the closure property of * operator) that only sends you to the last NFA but doesn't receive any incoming transitions from any other state.

Have the last states in both 0*1*0 and 11*0 connect with epsilon-transitions to the old start state of the prior NFA (where we united the two subproblems).

For someone like myself, I'd have an easier time reading something written in English how to make automata from regular expressions than by using code. I think most people are the same way, but for some programming is better.
Reputation Points: 10
Solved Threads: 0
Light Poster
michinobu_zoned is offline Offline
44 posts
since May 2008
Nov 21st, 2008
0

Re: create non deterministic finite automaton

Click to Expand / Collapse  Quote originally posted by varungupta ...
Hi,

I am Varun Gupta, a student at San jose State university and am working on finite automata.
I am totally new to the concept of finite automata.
Can anybody please provide me with a code in C or C++ or may b JAVA, that converts regular expression into finite automata?

That would be of a great help to me or if anyone can please give me a link for the same?

Thanks,
Varun
It shouldn't be too hard, there is an algorithm to do it in "Introduction to Computation" by Michael Sipser in chapter 1. It gives you a step-by-step process which seemed simple enough for me since you have the closure properties all the operators proven by construction.

For instance, the op's problem ((0*1*0)U(11*0))* can be tackled by taking into account the order of operations. We start by building NFA for empty string (sometimes called lambda or epsilon), then we build NFA for accepting single characters '0' and '1'.
Next, we use the proof of closure-property of * operator to build 0* and 1*.
Afterwards, we build two new NFA's

One, were we concatenate 0* with 1* with '0'. Using the epsilon-transitions are helpful in this matter.

The other NFA is done in a similar fashion, where we connect the NFA which accepts a single '1' with 1* using the epsilon-transition, then with the NFA which accepts a single '0' as well.

Then, using the closure-property of union, we unite 0*1*0 with 11*0. Again, epsilon-transitions make this much easier for us.

Finally, we add a new start state (as apart of the algorithm for making NFA's which mimicks * operator listed in the closure property of * operator) that only sends you to the last NFA but doesn't receive any incoming transitions from any other state.

Have the last states in both 0*1*0 and 11*0 connect with epsilon-transitions to the old start state of the prior NFA (where we united the two subproblems).

to OP: I would post the answer for you, but I don't have a means to do it nor the time. I think it's best for you to list an aim-account or ask for it to be sent over e-mail so I could send you a copy of that answer. However, probably - by now - you're already way past this so any help concerning this is unnecessary as you're likely working on Turin Machines now. --Good Luck

To Varun: For someone like myself, I'd have an easier time reading something written in English how to make automata from regular expressions than by using code. I think most people are the same way, but for some programming is better.
Reputation Points: 10
Solved Threads: 0
Light Poster
michinobu_zoned is offline Offline
44 posts
since May 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.
Previous Thread in Computer Science Forum Timeline: Need Help with Scenario on Modellling Methods for Developing a Computer Program
Next Thread in Computer Science Forum Timeline: Find something wrong on a Theorem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC