• Aucun résultat trouvé

Recognitions of figures with two-dimensional cellular automata.

N/A
N/A
Protected

Academic year: 2021

Partager "Recognitions of figures with two-dimensional cellular automata."

Copied!
88
0
0

Texte intégral

(1)

HAL Id: hal-02102119

https://hal-lara.archives-ouvertes.fr/hal-02102119 Submitted on 17 Apr 2019

HAL is a multi-disciplinary open access

archive for the deposit and dissemination of sci-entific research documents, whether they are pub-lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

automata.

Laure Tougne

To cite this version:

Laure Tougne. Recognitions of figures with two-dimensional cellular automata.. [Research Report] LIP RR-1994-39, Laboratoire de l’informatique du parallélisme. 1995, 2+85pp. �hal-02102119�

(2)

Recognition of gures with

two-dimensional cellular automata

Laure Tougne

December 1994

Research Report No 94-39

Ecole Normale Supérieure de Lyon

Adresse électronique : lip@lip.ens−lyon.fr

Téléphone : (+33) 72.72.80.00 Télécopieur : (+33) 72.72.80.80 46 Allée d’Italie, 69364 Lyon Cedex 07, France

(3)

cellular automata

Laure Tougne

December 1994

Abstract

We consider a family of gures of the discrete plane (rectangles, squares, ellipses,...) how shall we decide with a 2D cellular automaton whether a given gure belongs to the family or not?

We essentially give three kinds of results. First, we look for a parallel way of de ning the family. For example, a rectangle is a connected gure without hole such that all cells that are in the border have exactly two neighbors in the border. We show that this de nition is equivalent to the classical one and give a cellular automaton which recognizes the rectangles' family in an optimal time. Secondly, the gures are de ned with the help of an algorithm which can be easily parallelized. A natural and meaningful example is the ellipses' recognition. An ellipse is a gure with two distinguished cells (the focuses) it is composed of all the cells the sum of distances to the two focus of which is less then a constant k (for the normkk1 or kk1). In this case, the algorithm of recognition

is the following one: a signal, generated by one of the focuses, spreads with an optimal speed in all the possible directions, and it is reected back by the border of the pattern. The gure is an ellipse if and only if all these signals are resorbed on the other focus.

Finally, we present an other algorithm inspired by a synchronization algorithm due to F. Grasselli. in order to recognize the squares' family.

Keywords:

2D cellular automata, recognition, family of gures, synchroniza-tion

Resume

Nous consid erons une famille de gures du plan discret (rectangles, carr es, ellipses,...) comment d ecider a l'aide d'un automate cellulaire plan, si une gure donn ee appartient a la famille? Nous donnons essentiellement trois types de r esultats. Premi erement, nous cherchons un mode de d e nition de la famille de gures qui soit parall ele. Par exemple, un rectangle est une gure connexe sans trou telle que toute case du bord a exactement deux voisines dans le bord. Nous montrons que cette d e nition est equivalente a la d e nition classique du rectangle et exhibons un automate cellulaire reconnaissant la famille des rectangles en temps optimal.

Deuxi emement, les gures sont d e nies par un algorithme facilement parall elisable et, un exemple naturel et tr es d emonstratif est la reconnaissance des ellipses. Une ellipse est une gure avec deux cases distingu ees (les foyers), form ee de toutes les cases dont la somme des distances aux deux foyers (pour la normekk1orkk1) est inf erieure

a une constante k. Dans ce cas, l'algorithme de reconnaissance est le suivant: un signal engendr e par un des deux foyers se di use a vitesses maximale dans toutes les directions du plan, puis est r e echi par le bord de la gure. La gure est une ellipse si et seulement si tous ces signaux se r esorbent sur l'autre foyer.

Pour nir, nous pr esentons un algorithme inspir e d'un algorithme de synchronisation de F. Grasselli pour recon-na^tre la famille des carr es.

Mots-cles:

Automates cellulaires plans, reconnaissance, famille de gures, synchronisation

(4)

1 Introduction.

2

2 Basic notions.

5

2.1 Cellular automata : : : : : : : : : : : : : : : : : : : : : : : : : : 5 2.2 Neighborhoods : : : : : : : : : : : : : : : : : : : : : : : : : : : : 6 2.3 Figures : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 7 2.4 Recognition of gures : : : : : : : : : : : : : : : : : : : : : : : : 9

3 Recognition of rectangles.

11

3.1 Denition of a rectangle. : : : : : : : : : : : : : : : : : : : : : : : 11 3.2 Demonstration. : : : : : : : : : : : : : : : : : : : : : : : : : : : : 12

3.2.1 The Jordan's lemma forZ

2. : : : : : : : : : : : : : : : : : 13

3.2.2 Construction of a sequence which describes of the border of F : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 14 3.2.3 Study of the path. : : : : : : : : : : : : : : : : : : : : : : 22 3.2.4 Characterization of F. : : : : : : : : : : : : : : : : : : : : 26 3.3 An automaton which recognizes the rectangles. : : : : : : : : : : 27 3.4 Conclusion. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 29

4 Recognition of squares.

31

4.1 Introduction. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 31 4.2 Denition of the square. : : : : : : : : : : : : : : : : : : : : : : : 31 4.3 Demonstration. : : : : : : : : : : : : : : : : : : : : : : : : : : : : 33 4.4 An automaton which recognizes the squares. : : : : : : : : : : : : 35 4.5 Conclusion. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 38

5 Recognition of patterns which are built with rectangles.

39

5.1 Denitions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 39 5.1.1 Coming out and retracting vertices : : : : : : : : : : : : : 39 5.2 Recognition of \L". : : : : : : : : : : : : : : : : : : : : : : : : : : 40 5.2.1 Denition of the L family. : : : : : : : : : : : : : : : : : : 40 5.2.2 Automaton which recognizes L. : : : : : : : : : : : : : : : 41

(5)

5.2.3 Automaton which recognizes the "L" family using cells that are outside the gure. : : : : : : : : : : : : : : : : : 43 5.3 Recognition of \U". : : : : : : : : : : : : : : : : : : : : : : : : : 43 5.3.1 Denition of the U family. : : : : : : : : : : : : : : : : : : 43 5.3.2 Automaton which recognizes the "U". : : : : : : : : : : : 44 5.3.3 Automaton which recognizes the U family using cells that

are outside the gure. : : : : : : : : : : : : : : : : : : : : 46 5.4 Recognition of \O". : : : : : : : : : : : : : : : : : : : : : : : : : 46 5.4.1 Denition of the O family. : : : : : : : : : : : : : : : : : : 46 5.4.2 Automaton which recognizes the "O". : : : : : : : : : : : 47 5.5 Recognition of "T". : : : : : : : : : : : : : : : : : : : : : : : : : 47 5.5.1 Denition of the "T" family: T. : : : : : : : : : : : : : : 48 5.5.2 Automaton which recognizes the "T". : : : : : : : : : : : 49 5.6 Generalization. : : : : : : : : : : : : : : : : : : : : : : : : : : : : 49 5.6.1 Encoding of a gure : : : : : : : : : : : : : : : : : : : : : 49 5.6.2 A more general family of gure : : : : : : : : : : : : : : : 50 5.7 Conclusion : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 51

6 Recognition of ellipses.

52

6.1 Introduction. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 52 6.2 An automaton which recognizes the 4;ellipses. : : : : : : : : : 54

6.3 Demonstration. : : : : : : : : : : : : : : : : : : : : : : : : : : : : 54 6.4 Particular cases. : : : : : : : : : : : : : : : : : : : : : : : : : : : 57 6.4.1 Case where the focuses are merged. : : : : : : : : : : : : : 57 6.4.2 Case of the isoceles triangle. : : : : : : : : : : : : : : : : : 58 6.5 8;ellipses. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 59 6.6 conclusion : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 59

7 Conclusions.

61

7.1 Extensions. : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 61 7.1.1 Other gures. : : : : : : : : : : : : : : : : : : : : : : : : : 61 7.1.2 Properties. : : : : : : : : : : : : : : : : : : : : : : : : : : 65 7.1.3 Implementation. : : : : : : : : : : : : : : : : : : : : : : : 65 7.2 Link with the Firing Squad problem. : : : : : : : : : : : : : : : : 66 7.2.1 The Firing Squad problem. : : : : : : : : : : : : : : : : : 66 7.2.2 Solutions that are proposed by Szwerinski. : : : : : : : : : 67 7.2.3 Questions. : : : : : : : : : : : : : : : : : : : : : : : : : : : 71

(6)

Introduction.

Cellular automata (in short CA) were introduced by J.von Neumann vN67] in the beginning of the sixties, according to S. Ulam's ideas, as a model of self reproduction.

Cellular automata are nite automata which are regularly connected each other. They can be considered as dynamic systems. In its general historical form, a cellular automaton of dimension d is an innite set of identical elementary nite machines (called cells, which are indexed by Zd). A cell is a nite automaton

which evolves according to some receiving information and according to its past state which it keeps in memory (it has only a nite number of states). Thus, at the initial moment, all cells are in a given state and the system evolves as follows:

 Synchronously: The new time is obtained when all cells have changed

their state.

 Uniformly: The new state of a cell depends on the states of other cells

