Newsgroups: comp.lang.scheme.scsh,comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!newstand.syr.edu!news.maxwell.syr.edu!news.bbnplanet.com!cpk-news-hub1.bbnplanet.com!worldnet.att.net!cbgw2.lucent.com!nntphub.cb.lucent.com!alice!allegra!akalice!baldy.research.att.com!user
From: pereira@research.att.com (Fernando Pereira)
Subject: Re: Regexp notation
X-Nntp-Posting-Host: baldy.research.att.com
Message-ID: <pereira-1301972148130001@baldy.research.att.com>
Sender: news@research.att.com (netnews <9149-80593> 0112740)
Organization: AT&T Research
References: <qijg20caw6l.fsf@lambda.ai.mit.edu> <qijd8vebe9x.fsf@lambda.ai.mit.edu> <5b4kgn$b8h@news.jf.intel.com> <qijbuaxbn7l.fsf@lambda.ai.mit.edu> <5b5vii$9or@news.jf.intel.com>
Date: Tue, 14 Jan 1997 01:48:13 GMT
Lines: 22
Xref: glinda.oz.cs.cmu.edu comp.lang.scheme.scsh:374 comp.lang.scheme:17930

In article <5b5vii$9or@news.jf.intel.com>, haertel@ichips.intel.com (Mike
Haertel) wrote:
> Actually intersection is cross products of DFA's.  This clearly
> works.  Taking a cross product of NFA's is a bit nebulous
> because of e-transitions.
There's a straightforward way of doing this: let A and B be the two NFAs,
s a state in A, t a state in B, s -> eps -> s'. Then there should be an
eps transition from (s,t) to (s',t) in A x B; similarly for eps
transitions in B. It's straightforward to show that this is correct in
terms of the languages accepted. However, it has the problem that it does
not preserve the *multiplicity* of strings: if s is accepted by m
different paths in A and by n different paths in B, it may be accepted by
more than m * n different paths in
A x B. There is a way of avoiding this with a somewhat subtler
construction, but that would take us too far afield (for the curious, the
construction is described in <http://xxx.lanl.gov/ps/cmp-lg/9603001>).
> You could build NFA's without
> e-transitions, I think cross products of those would work as
> well.  A DFA is O(2**n), and an NFA without e-transitions is
> O(n^2).  So you may be talking at least O(n**4) complexity for
> intersections.
It follows from the above that intersection is O(|A|*|B|) for general NFAs.
