home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!Germany.EU.net!tools!tl
- From: tl@tools.de (Thomas Lewerenz)
- Newsgroups: comp.theory
- Subject: Re: cute problem regarding finite automata
- Date: 05 Sep 92 14:43:52 GMT
- Organization: TooLs GmbH, Bonn, Germany
- Lines: 35
- Distribution: inet
- Message-ID: <TL.92Sep5154353@fred.tools.de>
- References: <40853@gremlin.nrtc.northrop.com>
- NNTP-Posting-Host: fred.tools.de
- In-reply-to: johnson@nrtc.northrop.com's message of 4 Sep 92 18:04:00 GMT
-
- In article <40853@gremlin.nrtc.northrop.com> johnson@nrtc.northrop.com (Greg Johnson) writes:
- > Here is a cute problem, perhaps suitable as an exam question.
- > I offer it to all beleaguered professors trying to think up comp
- > questions! ;-)
- >
- > Define a rotation of a string A as follows: divide A into substrings A1 and
- > A2 such that A1 A2 equals A; A2 A1 is a rotation of A.
- >
- > For the string `abcd', the rotations are abcd, dabc, cdab, bcda.
- >
- > Now let L be a regular language, and let Rotate(L) be the language consisting
- > of all rotations of strings from L. Is Rotate(L) regular? Give proof
- > or counter-example.
- >
- > - Greg Johnson
- > johnson@nrtc.northrop.com
-
- I'm not beleaguered nor am I a professor, but here it is:
-
- Let L be a regular language and M be a deterministic finite automaton
- accepting L. Let M' be a nondeterministic finite automaton with
- eps-moves which behaves as follows:
- On input x M' first guesses nondeterministically any of the states of M, say A,
- and memorizes it in its finite control. Then it simulates M on input x starting
- at state A. Whenever the simulation reaches one of the final states of M, M'
- chooses nondeterministically to go on or make an eps-move to the starting state
- of M. M' accepts x iff it reaches A on the end of input and has made exactly one
- eps-move from a final to the starting state of M during the simulation.
- (A more formal description of M' is left to some clever examinee ;-))
- Clearly M' accepts x iff x \in Rotate(L) and therefore Rotate(L) is
- regular.
- q.e.d.
-
- --
- Thomas Lewerenz, tl@fred.tools.de
-