which depend themselves on other cells that in the same way for all com-ponents of the network.

 Locally: The new state of a cell depends only on a nite number of cells

which are in a bounded neighborhood.

Cellular automata have been studied as languages' recognizers and, more re-cently as functions' computers. One of their application is the study of massively parallel algorithms in order to spread and to synchronize local information. In the following discussion, we developp a new utilization of cellular automata: we want to recognize families of gures with 2D cellular automata. As far as I know, no paper has previously been published about this subject.

This report contains dierent families of gures we tried to recognize. This families are grouped in two parts.

In the rst part, we search for the "most locally possible" denition of the gure. 3

(7)

The main example is the rectangle's family: a rectangle is a discrete connected gure, without hole which has exactly four vertexes or, a connected gure, with-out hole, all border cells of which have two border cells in their neighborhood. So, considering a connected gure which has no hole, the examination of the borders is sucient to determine if the gure is a rectangle or not. Likewise concerning the square: it's a rectangle which has a symmetry property, which is detected at the heart of the square.

In this part, are also some families of gures such as the "L's family", the "U's family", the "O's family"... These families are globally dened. In this case, we count the number of retracting vertices the gure has in order to recognize it. In the second part, we have gures which bring into play waves evolving on the plane. For example, we have the ellipses' family: an ellipse is a gure with two distinguished cells (the focuses) it is composed of all the cells the sum of distances to the two focus of which is less then a constant k. In order to recog-nize this family of gures, we utilize a two dimensional signal which spread as a one-dimensional one. On a line, a wave spreads like that: at each top, each reached cell communicates the information to its not reached neighborhood, if it has one (see the gure 1.1). On the plane, it is a wave which seems to be a

t=0

t=2 t=1

t=3

Starting point

Figure 1.1: Propagation of a one-dimensional wave.

volume in the space-time diagram (it's a three-dimensional diagram). Thus, a signal which has the quickest speed appears as a pyramid, if the neighborhood is the Von Neumann's one (see gure 1.2). The wave form depends on neigh-borhood. We can dene a line in terms of wave: "A wave which starts from a focus, disappears on the other focus".

(8)

y

x Time

Starting point of the wave.

(9)

Basic notions.

Our goal is to recognize families of gures with plane cellular automata. In this section, we dene notions which are useful to understand the rest.

2.1 Cellular automata

De nition 1 (Cellular automata)

A

two-dimensional cellular automaton

, A, is a 4-tuple (dSH) such

that:

 d = 2, is called the dimension,

 S is a nite set, the elements of which are called the states and denoted

by:

S =fsk k2f0:::jSj;1gg,  H is a nite set of Z

2, called the neighborhood and denoted by:

H =fvj=fs 1jx2j

gj2f1:::jHjgg,   is a function fromS

jHj toS, called the local transition function.

The cellular automata we consider are two-dimensional ones: we put in each point ofZ

2, calledcell, the same nite automaton.

Let A be a cellular automaton.

De nition 2 (Con guration of a cellular automaton)

A

conguration

CAof A is an application fromZ

2toS. A congurationC

A evolves to another conguration CA dened by:

8(xy)2Z 2,C

A(xy) = (CA(x + x11y + x21):::CA(x + x1jHjy + x2jHj)).

We denote this evolution by CA`CA and we call it the global function ofA.

(10)

congurations CTAt2Ndened by8t2N,CtA`CAt .

A cell enters a new state according to its state and the states of its adjacent cells in which we apply .

2.2 Neighborhoods

Let H be the considered neighborhood.

De nition 3 (Von Neumann's neighborhood)

Let(xy)2Z

2 the Von Neumann's neighborhood of the cell(xy) is the set of

cells, denoted by H4(xy), such that: H4(xy) =

f(x + 1y)(x;1y)(xy; 1)(xy + 1)g. We put H1 4(xy) = (xy ;1), H 2 4(xy) = (x ;1y),H 3

4(xy) = (xy + 1) and

H4 4(xy) = (x + 1y): See gure 2.1. H (c)14 H (c)2 4 H (c)34 H (c)4 4 (x,y+1) (x-1,y) (x+1,y) (x,y-1) i j c(i,j)

Figure 2.1: Von Neumann's neighborhood.

De nition 4 (Moore's neighborhood)

Let (xy) 2 Z

2 the Moore's neighborhood of the cell (xy) is the set of cells,

denoted byH8(xy), such that: H8(xy) =

f(x+1y)(x;1y)(xy;1)(xy+

1)(x + 1y + 1)(x + 1y;1)(x;1y + 1)(x;1y;1)g.

We put H1 8(xy) = (xy ;1),H 2 8(xy) = (x ;1y;1),H 3 8(xy) = (x ;1y), H4 8(xy) = (x ;1y + 1), H 5 8(xy) = (xy + 1), H 6 8(xy) = (x + 1y + 1), H7

8(xy) = (x + 1y) and H 8

8(x + 1y ;1).

See gure 2.2.

Let us notice that the cells which are in the Von Neumann's neighborhood of the cell (xy) are the cells which are one distance unit away from the cell (xy) where the distance is d4,

(11)

H (c)1 8 H (c)2 8 H (c)3 8 H (c)4 8 H (c) 5 8 H (c) 6 8 H (c)7 8 H (c)8 8 (x,y+1) (x-1,y) (x+1,y) (x+1,y+1) (x+1,y-1) (x-1,x-1) (x-1,y+1) (x,y-1) i j c(i,j)

Figure 2.2: Moore's neighborhood. d4(PQ) =

jiP;iQj+jjP;jQj

This distance is calledCity Block Distance(or Square Distance). In the Moore's case, the distance is d8,

d8(PQ) = max(

jiP;iQjjjP;jQj)

This distance is calledChessboard Distance(or Diamond Distance).

2.3 Figures

We consider the discrete planeZ 2.

De nition 5 (Figure)

We call gure, denoted by F, any nite subset ofZ 2.

De nition 6 (4-connected path)

A 4-connected path is any sequence of points of Z 2, (x 0y0)(x1y1):::(xlyl) such that8i2f0:::l;1g(xi +1= xi+ 1and yi+1 = yi)or (xi+1= xi ;1and yi+1= yi)or(xi+1= xi and yi+1= yi+ 1)or(xi+1= xi and yi+1= yi ;1).

De nition 7 (8-connected path)

A 8-connected path is any sequence of points of Z 2, (x 0y0)(x1y1):::(xlyl) such that8i2f0:::l;1g(xi +1= xi+ 1and yi+1 = yi)or (xi+1= xi ;1and yi+1 = yi)or (xi+1= xi and yi+1 = yi+ 1) or (xi+1 = xi and yi+1 = yi ;1) or (xi+1 = xi+ 1 and yi+1 = yi+ 1) or (xi+1 = xi ;1 and yi +1 = yi ;1) or (xi+1= xi+ 1and yi+1= yi ;1) or(xi +1= xi ;1and yi +1 = yi+ 1).

De nition 8 (Connected gure)

(12)

path which connects c to c'.

The gure 2.3 shows examples of 4 and 8-connected paths and 4 and 8-connected gures.

Every gure we consider here are 4-connected or 8-connected.

4-connected path 8-connected path

4-connected figure 8-connected figure

Figure 2.3: 4-connected and 8-connected paths, 4-connected and 8-connected gures.

De nition 9 (Figure without hole)

A gure F is without hole ford4 (respectivelyd8) if and only if F(the

comple-ment of F in Z

2) is 4-connected (respectively 8-connected).

De nition 10 (The external layer of a gure)

We dene the external layer of the gure F, denoted by Lext(F), as follows:

Lext(F) =f(xy)2F9x

0,y0 with ((x'=x+1 and y'=y) or (x'=x-1 and y'=y)

or (x'=x and y'=y+1) or (x'=x and y'=y-1)), (x',y')2=F.g

Lext(F) is the set of cells that are on the border of F, that is to say the cells

that have at least one cell in their neighborhood which is not in the gure F (see gure 2.4).

L (F)ext

Figure 2.4: The external layer, Lext(F), of the gure F.

De nition 11 (Vertices of a gure)

Letv2F, we say thatv is a vertex of

F if and only if there existsc1 and c2 (c1

6

= c2) inH(v) such that c1 = 2F and

c2 = 2F

(13)

See gure 2.5.

vertices

Figure 2.5: Vertices of a gure.

2.4 Recognition of gures

De nition 12 (The state of a cell)

Letstate(ct)be the state of the cellc at timet.

Initially,8c2F, state(c0) = 1 and8c =2P, state(c0) = 0. The cells which

belong to F are in state 1 and the others are in state 0.

The state of the cell (ij), at time (t+1), is completely determined by the state of (ij) and the states of the adjacent cells at time t.

De nition 13 (Recognition of gures)

We have two notions of recognition:

 The local recognition: one cell of the gure enters an accepting state or a

rejection state.

 The global recognition: all the cells of the gure enter the same state:

acceptance state or rejection state.

De nition 14 (Family which is recognisable with 2-dimensional cellular automata)

We say that a family of gures, denoted by F, is recognizable with 2D

cellu-lar automata if and only if there exists a cellucellu-lar automaton A such that for every gure F on the plane there is a timet such that,

At(F) = aeverywhere in F (a=acceptance state). Otherwise,At(F) = reverywhere in F (r=rejection state).

That is to say there is an automaton which accepts all the gures ofF and

(14)

We denote rtime(PA) = min(t8c2F state(ct)= a or8c2F state(ct)=r)

the recognition time of F with Aif the gureF is recognizable withA.

It is the rst time all the cells of the gure are in the same state (acceptance state or rejection state).

(15)

Recognition of rectangles.

The goal of this part is to show that rectangles are recognizable by two-dimensional cellular automata. The idea here developed, consists in looking for the most lo-cally possible denition of the rectangle and using this denition in order to construct a cellular automaton which allows to recognize it.

3.1 Denition of a rectangle.

Let us consider the rectangles' family, denoted by R, that is to say the set of

gures F such that:

9(i 0j0) 2Z 2and (i fjf)2Z 2 F = f(ij)2Z 2 i 0 iif and j 0 jjfg

Now, we give a denition of the rectangles which is equivalent to the previous one but, which gives us a local characterization of the rectangles. In fact, we want this denition to indicate us the neighborhood of each cell of the gure. It will help us to construct a cellular automaton recognizing the rectangles' family.

Let F be a 4-connected gure without hole.

We have to keep in mind that, at time 0, all the cells which belong to F are in state 1 and the others are in state 0.

Let P1 be the following property, associated to the gure F:

Property 1 (Property of the external layer of a gure)

8(ij)2Lext(F),jH(ij)\Lext(F)j= 2

This property means that all the cells which belong to the external layer of the gure F, have exactly two adjacent cells which belong to this layer.

Then, we have the following theorem: 12

(16)

A gureF is a rectangle if and only ifF is 4-connected, without hole andP1(F)

is true.

3.2 Demonstration.

In this section, we want to prove the previous theorem.

Let F be a gure which is 4-connected, without hole and which veries the property P1. We want to show that F is a rectangle.

The proof is long then, we decompose it as follows: In a rst part, we present the Jordan's lemma forZ

2. It will be useful in order

to demonstrate the following lemmas.

In a second part, we construct a sequence of cells which describes the border of the gure F: we take the upper-left most cell of the gure as the rst element of the sequence and we go round the border the gure in the counterclockwise direction(see gure 3.1).

We show that the border of F is constituted by four parts: an horizontal part,

i

j

Figure 3.1: Description of the border of F.

a vertical part, an other horizontal part and an other vertical one (as in the gure 3.2. By an iterative process, we construct the rest of the sequence.

Figure 3.2: In a rst time, the border of F is constituted by four parts Then, we show that there are two cases: the sequence is either a spiral or the border of a rectangle (see gure 3.3.

(17)

Figure 3.3: The constructed sequence is either a spiral or a rectangle 1,0 0,0 2,2 1,2 0,2 ... 2,1 1,1 0,1 ... 2,0 ... i j

Figure 3.4: i and j axis.

In the third part, we show that the rst case leads to a contradiction. In the fourth part, we deduce that the gure F is a rectangle the border of which is the sequence we have just constructed.

In order to x the ideas, we use the part of the grid which is shown in the gure 3.4.

3.2.1 The Jordan's lemma for

Z

2

.

Lemma 1 (Jordan's lemma for

Z

2

)

Any connected path which connects the point (ab) to the point (a + 1b;1)

meets any connected path which connects the point (a + 1b)to(ab;1).

See gure 3.5. i j (a+1,b) (a+1,b-1) (a,b-1) (a,b)

Figure 3.5: Jordan's lemma for Z 2

This lemmahas already been proved by Rosenfeld (Ros70], Ros73], Ros74], Ros75], Ros79], ROS89]).

