7
COMPUTER GRAPHICS ANDIMAGE PROCESSING 14, 80--86 (1980) NOTE Parallel Y.-Erasing Array Acceptors* A~RA NAK~rURA Department of Applied Mathematics, Hiroshima University, Hiroshima 730, Japan Received August 29, 1979; accepted December 4, 1979 A parallel Y-erasing array acceptor (PY,-EAA) is introduced. It is proved that the class accepted by PX-EAA's is exactly the context-free array languages. 1. INTRODUCTION In [1], Rosenfeld introduced isotonic array grammars, and in [2] Cook and Wang presented a Chomsky hierarchy of isotonic array grammars and languages. Accep- tors for type 0 and type 1 array languages were given by Milgram and Rosenfeld [3] and an acceptor for type 3 array languages was given in [2]. But an acceptor for type 2 or context-free languages remains as an open problem. Cook and Wang's finite state array acceptors (FSAA's) for type 3 array lan- guages are considered as erasing array acceptors in the following sense: At each step, a FSAA C is in some state q scanning an input symbol a. In a given move, marks the scanned array symbol with ~ (the input symbol is erased by changing it to a symbol with g), changes state andmoves one square left (~), right (~), up (~d0, or down (@). An array ~r is accepted iff C, beginning in its initial state scanning some array cell, scans and marks each non-# cell of the ~r with g and ends in one of its final states. In this definition of acceptability, there is the problem that C itself never knows whether every non-~ cell is marked with ~. In this paper, we introduce a kind of erasing array acceptor similar to the one mentioned above, which acts in parallel and erases input symbols according to given rules. Further, the acceptor is able to traverse the area of input symbols after a cell falls into a special state. This ability is provided in order to avoid the above-mentioned problem. This automaton can be considered as a restricted cellular array acceptor; it is called a parallel Y.-erasing array acceptor (PE-EAA). The purpose of this paper is to solve the open problem concerning the context-free array languages proposed in [2]. We prove that the class accepted by PY~-EAA's is exactly the context-free array languages. A key idea in the proof is based on a definition of a nondeterministic PE-EAA such that it is able to retrace backward derivations in an isotonic context-free array grammar. In this paper, we assume that the reader is familiar with isotonic array grammars, languages, and their hierarchy given in [1, 2] and also with the fundamental definitions of cellular array acceptors such as those given in [4]. *This research was done while the author visited the Computer Science Center, University of Maryland, during July 1979. The support of the U.S. Air Force Office of Scientific Research under Grant AFOSR-77-3271 is gratefully acknowledged, as is the help of Kathryn Riley in preparing this paper. 80 0146-664X/80/090080-07502.00/0 Copyright © 1980 by Academic Press, Inc. All rights of reproduction in any form reserved.

Parallel Σ-erasing array acceptors

Embed Size (px)

Citation preview

Page 1: Parallel Σ-erasing array acceptors

COMPUTER GRAPHICS AND IMAGE PROCESSING 14, 80--86 (1980)

NOTE

Parallel Y.-Erasing Array Acceptors*

A~RA NAK~rURA

Department of Applied Mathematics, Hiroshima University, Hiroshima 730, Japan

Received August 29, 1979; accepted December 4, 1979

A parallel Y-erasing array acceptor (PY,-EAA) is introduced. It is proved that the class accepted by PX-EAA's is exactly the context-free array languages.

1. INTRODUCTION

In [1], Rosenfeld introduced isotonic array grammars, and in [2] Cook and Wang presented a Chomsky hierarchy of isotonic array grammars and languages. Accep- tors for type 0 and type 1 array languages were given by Milgram and Rosenfeld [3] and an acceptor for type 3 array languages was given in [2]. But an acceptor for type 2 or context-free languages remains as an open problem.

Cook and Wang's finite state array acceptors (FSAA's) for type 3 array lan- guages are considered as erasing array acceptors in the following sense: At each step, a FSAA C is in some state q scanning an input symbol a. In a given move, marks the scanned array symbol with ~ (the input symbol is erased by changing it to a symbol with g), changes state a n d m o v e s one square left (~), right ( ~ ) , up (~d0, or down (@). An array ~r is accepted iff C, beginning in its initial state scanning some array cell, scans and marks each n o n - # cell of the ~r with g and ends in one of its final states. In this definition of acceptability, there is the problem that C itself never knows whether every n o n - ~ cell is marked with ~.

In this paper, we introduce a kind of erasing array acceptor similar to the one mentioned above, which acts in parallel and erases input symbols according to given rules. Further, the acceptor is able to traverse the area of input symbols after a cell falls into a special state. This ability is provided in order to avoid the above-mentioned problem. This au tomaton can be considered as a restricted cellular array acceptor; it is called a parallel Y.-erasing array acceptor (PE-EAA).

The purpose of this paper is to solve the open problem concerning the context-free array languages proposed in [2]. We prove that the class accepted by PY~-EAA's is exactly the context-free array languages. A key idea in the proof is based on a definition of a nondeterministic PE-EAA such that it is able to retrace backward derivations in an isotonic context-free array grammar.

In this paper, we assume that the reader is familiar with isotonic array grammars, languages, and their hierarchy given in [1, 2] and also with the fundamental definitions of cellular array acceptors such as those given in [4].

*This research was done while the author visited the Computer Science Center, University of Maryland, during July 1979. The support of the U.S. Air Force Office of Scientific Research under Grant AFOSR-77-3271 is gratefully acknowledged, as is the help of Kathryn Riley in preparing this paper.

80 0146-664X/80/090080-07502.00/0 Copyright © 1980 by Academic Press, Inc. All rights of reproduction in any form reserved.

Page 2: Parallel Σ-erasing array acceptors

PARALLEL Z-ERASING ARRAY ACCEPTORS 81

2. DEFINITIONS

We first give some notations and definitions about parallel E-erasing array acceptors (PE-EAA's).

DEFINITION 2.1. A parallel E-erasing array acceptor (PY.-EAA) is a two- dimensional cellular acceptor (K, E, Q, Qr, S, 6) satisfying the following:

(i) K is a finite automaton;

(ii) E is a finite set of input states, Q is a finite set of noninput states, and Qr is a finite set of traversal states, such that E n Q -- ~ , y N QT -= ~J, Q n Qr = ~;

(iii) Q contains states of the form Ae, Aq~,A~, and Ae;

(iv) B E Q is a special "dead" blank state;

(v) S t, S E Q are the quasi-accepting state and accepting state, respectively, and S E Q is the "broken" state;

(vi) 6 is the transition function of K, which satisfies the conditions mentioned below, i.e.,

6: (Y u Q u Qr)5~ 2 (~UQUQ~).

An input ~r is given as a two-dimensional array of elements of Y. which is not always rectangular and is surrounded by the edge symbol -#.

DEFINITION 2.2. A PZ-EAA ~ accepts an input ~r iff repeated applications of transition function 6, starting from this ¢r, can lead to the accepting state S at some cell.

In this paper, we consider exclusively nondeterministic acceptors. In Definition 2.1, 6(X, Y,Z, U, V) ~ W means that one of the values of 6 over

is ~ .

That is, the first four arguments of 6 are occupied by the four neighbors in the indicated positions of the last argument. For intuitive understanding, 6(X, Y, Z, U, V) is sometimes denoted by

The transition function 6 is defined as a mapping satisfying the following:

(1) For arbitrary X, Y, Z, U E Y. U Q, 6(X, Y, Z, U,B) is always B. This means that ~ is the special dead blank state.

(2) 6(X, Y, Z, U,A) ~ A n, where H ~ (~, ~,a~L, o~), in cases not contradicting (5) and (6) below.

(3) For each H ~ (ff,6~,°'~L,°~), 6(X, Y,Z, U,A ~) is always B, in cases not contradicting (6) below.

Conditions (1) and (3) correspond to "erasing."

Page 3: Parallel Σ-erasing array acceptors

82 AKIRA NAKAMURA

(4) For each input state a, the first four arguments X, Y, Z, U o f 8(X, Y, Z, U, a) are dummy, and 6(X, Y, Z, U, a) goes to non-input states As.

(5) For each non-input state E,

{ ' l 8A E C

D ~

depends on E and D only. In the other cases, the situation is the same, i.e.,

A E C e D

depends on E and C,

,j 6 A ~ E C

D

depends on E and A only, and so on.

(6) In case of collision in (5), the automaton K goes into the broken state i.e.,

A E C e = S, 6 A ~ E ~ C ~ = if,

D ~ D

a n d so on.

(7) For the broken state if, 8(X, Y, Z, U, if) =

(8) For each non-input state E,

Y

takes a value different f rom E only when X = A ~, Y = B e, Z = C e, or U = D ~

for some A, B, C, D. (9) When a cell falls into the quasi-accepting state S t, 8 is defined to begin

sequential traversal behavior which covers the area of input array. The states in the set Q r are used for this traversal behavior.

(10) In the process of traversal behavior, a cell changes to the broken state when two states of Y~ U (Q - (/f)) are in the input area; otherwise it falls into the accepting state at the starting cell after finishing the traversal behavior.

As seen from the above conditions, the definition of 8 is rather complicated. For clarity, here we informally explain it.

Page 4: Parallel Σ-erasing array acceptors

P A R A L L E L E - E R A S I N G A R R A Y A C C E P T O R S 83

I I I I

L l ri 2 FIG. 1. A n input array ~r.

First, let us assume the following: A given g rammar has the starting symbol S which does not appear in the later derivations. This assumption is always possible by adding a new starting symbol S ' and a new rewriting rule S ' ~ S to the given g rammar G, where S is the old starting symbol of G.

8 is based on a definition of a nondeterministic PE-EA_A d~ such that (i) the sequence of computat ional configurations of d~ corresponds to the sequence of derivations in a given isotonic context-free array grammar, (ii) a given input array is derived from the only starting nonterminal S of the grammar. (Each n o n - # cell of the input array ~r is erased and d~ ends in its accepting state.) The details of the definition of 8 satisfying (9) are as usual (for example, see Section 4.4.1 in [4]), and so is not given here. Further, the meaning of (10) is given in Fig. 1.

Let us assume that an input array ~r is as shown in Fig. 1. Also, let rr I and ~r 2 in Fig. 1 be two parts of this input array such that ~r I is obtained f rom a given isotonic context-free g rammar G = ( N , T, # , P , S ) . Then there is a cell in ~r I whose state always falls into S t under repeated applications of (1)-(8) of 8. (See Fig. 2.) At the same time, there is a cell in er 2 whose state is in Y~ tA (Q - {B, S t } ) (if ~r 2 is not generated by the g rammar G) or S t (if rr 2 is generated by the g rammar G.) Thus, in the process of the traversal behavior on the input array rr, ~ always falls into the broken state at some cell and so it never falls into the accepting state S. Condit ion (10) is set up in order that the PY~-EAA d~ can know whether every n o n - # cell of input array 7r is erased. 8 satisfying (10) is defined as follows:

When PE-EAA ~ falls into the state S t at some cell, then (~ acts sequentially. K begins the spiral traversal f rom this St-cell which is defined in Proposition 4.4.1 of [4]. (Note that K may enter the ~'s.) If ~r 2 is not generated by the g rammar G, there is a cell in 71.2 whose state is in Y. U (Q - (/¢, St)). Thus, we define 8 such that K falls into the broken state when K reads a state of E U (Q - (B, S t ) ) in the traversal behavior. Further, if there are two (or more) S t ' s in the area of ~r, 8 is defined in such a way that K falls into the broken state. This is possible because in this case two spirals come into collision at some cell. Finally, for a legal input array d~ falls into the accepting state S at the cell in which (~ was in the quasi-accepting state S t .

[_ 1 I__

FIGURE2

Page 5: Parallel Σ-erasing array acceptors

84 AKIRA NAKAMURA

3. MAIN THEOREM

We prove that the class accepted by PZ-EAA's is exactly the isotonic context-free array languages. Let G be an isotonic context-free array grammar. L ( G ) represents the language generated by this grammar. Also, let C be a PE-EAA. L ( C ) means the set accepted by tl~is acceptor C.

LEMMA 3.1. Any context-free array language is accepted by a PZ-EAA.

Proof. L e t G b e a t y p e 2 g r a m m a r G = ( N , T , # i P , S) a n d l e t C b e a P ~ , - E A A . We prove that V G 3 C ( L ( G ) = L(C)) .

Any isotonic context-free array language (ICFAL) is generated by the following normal form of rewriting [2]:

# --~C' A __B -#A --~ BC, A # --) BC, A # C ' A ---) a.

Therefore, an array generated by the normal form is accepted by a PZ-EAA d~ which retraces backward rewriting rules. That is, 8 of K of this PZ-EAA d~ is defined as follows:

8 ( , . , .... a) ~ A

8 [ . B C ~ ] ~ A

8 . C • ~ A

8( . . . . . . . . . ) = g

iff A ~ a is in P,

i f f A # ~ BCis i n P ,

iff # A ---> BCis i nP ,

iff A B is in P, # - ~ C

iff # ~ B is in P, A C

otherwise.

In this definition, if a symbol A in the production is S, then the corresponding A of 8 is S t. It is seen that A over an input array ends in the accepting state S at some cell iff the input is generated by G. This is shown as follows: The input array ~r generated by G does not contain any other array such as w 2 in Fig. 1. Thus, K d o es not fall into the broken state S in a nondeterministic choice and so K always changes to the accepting state S at some cell from which K began the traversal behavior. Further, it is obvious that (~ always falls into the broken state for an illegal input array ~r. [ ]

LEMMA 3.2. The set accepted by a PE-EAA is a context-free array language.

Proof The proof is similar to that of Lemma 3.1. We prove that V ~ 3 G ( L ( G ) = L((~)). We define an isotonic context-free array grammar G = (N, T, # , P , S )

Page 6: Parallel Σ-erasing array acceptors

PARALLEL Z-ERASING ARRAY ACCEPTORS 85

from the given PZ-EAA ~ as follows:

A ---~a iff6( ..... , .,a) ~ A,

A # --~ B C

# A --> B C i f fS[B ~ C "1 s A ,

A#__>Bc iff~[" CmB "] ~ A ,

I ] # --~ B iff8 ~ A, A C • C •

S--~ S t.

For the other cases of 6, the corresponding rewriting rules are not given. It is known that an input array is generated by this isotonic context-free array grammar iff it is accepted by ~. This is shown as follows: When K falls into the accepting state S at some cell, the given input array does not contain any superfluous array such as ~r 2 in Fig. 1. Thus, the input array is generated by the above grammar. Also, it is easily shown that an array generated by this grammar is acceptable by ~. []

THEOREM 3.3. The class accepted by PE-EAA's is exactly the isotonic context- free array languages.

Proof This is obtained from Lemmas 3.1 and 3.2. []

4. REMARK

In this note, we have considered parallel Z-erasing array acceptors for the isotonic context-free array languages. We could also define sequential acceptors which simulate PZ-EAA's; but it seems that these acceptors are somewhat more complicated. Furthermore, by making use of conditions (9) and (10) of 8 in this paper it is possible to define array acceptors for the type 3 array languages, which know that every non-# cell is marked with g.

ACKNOWLEDGMENTS

The author would like to thank Professor Azriel Rosenfeld for arranging a very enjoyable four-week stay at the Computer Science Center, University of Maryland, July 1979, and for valuable comments. The author also thanks Dr. T. Ae of Hiroshima University and Professor P. S. P. Wang of the University of Oregon for their useful comments.

Page 7: Parallel Σ-erasing array acceptors

86 AKIRA NAKAMURA

REFERENCES

1. A. Rosenfeld, Isotonic grammars, parallel grammars and picture grammars, in Machine Intelh'gence (D. Michie and B. Meltzer, Eds.), Vol. 6, pp. 281-294, Univ. of Edinburgh Press, Edinburgh, Scotland, 1971.

2. C. R. Cook and P. S. Wang, A Chomsky hierarchy of isotonic array grammars and languages, Computer Graphics and Image Processing 8, 1978, 144-152.

3. D. L. Milgram and A. Rosenfeld, Array automata and array grammars, Proc. IFIP Congress, 71, booklet TAo2, pp. 166-173, North-Holland, Amsterdam, 1971.

4. A. Rosenfeld, Picture Languages, Academic Press, New York, 1979.