(18)

border of

F

We study the position of the cells which are on the border of the gure. We start with the upper-left most cell and we go round the border of the gure in the counterclockwise direction.. As soon as we go round, we construct a 4-connected path, denoted by hlfor 0 l n, which contains the meeting cells.

The rst element, h0, of this path is the upper-left most cell the coordinates

of which are i0 and j0 such that:

De nition 16 (De nition of

(i0j0)

)

We putj0= min fj9i(ij)2Fgand i 0= min fi(ij 0) 2Fg (i0j0).

By denition of i0and j0, we have:

Fact 1

(i0j0) 2Lext(F) (i 0j0+ 1) 2Lext(F) (i 0+ 1j0) 2Lext(F) Proof (i0j0) 2F and (i 0j0

;1) =2 F because of the denition of j

0 then (i0j0) 2

Lext(F). (i0 ;1j

0) =

2F because of the denition of i

0. As (i0j0 ;1) =2 F, (i0 ;1j 0) = 2 F, (i 0j0)

2 Lext(F) and F satises P

1 we have: (i0j0+ 1) 2

Lext(F) and (i0+ 1j0)

2Lext(F).

See gure 3.6.

We go round the gure by the right. So, we rst describe the higher border of the gure:

Lemma 2

There exists an index such that 8k2f0:::;1g,ik

+1= ik+ 1,jk+1= jk

and i+1= i and j+1= j+ 1.

Proof. See gure 3.7.

Let  be the rst index such that (i+ 1j) =2Lext(F). Then (ij;1) =2

Lext(F) with the denition of j0 (we have j0 = j1 = ::: = j). Therefore

(ij+ 1)2Lext(F) because F satisfy P

1 and i+1= i, j+1 = j+ 1.

Now, we successively give a description of the right, the bottom and the left most borders.

Lemma 3

There exists an index  (0  ) such that 8k 2f:::;1g,ik

+1 = ik,

jk+1= jk+ 1and i+1= i

;1and j

(19)

not in F because of the definition of j 0

not in F because of the definition of i 0 j i 0 (i +1,j ) 0 0 (i ,j ) 0 0 (i ,j +1) 0

Figure 3.6: The adjacent cells of the upper-left most cell

j

i

α α

not in F because of the definition of i and j

0

not in F because of the definition of j

1 j0 i0 i i j 2 iα-1 2 1 j iα jα iα+1jα +1 j +1 α h α h -1 α h 2 h 1 α h -1 0 h

(20)

α α α i j +1 iα j +1 α jβ iβ iβ−1j h β+1 i β−1 β+1 hβ−1 hβ+1 hβ i0 j0 h0 +1 α h j out of F in F contradiction

(21)

Proof. See gure 3.8.

Let  be the smaller index ( > ) such that (ij+ 1) =2Lext(F). Then, as

F satises the property P1, if (i+ 1j) =

2Lext(F) then (i;1j)2Lext(1).

We show, by reduction to the absurd, that (i+ 1j) =2Lext(F). Otherwise,

(ij;1)2Lext(F) and (i+ 1j)2Lext(F) and therefore belong to F. As

(ij)2Lext(F), it belongs to F and therefore the point (i;1j) doesn't

belong to F.

Lext(F)nf(ij)g is a k : k

1 connected path which connects (ij

;1) to

(i+ 1j).

As F is a gure without hole, there exists ak:k

1connected path which connects

(i;1j) to (i 0j0

;1). We extend this path adding it the point (ij), the

points (ihjh;1) for h2f1:::gand (ih+ 1jh) for h2f:::;1g. Then

we obtain a path which connects (ij) to (i+ 1j;1). With the lemma

2, this two paths have a common point which belongs to Lext(F)n(ij) and

therefore to F. But, with the denition of the second path, it doesn't belong to F. There is a contradiction.

Lemma 4

There exists an index  (0   ) such that 8h2f:::;1g,ik +1=

ik;1,jk

+1= jk and i+1= i and j+1= j ;1.

Proof.

It is similar to the previous one (see gure 3.9).

Now, we have several possible cases. They are shown in the gure 3.10. Actually, the rst case can readily be eliminated (because of the denition of j0).

Lemma 5

Either8k2f:::ngik +1 = ik, jk+1= jk ;1and (ik +1jk+1) 2Lext(F) or, 9 such that 8k2f:::;1gik +1= ik,jk+1= jk ;1and i +1= i+ 1and j+1= j. Proof.

If we are in the rst case, the construction is ended. We will discuss about this situation after.

Let  be the smaller index ( ) such that (ij;1) =2Lext(F). Two cases

are possible: either (i ;1j) 2 Lext(F) or (i + 1j) 2Lext(F). We show

that the rst case leads to a contradiction (see gure 3.11): the two points (i+ 1j) and (ij;1) don't belong to F. We call (~i~j) one of these points,

and we consider the two paths:

(22)

iβ jβ α i jβ−1 hβ−1 h β−1 i β j0 h0 β+1 i jβ+1 hβ+1 0 h γ+1 iγ hγ iγ−1 hγ−1 jγ+1 iγ+1 jγ jγ−1 h +1 α i jα+1 α i jα +1 α h contradiction out of F in F

(23)

jβ+1 h β−1 iβ+1 β+1 α β h β−1 h +1 i0 j h h0 j α i β−1 i β i jβ j hα α +1 α iα i 0 +1 iα+1 hα i0 j0 h0 jβ i iβ−1jβ−1 hβ−1 hβ β+1 i α hβ+1 α iγ h +1 iγ−1 hγ−1 jγ jγ−1 hγ+1 jγ+1 iγ+1 j +1 j α j hn jn in h α γ+1 i jγ+1 γ+1 h β hα+1 jα iα jα+1 iα+1 hα i0 j0 h0 jβ iβ iβ−1jβ−1 hβ−1 hβ β+1 i jβ+1 hβ+1 j iγ hγ iγ−1 hγ−1 jγ jγ−1 hγ+1 jγ+1 iγ+1 γ−1 j β+1 γ−1 hδ jδ iδ h γ−1 i γ j γ h γ i γ (a) (c) (d) ? ?

Figure 3.10: The left most border

 The path constituted with the path which doesn't belong to F and which

connects (~i~j) to (i0j0

;1), with the point (ij) and the points (ihjh;1)

for h 2 f1:::g, (ih+ 1jh) for h 2 f:::gand (ihjh+ 1) for h 2 f:::g.

These two paths meet in a point which is not (ij) and which is both in F

and outside F.

In the case where there exists an index  such that, for all k inf:::;1g,

ik+1= ik, jk+1 = jk ;1, i

+1= i+ 1 and j+1 = j the construction of the is

not ended. We continue it by induction.

There are four cases, which correspond to the four possible directions of the path (see gure 3.12).

Lemma 6

There exists a sequence of indices km indexed by m2f0:::gsuch that:  Si m = 0,k 0= 0  Si m > 0,

{

Ifm0 (4) 8k2fkm ;1:::km ;1gik +1= ik and jk+1= jk ;1 ikm +1= ikm+ 1and jkm+1= jkm

{

Ifm1 (4) 8k2fkm ;1:::km ;1gik +1= ik+ 1and jk+1= jk

(24)

0 j h0 h j iδ δ δ+1 j δ iβ i h jβ−1 hβ−1 hβ β i jβ+1 hβ+1 β−1 iγ hγ β+1 γ−1 hγ−1 jγ jγ−1 hγ+1 jγ+1 iγ+1 0 i α h h hδ−1 iδ−1jδ−1 +1 α i jα+1 α i jα +1 α i j iδ+1 δ+1 contradiction in F not in F

(25)

k5 h k7 h k8 h k 9 h k10 h k11 h k12 h k13 h k14 h k15 h k16 h k 6 h =(i ,j )0 0 k0 h k=(i ,j )α α 1 h =(i ,j )β β k2 h =(i ,j )γ γ k3 h =(i ,j )δ δ k4 h

Figure 3.12: Construction of the path by induction

ikm +1= ikm and jkm+1= jkm+ 1

{

Ifm2 (4) 8k2fkm ;1:::km ;1gik +1= ik and jk+1= jk+ 1 ikm +1= ikm ;1and jkm +1= jkm

{

Ifm3 (4) 8k2fkm ;1:::km ;1gik +1= ik ;1and jk +1= jk ikm +1= ikm and hkm+1= jkm ;1 Proof.

Notice that the constructed path is a spiral.

=(i ,j )β β k2 h =(i ,j )α α k1 h =(i ,j )0 0 k0 h =(i ,j )γ γ k3 h =(i ,j )δ δ k4 h hk m-1 hk m-1+1 hk’

(26)

0123(4). We have:

 For m = 0, hk 0 = h

0= (i0j0) (the upper-left most cell),

 for m = 1 (respectively 2, 3 and 4), we have the same situation as in

the lemma 2 (respectively lemma 3, lemma 4 and lemma 5) with k1 = 

(respectively k2= , k3= , k4= ),  for m5,

we suppose that the path h has been constructed for k2f0:::km ;1+ 1

g.

We want to dene it for k2fkm

;1+ 2:::km+ 1 g.

Notice that we only give the demonstration in the case where m 0(4)

because the other cases are similar.

{

Case m0 (4)

With the recurrence hypothesis, we have ikm;1+1= ikm

;1and jkm ;1+1=

jkm;1

;1 (see gure 3.13). Let k

0be the smaller index (k0> k

m;1)

such that jk0 +1

6

= jk0

;1. In H(ikjk)\Lext), we have the point

(ik0jk0+ 1). As F satises the property P

1, one of the two points

(ik0 ;1jk 0) or (ik0+ 1jk0) 2Lext(F)\H(ik 0jk0). We show that if it is (ik0 ;1jk

0), then we come to a contradiction (see gure 3.14).

So, (ik0+1jk0) and (ik0jk0

;1) do not belong to F let (~i~j) be one

of these points.

The path I made of Lext(1) except (ik0jk0), which connects (ik0 ;

1jk0) to (ik0jk0

;1) is entirely in F.

Moreover, (ik0 ;1jk

0+ 1) do not belong to Lext(F). So, as F is

4-connected and without hole, there exists a path CH, which is entirely outside F, and which connects (~i~j) to (ik0

;1jk

0 + 1).Therefore,

with the lemma 2, these two paths I and CH have a common point. This common point can't be the point (~i~j) which doesn't belong to Lext(F). Whence the contradiction.

{

Other cases.

They are similar to the former one.

3.2.3 Study of the path.

In this section, we study the spiral. More precisely, as we have shown that it is nite, we show that every case of stop leads to a contradiction.

We start working on the sequence of indices km or m 2 f0:::g. We show

that, if we give an other formulation of this sequence, we can deduce relations between the coordinates of the points hkm (see gure 3.15).

(27)

γ (i ,j )γ (i ,j ) k’+1 k’ k’+1 k’ m-1 m-1 (i ,j ) δ β (i ,j ) (i ,j ) β (i ,j ) α α (i ,j ) 0 δ 0 (i ,j ) in F out of F contradiction Figure 3.14: Case m0 (4) hk16 hk 0 hk 4 hk 8 hk12 hk13 hk9 hk 5 hk 1 hk 2 hk 6 hk10 hk 14 hk15 hk 11 h k7 hk 3

(28)

If  > 3then, nominating again the sequence km by k0+4l, k1+4l,k2+4l,k3+4l, l2f0::: ;3 4 g, we have: 8l2f0::: ;3 4 g a- ik4l< ik 4(l+1) < ik4(l+1)+1 < ik 4l+1 forl 1 b- jk4l+1< jk 4(l+1)+1 < jk4(l+1)+2 < jk 4l+2 c- ik4l+2< ik 4(l+1)+2 < ik4(l+1)+3 < ik 4l+3 d- jk4l+3< jk 4(l+1)+3 < jk4(l+1)+4 < jk 4l+4 Proof.

We show it, by recurrence on l.

 l=0 We have:

{

jk1 < jk5 < jk6 < jk2

{

ik2> ik6 > ik7 > ik3

{

jk3 > jk7 > jk8 > jk4 Eectively, jk1 = jk0by denition of k 1. jk 4 > jk0by denition of j 0= jk 0.

So, jk4 > jk1. As, jk5 = jk4 (by denition of k

5) we have jk 1 < jk5.

jk6 > jk5 by denition of k

6, hence jk

1< jk5 < jk6.

We prove that jk6< jk2 by reducing it to the absurd.

We suppose that jk6 jk

2 (see gure 3.16). Then, there exists an index

hk 0 hk1 hk 2 hk 3 hk 5 hk 6 hk 4 hl’ Figure 3.16: Case jk6 jk 2. l0, k 5 < l 0 k 6, such that hl

0 has more then two adjacent cells which

belong to Lext(F). Hence, the contradiction.

(29)

With a similar reasonning, we prove that ik2 > ik6 > ik7 > ik3 and

jk3 > jk7 > jk8 > jk4.  l>0

We only show the item a- because the other ones are similar.

We suppose that the relations are true for the index (l;1) (see gure

3.17).

First, we have ik4l< ik4l+1 by the hypothesis of recurrence .

hk 4(l-1) hk4(l-1)+1 k h 4(l-1)+2 hk4(l-1)+3 hk 4l hk 4l+2 k h 4l+1 hk 4l+3 k h 4(l+1) i j

Figure 3.17: General case of the lemma 7

Moreover, ik4l+2 = ik4l+1 by denition of hk4l+2 and ik4l+3 < ik4l+2, hence

ik4l+3< ik4l+1.

But, ik4l+3 > ik4l by the hypothesis of recurrence. Then, ik4l < ik4l+3.

ik4l+4 = ik4(l+1) = ik4l+3 by denition of hk4(l+1). Hence, ik4l < ik4(l+1) <

ik4l+1.

Moreover, ik4(l+1)+1 < ik4(l+1)by the denition of hk4(l+1)+1. But, ik4(l+1)+1 <

ik4l+1 because otherwise, there exists an index l 0, k

4(l+1)< l 0

k

4(l+1)+1,

such that hl0 has more than two adjacent cells which belong to Lext (F)

(see gure 3.18). Hence, ik4l< ik

4(l+1) < ik4(l+1)+1 < ik 4l+1.

We observe that the lemma 5 gives a possibility to stop the construction. As the gure is a nite set of cells and since the lemme 7, the sequences of points hk0+m, hk1+m, hk2+m and hk3+m, for m

2f0:::g, converge to one or

two points. So, the sequence of indices km, for m 2 f0:::gis nite. The

gure 3.19 shows dierent possible ends of the construction.

Proposition 1

Lext(F) = f(ij) ((j = j 0 or j = j3) and i0 i i 1) or ((i = i0 or i = i1) and j3 j j 0)

(30)

hk 4l+2 hk 4l+3 hk 4(l+1) hk4(l+1)+1 Figure 3.18: Case ik4l+3> ik4l+2

Figure 3.19: Dierent ends of the spiral construction Proof.

We know that there are two kinds of stop: either the construction of the path h stops as in the situation of the rst case of the lemma 5 and i3> i0 or i3= i0

or, it continues as in the lemma 6 and we have spiral the construction of which ends in four dierent case.

In fact, we can prouve that every cases of stop, except the case where i3= i0,

lead to a contradiction.

Eectively, in each case there exists a cell of the path which has more than two adjacent cells which belong to Lext(F) (see gure 3.19).

Hence, h is the set of cells (ij) such that ((j = j0 or j = j3) and i0

i i 1)

or ((i = i0 or i = i1) and j3

j j

0) and h is the border of F.

3.2.4 Characterization of

F

.

In this section, we prove that the path which has been constructed previously is the border of a rectangle, that is to say F is a rectangle.

Proposition 2

F =f(ij) i 0 i i 1 and j3 j j 0 g. Proof

In the former subsection, we have shown that the border of F, denoted by Lext(F), is such that Lext(F) = f(ij) ((j = j

0 or j = j3) and i0

i i 1)

or ((i = i0 or i = i1) and j3

j j

0). The gure 3.20 gives a graphic

representation of the border of F. As F is 4-connected and without hole, F cannot only be the border of a rectangle and there not exists any cell (ij) such

(31)

i0 j3 j0 i1 i j

Figure 3.20: The border of F that i0

i i 1, j3

j j

0 and (ij) doesn't belong to F.

Hence, F =f(ij) i 0 i i 1 and j3 j j 0 g.

3.3 An automaton which recognizes the

rectan-gles.

We have to nd an automaton A, which allows to have, at a given time t, all the cells of the gure in the same state: the acceptance state if the gure belongs to the rectangle family or, the rejection state if the gure doesn't belong to the rectangle family.

We have shown that a gure F is a rectangle if and only if every cell that belong to the border of F have exactly two adjacent cells which belonging to the border. We use this denition in order to construct a cellular automaton recognizing the rectangles: each cell of the gure says to its neighbors whether it is on the border or not. A cell which is on the border and which has not exactly to adjacent cells on the border generates a rejection state. And, a cell which is on the border and which has exacty two adjacent cells on the border, generates an acceptance state. The proposed automaton A is A = (2SH) such that:

 A has 5 states: S =f01234g,  H is the Von Neumann's neighborhood,

  is the transition function given by the transition table 3.1.

The principle is the following one. A cell which is in state 1 and that belongs to the external layer of the gure (that is to say a cell which has at least one adjacent cell in state 0) enters state 2. Afterwards, each cell which is in state

(32)

Cell H1 4 H 2 4 H 3 4 H 4 4 New state 1 0 2 1 0 2 1 0 2 1 0 2 2 2 2 3 2 2 2 3 2 2 2 3 2 2 2 3 2 2 2 3 2 2 2 3 2 0 0 0 0 3 6 = 06= 36= 4 3 6= 4 6= 4 6= 4 3 6 = 06= 36= 4 6= 4 3 6= 4 6= 4 3 6 = 06= 36= 4 6= 4 6= 4 3 6= 4 3 6 = 06= 36= 4 6= 4 6= 4 6= 4 3 3 2 6= 2 6= 2 6= 2 6= 2 4 2 2 6= 2 6= 2 6= 2 4 2 6= 2 2 6= 2 6= 2 4 2 6= 2 6= 2 2 6= 2 4 2 6= 2 6= 2 6= 2 2 4 6 = 06= 4 4 4 6 = 06= 4 4 4 6 = 06= 4 4 4 6 = 06= 4 4 4

Table 3.1: The transition function of the automaton recognizing the rectangle's family.

(33)

2 is going to determine, according to its neighborhood, if it may belong to the border of a rectangle. In fact, a cell which is in state 2, knows that it is not the border of a rectangle if it doesn't have exactly two adjacent cells which are in state 2. So, each cell that belongs to the border, enters the acceptance state (state 3) or in the rejection state (state 4). Then, these states spread the rejection state is stronger than the acceptance state.

At some time t, we have:

8c2F state(c) = 3 (F 2R) 8c =2F state(c) = 4 (F =2R)

Then, we know if F is a rectangle or not. Examples are given in the gures 3.21 and 8.1.

If all the cells of the considered gure are in state 3 then the gure is a rect-angle otherwise, if all the cells are in state 4 then the gure is not a rectangle. Let us consider the rst gure. All the cells of the external layer have exactly two adjacent cells belonging to this layer, therefore they all enter the acceptance state (state 3). Afterwards, this state spreads in all the gure.

On the other hand, in the third gure, two cells of the external layer haven't exactly two adjacent cells in this layer, therefore these cells enter the rejection state. The rejection state dominates the acceptance state, so all the cells of the gure progressively enter the rejection state (state 4).

3.4 Conclusion.

We gave an automaton which allows to decide whether any 4-connected gure without hole of the discrete plane is a rectangle or not.

We can notice that four of the ve states are essential: the initial states 0 and 1 and the terminal states 3 and 4 can not be suppressed. It seems that this automaton has a minimal number of states. Otherwise, it allows to detect very quickly, as soon as the second iteration, whether the gure is a rectangle and this independently regardless of its size.

For a rectangle the size of which is m n, the global recognition time is

rtime(RA) =dmin (m n) 2

(34)

State 1 State 2

State 3 (acceptance state) State 4 (rejection state)

(35)

Recognition of squares.

4.1 Introduction.

In this chapter, we study the squares' family that is to say the set of gures F such that: 9(i 0j0) 2Z 2and l 2N  F =f(ij)2Z 2 i 0 ii 0+ l and j0 jj 0+ l g

We are going to give an automaton which allows to recognize the squares. For this, we are going to use a similar method as the one used for the rectangles and we are going to say that a square is a rectangle which has a symmetry property. In fact, we are going to apply the idea, which has been developed by Grasselli (1975) in Gra75], for the two-dimensional Firing Squad Problem, to the square recognition problem. Grasselli denes two operations which are applied on the gures. The rst one, the decrease, consists in taking o the most external cells (that are the cells which have at least one adjacent cell which doesn't belong to the gure). The opposite operation, the expansion, consists in adding a layer of cells to the gure. If the decrease is successively applied to any gure, at a given time, if we apply one supplementary decrease, then all the cells of the gure disappear: we will say that the nucleus of the gure is reached. We will use again this idea of "peeling an onion" in order to recognize the squares.

4.2 Denition of the square.

Let F be a gure of the discrete plane.

We start from the following conguration of the plane:

8c2F state(c,0)=1 8c =2F state(c,0)=0

(36)

We dene the ithlayer of the gure F, denoted by Li(F), as follows:  L 0 = Lext(F)  i1,Li= Lext(F n(L 0 ::: Ln ;1)) (See gure 4.1). L2 L1 L3=L (F)int L0=L (F)ext

Figure 4.1: The layers of a gure.

De nition 18 (The internal layer of a gure)

As F is a nite gure, there exists an index i0 such that L

i0

+1(F) =

. We

put Lint(F) = Li0(F). Lint(F) is called the internal layer of the gure or the

nucleus of the gure.

We dene the following property, S, of a neighborhood.

Property 2

S(H4(xy)) ,9ii 0, (H1 4(xy) 2Li and H 2 4(xy) 2Li and H 3 4(xy) 2Li 0 and H4 4(xy) 2 Li 0) or (H 1 4(xy) 2Li and H 2 4(xy) 2Li 0 and H 3 4(xy) 2 Li 0 and H4 4(xy) 2 Li) or (H 1 4(xy) 2 Li 0 and H 2 4(xy) 2 Li 0 and H 3 4(xy) 2Li and H4 4(xy) 2 Li) or (H 1 4(xy) 2 Li 0 and H 2 4(xy) 2 Li and H 3 4(xy) 2 Li and H4 4(xy) 2Li 0)

If the neighborhood H4 verify S, the cells which belong to H4 are two-two in

the same state (see gure 4.2)

Figure 4.2: Neighborhoods that verify the property S. For a gure F, we dene the following property P2:

(37)

Property 3

P2(F) ,P 1(F) and ( 8(ij)2Lint(F) S(H 4(ij)))

F veries P2 if and only if F veries P1, that is to say all the cells of the

external layer of the gure have exactly two adjacent cells in this layer, and if the neighborhood of any cell that belongs to the nucleus of the gure veries S.

Then, we have the following theorem:

Theorem 2

F is a square(F 2S),F is 4-connected, without hole and P

2(F)true

4.3 Demonstration.

We want to prove the former theorem.

Using the theorem 1 (chapter 3), we know that F is a rectangle, that is to say

9(i 0j0)(ifjf) 2Z 2, F = f(ij) i 0 i if and j 0 j jfg

Then, three cases are possible:

 Case 1: jf;j 0> if ;i 0.

{

Case 1.1: if;i 0 odd. As if;i 0is odd, 9iLi= Lint(F) = R(i

0+(i ;1)j 0+(i ;1)i 0+(i ;1)jf;(i;1)) = f(ij)2F i 0+(i ;1) i i 0+(i ;1) et j 0+(i ;1) j jf;(i;1)g

because of the denition of Lint(F). So Lint(F) is a rectangle the

sides of which are parallel to the axis i and the length of which is 1. Let c1 and c2 be the extremist cells of this rectangle, c1 = (i0+

(i;1)j 0+ (i ;1)) and c 2 = (i0+ (i ;1)jf ;(i;1)). We have: H1 4(c 1) 2 Li ;1, H 2 4(c 1) 2 Li ;1, H 3 4(c 1) 2 Li et H 4 4(c 1) 2 Li ;1.

Therefore, H4(c1) doesn't satisfy the property S (it's the same for

H4(c2)). Therefore P2 is not veried in this case.

{

Case 1.2: if;i 0 even. As if;i 0is even, 9i Li(F) = Lint(F) = R(i 0+(i ;1)j 0+(i ;1)i 0+ijf ;(i;1)) = f(ij)2F (i 0+(i ;1) i i 0+i and j0+(i ;1) j jf;(i;1)g.

So Lint(F) is a rectangle the sides of which are parallel to the axis i

and the length of which is 2. Let c1 = (i0+ (i

;1)j

0+ i). c1

2 Lint(F). This cell is such that

H1 4(c 1) 2Li, H 2 4(c 1) 2Li ;1, H 3 4(c 1) 2Li et H 4 4(c 1) 2Li. Therefore

H4(c1) doesn't verify the property S and then, P2 is not veried

again.

 Case 2: jf;j 0< if

;i 0

(38)

We obtain a rectangle the sides of which are parallel to the axis j, and the length of which is 1. And, we conclude as in 1.1.

{

Case 2.2: jf;j

0 even. Idem case 1.2.  Case 3: if ;i 0= jf ;j 0 Let l = if;i 0= jf ;j 0.

{

Case 3.1: l even. 9i Li= Lint(F) = R(i 0+ (i ;1)j 0+ (i ;1)i 0+ ij0+ i) = f(ij) i0+ (i ;1) i i 0+ i et j0+ (i ;1) j j 0+ i g. The nucleus

of the gure, Lint(F), is a square the sides of which have a length

which equals 2. Therefore, it contains four cells which are named c1,

c2, c3 et c4. We have: H 4(c1) veries S because H 1 4(c 1) 2Li ;1, H 2 4(c 1) 2Li ;1, H 3 4(c 1) 2 Li and H4 4(c 1) 2Li. It's the same with H

4(c2), H4(c3) et H4(c4).

Therefore P2is veried.

De nition 19 (The expansion of a gure)

LetE(F) be the operation which is dened as follows:

LetG =f(ij)2F9c2H

4(ij) and c

2Lext(F)gbe the set of

the cells which belong to the plane and which have at least one adjacent cell in the external layer of the gure.

E(F) = F G

The operationE(F) consists in taking again a layer to the gureF: it's the expansion (see gure 4.3).

a) Initial pattern b) E(F)

Figure 4.3: Adding a layer.

Lemma 8

(39)

Proof.

Let S be a square such that S = f(ij) 2 F i 0 i < i 0+ l and j0 j < j 0+ l g. Let T =f(ij)2F (j = j 0 ;1 and i2fi 0 ;1:::i 0+ l + 1 g) (j = j 0+ l + 1 and i 2fi 0 ;1:::i 0+ l + 1 g) (i = i 0 ;1 and j2fj 0:::j0+ l g) (i = i 0 ;(l + 1) and j 2fj 0:::j0+ l g) E(C) = C T =f(ij)2F i 0 i < i 0+ l and j0 j < j 0+ l g and (j = j 0 ;1 and i2fi 0 ;1:::i 0+ l + 1 g) and (j = j 0+ l + 1 and i 2fi 0 ;1:::i 0+ l + 1 g) and (i = i 0 ;1 and j2fj 0:::j0+ l g) and (i = i 0 ;(l + 1) and j 2fj 0:::j0+ l g)g

Therefore E(S) =f(ij)2F i 0

;1 i < i

0+l +1 and j0

;1 j <

j0+ l + 1

g. Therefore E(S) is a square the length of which is l + 2.

As Lint(F) is a square, we can deduce with the lemma 8 that F is a

square.

{

Case 3.2: l odd . 9i Li = Lint(F) = (i 0 + (i ;1)j 0+ (i

;1)). The nucleus of the

gure is reduced to an unique cell c such that: H1 4(c) 2Li ;1, H 2 4(c) 2 Li;1, H 3 4(c) 2 Li ;1 and H 4 4(c) 2 Li

;1. Therefore H4(c) verify the

property S (with i0= i) and therefore the conditions of the theorem

are veried. Furthermore, Lint(F) is reduced to a sole cell, therefore

it's a square. We can deduce with the lemma 8 that F is a square.

4.4 An automaton which recognizes the squares.

The proposed automaton is B = (2SH) such that:

 B has seven states: S =f0123456g,  The neighborhood H is the Von Neumann's one,

 The transition function  is given by the transition tables 4.1 and 4.2.  The terminal states are the states 5 and 6 with:

8c2F state(c)=5 ,F 2S 8c2F state(c)=6 ,F =2S

(40)

Cell H 1 H 2 H 3 H 4 New state 1 0 2 1 0 2 1 0 2 1 0 2 1 3 4 1 3 4 1 3 4 1 3 4 1 2 3 1 2 3 1 2 3 1 2 3 1 4 3 1 4 3 1 4 3 1 4 3 2 6= 2 6= 2 6= 2 6= 2 6 2 2 6= 2 6= 2 6= 2 6 2 6= 2 2 6= 2 6= 2 6 2 6= 2 6= 2 2 6= 2 6 2 6= 2 6= 2 6= 2 2 6 4 4 4 2 4 6 4 4 4 4 2 6 4 2 4 4 4 6 4 4 2 4 4 6 6 = 06= 56= 6 5 6= 6 6= 6 6= 6 5 6 = 06= 56= 6 6= 6 5 6= 6 6= 6 5 6 = 06= 56= 6 6= 6 6= 6 5 6= 6 5 6 = 06= 56= 6 6= 6 6= 6 6= 6 5 5 6 = 06= 6 6 6 6 = 06= 6 6 6 6 = 06= 6 6 6 6 = 06= 6 6 6

(41)

Cell H 1 H 2 H 3 H 4 New state 4 4 4 3 4 6 4 4 4 4 3 6 4 3 4 4 4 6 4 4 3 4 4 6 3 3 4 3 3 6 3 3 3 4 3 6 3 3 3 3 4 6 3 4 3 3 3 6 3 4 3 4 4 6 3 4 4 3 4 6 3 4 4 4 3 6 3 3 4 4 4 6 4 3 4 3 3 6 4 3 3 4 3 6 4 3 3 3 4 6 4 4 3 3 3 6 4 2 4 2 2 6 4 2 2 4 2 6 4 2 2 2 4 6 4 4 2 2 2 6 2 0 2 0 0 6 2 0 0 2 0 6 2 0 0 0 2 6 2 2 0 0 0 6 4 2 2 2 2 5 4 4 4 2 2 5 4 2 4 4 2 5 4 2 2 4 4 5 4 4 2 2 4 5 3 4 4 4 4 5 3 3 3 4 4 5 3 4 3 3 4 5 3 4 4 3 3 5 3 3 4 4 3 5 4 3 3 3 3 5 4 4 4 3 3 5 4 3 4 4 3 5 4 3 3 4 4 5 4 4 3 3 4 5 2 0 0 0 0 5

(42)

that belong to the external layer in state 2. At the second stage, each cell which belongs to this layer is going to determine, according to its neighborhood, if it is on a border of a rectangle (and possibly on a border of a square) or not. Then, after this stage, if no cell enters the error state, we are sure to have a rectangle (according to the chapter 3) and perhaps a square. Afterwards, the gure is decomposed in layers and the cells which belong to "the internal layer" (which belong to the nucleus) are able to know if they are on a square or on a rectangle. As a matter of fact, if a cell which belongs to the nucleus has a symmetrical neighborhood then it is on a square. This is true because if we take o the external layer of a square we obtain an other square. On the other hand, if such a cell has not a symmetrical neighborhood then it is not on a square. See gure 8.2.

4.5 Conclusion.

We proved that the automaton, which is given above, allows to recognize the squares.

The global recognition time is rtime(SB) =dn 2

e+ 1 where n is the distance

(43)

Recognition of patterns

which are built with

rectangles.

In the chapter 3, we have seen that a rectangle is recognizable with plane cellular automata. Now, we consider families of gures which are built with rectangles (families of characters). They are globally dened. In order to recognize these gures, the question is to count the number retracting vertexes that the gure has.

5.1 Denitions

5.1.1 Coming out and retracting vertices

De nition 20 (Coming out vertex)

Let(xy)2F. We say that (xy)is a

coming out vertex of the gure

F if

and only if there exists(x0y0) 2H 4(xy)and (x 00y00) 2H 4(xy)(x 00 6 = x0and y00 6 = y0) such that (x0y0) = 2F and (x 00y00) = 2F. See gure 5.1.

De nition 21 (Retracting vertex)

Let(xy)2F. We say that (xy) is a

retracting vertex of the gure

F if

and only if there exists(x0y0) 2H 4(xy)and (x 00y00) 2H 4(xy)(x 00 6 = x0and y00 6 = y0) such that (x0y0) 2F and (x 00y00)

2F and there exists (x

000y000) in H4(x 0y0) and inH 4(x 00y00)such that (x000y000) = 2F. See gure 5.2. 40

(44)

comming out vertices

Figure 5.1: Coming out vertices of a gure.

retracting vertices

Figure 5.2: Retracting vertices of a gure.

De nition 22 (Vertex of a gure)

Let(xy)2F. (xy)is a vertex ofF if and only if(xy)is a coming out vertex

or a retracting vertex.

5.2 Recognition of \L".

5.2.1 Denition of the

L

family.

A gure is a "L" if and only if it has ve vertexes and therefore, one and only one retracting vertex (see gure 5.3).

retracting vertexes

Figure 5.3: Examples of \L".

We are going to dene more precisely the "L" family: L. We consider the

(45)

De nition 23

LetF1= R(i0j0ifjf) = f(ij)i 0 i if and j 0 j jfg. LetF2= R(i 0 0j 0 0i 0 fj0 f) =f(ij)i 0 0 i i 0 f and j0 0 j j 0 fgsuch that:  (i 0 0j 0 0) = (i 0j0) or (i 0 fj0 0) = (ifj 0) or (i 0 fj0 f) = (ifjf) or (i0 0j 0 f) = (i0jf)  (i 0 f;i 0 0) < (if ;i 0)and (j 0 0 ;j 0 f) < (j0 ;jf) L=fF Z 2F = F 1 nF 2 g See gure 5.4. P = P \ P 1 2 P 2 P 1

Figure 5.4: Denition of the "L".

5.2.2 Automaton which recognizes

L

.

In order to know if any gure belongs toL, or not, we have to know if the gure

has exactly one retracting vertex.

The proposed automaton is L = (2SH) such that: * L has 10 states: S =f0123456789g,

* The neighborhood H is the Von Neumann's one,

* The transition function  is given by the transition table in appendix, chapter 4.

(46)

(the ones that have at least one adjacent cell in the state 0) enter in the state 2.

* A second and third times, we dierentiate the retracting vertexes: two dierent states are used in order to distinguish the retracting vertexes (see gure 5.5).

cell c

State 2 State 3 State 4

cell c

cell c cell c

A cell which is in the state 2, which has a unique adjacent cell in the state 2 and which is on a vertical border enters in the state 3. A cell which is in the state 2, which has a unique adjacent cell in the state 2 and which is on an horizontal border enters in the state 4.

This generates four possible neighborhood for the cell c. Then, this cell enters in a dierent state according to its neighborhood (this state is propagated...).

Figure 5.5: How dierentiate the retracting vertexes. * Afterwards, the states of the angles spread:

- If two dierent states meet then the gure has several retracting angles and it doesn't belong toL.

- Otherwise, at a given moment, all the cells of the gure are in the same state (the one that has been propagated since the unique angle) and F2L.

In order to solve the problem that occurs when the gure has no retracting angle (case of the rectangle), the state 2 is propagated and if, at a given moment, all the cells of the gure are in the state 2 then the gure is not aL(see gures 8.3).

(47)

5.2.3 Automaton which recognizes the "L" family using

cells that are outside the gure.

We can notice that the utilization of cells that are outside the gure facili-tates the recognition and in particular, reduces the number of sfacili-tates that are necessary. So, a possible automaton L0= (2SH) is such that:

- L0 has 8 states: S =

f01234567g,

- H is the Von Neumann's neighborhood,

- The transition function  is given in appendix, chapter 4.

The principle is exactly the same as previously but a cell that is in a retracting angle (therefore, which is outside the gure) knows right away the existence of this angle and therefore, it's not necessary to use two dierent states in order to distinguish the angles (see gure 5.6 and 8.4).

c1 c2

c3

c4

qui se propageront ensuite à l’intérieur de la figure.

Les cellules c1, c2, c3 et c4 ont des voisinages différents. Elles peuvent donc entrer dans des états différents;

The cells c1, c2, c3 and c4 have dierent neighborhoods. So, they can enter in

dierent states which will spread afterwards inside the gure. Figure 5.6: Utilization of cells that are outside the gure.

5.3 Recognition of \U".

5.3.1 Denition of the

U

family.

A gure is a "U" if and only if, when we direct the border of the gure and we go over it, we meet exactly six vertexes and two successive retracting vertexes (see gure 5.7).

We are going to dene more precisely the "U" family:U.

(48)

Figure 5.7: Examples of \U".

De nition 24

Let F1 = R(i0j0ifjf) = f(ij)i 0 i if and j 0 j jfg and F 2 = R(i0 0j 0 0i 0 fj0 f) =f(ij)i 0 0 i i 0 f and j0 0 j j 0 fgsuch that:  (i 0 f;i 0 0) < (if ;i 0)and (j 0 0 ;j 0 f) < (j0 ;jf)  i 0 0 = i 0 or (exclusive) j 0 0= j 0 or (exclusive) i 0 f = if or (exclusive)j0 f = jf U =fF Z 2F = F 1 nF 2 g

In order to recognize this model of gures, it's necessary to verify that the gure has exactly two retracting vertexes and that these vertexes are well placed (this is in order to distinguish the "U" and the gures that are shown in the gure 5.8).

Figure 5.8: Examples of gures that don't belong toU.

5.3.2 Automaton which recognizes the "U".

The idea is the following one: we start marking all the cells of the external layer. Among these cells, if there exist some that have an unique adjacent cell in the external layer then they enter in a state which depends on the place they

(49)

On the vertical border On the horizontal border

external layer

Cells which have an unique adjacent cell in the external layer.

Figure 5.9: Marking the retracting angles.

are (on the horizontal or vertical border). This is shown in the gure 5.9. We can distinguish the dierent angles (as in the recognition of "L"). The states that correspond are propagated. In the case where there is an unique retracting angle, all the cells of the gure will enter in the state of the angle. So, we will say that the gure is not a "U".

In the case where there are two retracting angles, the corresponding states will meet. We have now two possibilities: either we have a "U" or we have a "T". In the rst case, the states which are propagated will meet "as it is necessary" that is to say the meeting direction is respected. Then a state "YES" is generated. In the second case, a state "NO" is generated (see gure 5.10). In the case

YES

NO

Figure 5.10: Meeting of two states.

where there are three retracting angles, or more then that, the meeting of an other state causes the generation of a state "NO". The automaton is given in

(50)

5.3.3 Automaton which recognizes the

U

family using cells

that are outside the gure.

As in the recognition of "L", we notice that if we allow the utilization of cells that are outside the gure then it's possible to nd an simpler automaton which has, in particular, less states.

A possible automaton is given in appendix, chapter 4.

5.4 Recognition of \O".

5.4.1 Denition of the

O

family.

A gure is a "O" if and only if it's a rectangle with a rectangular hole (see gure 5.11).

The utilized neighborhood is Von Neumannn's one.

Figure 5.11: Examples of \O".

De nition 25

LetF1= R(i0j0ifjf) = f(ij)i 0 i if and jf j j 0 g. LetF2= R(i 0 0j 0 0i 0 fj0 f) =f(ij)i 0 0 i i 0 f and j0 f j j 0 0 gwith:  i 0 0 > i 0  i 0 f < if  j 0 0< j 0  j 0 f> jf O=fF Z 2F = F 1 nF 2 g

(51)

5.4.2 Automaton which recognizes the "O".

The principle is still the same. We propagate the states of dierent retracting angles, we count if they are really four and we verify that the states meet "as it is necessary" (see gure 5.12).

The automaton is given in appendix, chapter 4. See gure 8.6.

YES

YES YES

YES

Step 1. Step 2. Step 3. Step 4.

 Step 1: Generation of states that correspond to the dierent retraction

angles.

 Step 2: Propagation of these states. When they meet, there is generation

of new states which means: "two dierent angles have meet".

 Step 3: Propagation of these states. Their meeting generate new states

which means: "three dierent angles have meet".

 Step 4: New propagation and new states "four dierent angles have meet".

Figure 5.12: Recognition of "O".

5.5 Recognition of "T".

Previously, we cast about recognizing gures built from a rectangle which is subtracted with dierent manners to another one. Likewise, we can look for recognizing gures which are the result of the subtraction of two rectangles. Then, we obtain gures that are similar of the ones that are presented in 5.13.

(52)

Figure 5.13: Subtraction of two rectangles.

5.5.1 Denition of the "T" family:

T

.

Here, we are interesting in the T family but the other ones that are built from

the subtraction of two rectangles would be recognizable with similar automata. A gure is a "T" if and only if it has exactly 6 vertexes and two retracting vertexes (separated by two vertexes if we go over the oriented border of the gure). See gure 5.14.

Figure 5.14: Recognition of "T".

De nition 26

LetF1= R(i0j0ifjf) = f(ij)i 0 i if and j 0 j jfg. LetF2= R(i 0 0j 0 0i 0 fj0 f) =f(i 0j0)i0 0 i 0 i 0 f and j0 0 j 0 j 0 fgsuch that:  (i 0 0j 0 0) = (i 0j0)or (exclusive) (i 0 fj0 0) = (ifj 0) or (exclusive)(i 0 fj0 f) = (ifjf)or (exclusive)(i0 0j 0 f) = (i0jf)  (i 0 f;i 0 0) < (if ;i 0)and (j 0 f;j 0 0) < (jf ;j 0) LetF3= R(i 00 0j 00 0i 00 fj00 f) =f(i 00j00)i00 0 i 00 i 00 f and j00 0 j 00 j 00 fgsuch that:  (i 00 0j 00 0) = (i 0j0) 6 = (i0 0j 0 0) or (exclusive) (i 00 fj00 0) = (ifj 0) 6 = (i0 fj0 0) or (exclusive) (i00 fj00 f) = (ifjf)6= (i 0 fj0 f)or (exclusive)(i00 0j 00 f) = (i0jf) 6 = (i0 0j 0 f)  (i 00 f;i 00 0) < (if ;i 0)and (j 00 f ;j 00 0) < (jf ;j 0)

(53)

 P 2 \P 3=  T =fFZ 2F = F 1 n(F 2 F 3)

5.5.2 Automaton which recognizes the "T".

The principle is the same as the one that is used in the "U" recognition. The border of the gure is marked. The dierent retracting vertex are distinguished. The corresponding states are propagated... The automaton is given in appendix, chapter 4. See gure 8.5.

5.6 Generalization.

Here, we dene a family of gures which contains some of the families that have been studied before, and which is recognizable with 2-dimensional cellular automata.

Let F be a 4-connected gure without hole.

5.6.1 Encoding of a gure

De nition 27 (Encoding of a vertex)

Let(xy)be a vertex of the gure. We dene the encoding of (xy), denoted by

c(xy), as follows:

 c(xy) = 1 if and only if(xy)is a coming out vertex of F,  c(xy) =;1if and only if(xy)is a retracting vertex of F.

Let y0 = min(y(xy)

2 F) and x

0 = min(x(xy0)

2 F. (x

0y0) is the

upper-left most cell of the gure F.

Lemma 9

(x0y0)is a coming out vertex of F.

Proof (x0y0 ;1) =2F by denition of y 0and (x0y0 ;1)2H 4(x0y0). (x0 ;1y 0) = 2F by denition of y 0and (x0 ;1y 0) 2H 4(x0y0).

De nition 28 (Encoding of a gure)

LetF be a 4-connected gure, without hole and which has pvertices. We dene the encoding ofF, denoted by C(F), as follows:

C(F) = (m1:::mp)

(54)

 mi (i2) is the encoding of the i-th vertex of the gure F when we go

round the border of the gure in the counterclockwise direction since the upper-left most cell.

See gure 5.15. (x ,y )0 0 F y x C(F)=(1,1,1,1,-1,-1,1,1,1,-1,1,-1)

Figure 5.15: Encoding of a gure.

Now, we dene an operation, denoted by OP1, on the encoding of a gure.

De nition 29 (Operation on the encoding of a gure)

We suppose thatF haspvertices. OP1 is such that:

OP1: f01gp!f01gp C(F) = (m1:::mp) 7!C 0(F) = (m0 1:::m 0 p+2)such that:

Leti2f1:::pgsuch thatmi= 1. For alljinf1:::i;1g,m 0 j = mj,m0 i=;1, m0 i+1= 1,m 0 i+2=

;1and for allj infi + 3:::p+ 2g,m 0

j = mj;2.

In fact, the operationOP1 change a comming out vertex of the gure into three

vertices: a retracting, a coming out and a retracting vertex.

5.6.2 A more general family of gure

LetF be the family of gures which is dened as follows: Let R =f(xy)2Z 2 9x 0y0xfyf 2Zsuch that x 0 x xf and y 0 y yfg. R is a rectangle and C(R) = (1111).  F (0)= fRg,  F (i+1)= F (i) fF 2Z 2such that 9F 0 2F (i) C(F) = OP 1(C(F 0)) g F = ni =0 F (i)

This family of gures is recognizable with 2-dimensional cellular automata. The recognition algorithm has two steps:

- The rst step consists in dividing the considered gure as it is shown in the gure 5.16.

(55)

Figure 5.16: Division of the gure.

- The second step must allow to verify if the dierent parts of the gure that are obtained are rectangles.

It would be necessary to develop it.

5.7 Conclusion

In this chapter, we have dened family of gures since the rectangles' family. There are recognizable with 2-dimensional cellular automata and their recogni-tion algorithm has to be studied more precisely.

(56)

Recognition of ellipses.

6.1 Introduction.

In this part, we want to recognize ellipses. We use waves which spread into the gure.

Before giving an automaton which allows to do this work, we dene the discrete ellipse.

An ellipse is the set of points, the sum of distance of which, to two particular points called (

the focuses

), is constant. The ellipse is called 4;ellipse if the

considered distance is d4 and 8

;ellipse if the considered distance is d 8.

In the discrete plane (Z

2), we consider two particular cells, which will to be the

focuses of the ellipse. Since these focuses, we compute for each cell of the plane the sum of the distances between itself and the focuses. The gure 6.1 shows this computation since focuses aligned or not, with d4.

Let s be an integer. Therefore, an ellipse is formed with cells the sum of distances between itself and the focuses of which, is less or equal to s (see gure 6.2).

Now, we are going to give a more formal denition of the discrete ellipse.

(57)

4 4 4 6 6 6 6 6 6 6 6 6 6 6 6 8 8 8 8 8 8 8 8 8 8 8 8 8 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 10 8 8 8 14 4 4 4 4 4 4 4 6 6 6 6 6 6 6 6 6 6 6 8 8 8 8 8 8 8 8 8 8 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 10 14 8 10 1012 14 8 8 6 12 14 10 14 14 12 12 Focus

i: distance between the cell and the two focus.

Figure 6.1: Sum of distances (focus aligned or not).

4 4 4 6 6 6 6 6 6 6 8 8 8 8 8 8 8 8 8 8 8 8 6 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 12 12 10 14 8 6 6 8 12 8 4 14 4 4 4 6 14 6 8 12 12 14 14 14

Cell which belongs to the ellipse.

(58)

Letf1 and f2 be two given cells of the discrete plane. Lets be an integer.

We say thatE is the ellipse the focuses of which aref1 andf2 and the distance

of which issif and only ifE = E(f1f2s) =

f(xy)2Z 2d(cf

1)+d(cf2) sg

whered = d4 ord8.

To each cell c of the discrete plane (Z

2) is assigned a sum of distances s(c)

such that s(c) =P 2

i=1d(cfi).

LetE be the family of ellipses and let c2Z 2.

P 2E ,9s2N ,8c2Z 2, s(c)

s

6.2 An automaton which recognizes the

4;el l ipses

.

The automaton that we must built, must allow to verify: 9s2BbbN 8c2Z 2,

s(c) s. More exactly, it must allow to verify that all the cells which belong to

the border of the ellipse have a sum of distances which is equal.

The idea is to make a wave coming from one of the focuses, in all the possible directions. This wave spreads as far as touching the border of the ellipse. Then, the cells which are on the border, send back a wave (dierent from the rst one). This wave spreads to the second focus. Then, verify that the gure is an ellipse consists in verifying that the second wave "faints" at the second focus. So, we verify that the sum of the distances of any cell of the border to the two focuses is constant.

The proposed automaton is E = (2SH) where:

 E has seven states: S =f0123456g,  H is the Von Neumann's neighborhood,

 The transition function is given by the transition table given in appendix,

chapter 5. (See gure 8.7).

The space-time diagram which corresponds to this automaton is given in gure 8.8.

6.3 Demonstration.

Here, we intend to prove that the automaton which has been proposed recognizes the ellipses and only them.

De nition 31 (Plane

4;wave

centered on a cell)

Letc be a cell. A plane4;wave centered on c, denoted by W (4)

c , is dened as follows:

Références

Documents relatifs

This Lie algebra is therefore free, and its quotient is A/(a). This proves the theorem.. Under the hypothesis of Theorem 2, we show that d 2 = 0 and that the spectral

COROLLARY 3.7. Assume that the radical of G is simply connected and that G has a maximal connected semisimple subgroup with finite center. Then G has a finite covering with

Для моделирования областей больших размеров и вычисления интегральных характеристик процесса (плотности частиц и интенсивности

L’archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des

En appelant x le prix d'un T-shirt, écrire une équation qui traduit l'énoncé.. Expli- quer

Providing each cell knows the position of the output cell, any regular language is recognized in real time modulo a constant by a CA equipped with a path, whatever the path may

Since we know that there is a token on the node located on the N orth of the black hole, we know that either a locates the black hole, or a dies entering the black hole from the

Exercice n°01 : On donne la figure suivantes.. 1- Montrer que le triangle ABC est rectangle