• Nenhum resultado encontrado

Two decidability algorithms

4. Rational functions 35

Definition 4.2.1 Let T = (Q, E, I, T) be a real-time Σ-Γ transducer. The square of T is the real-timeΣ-(Γ×Γ) transducer T × T = (Q×Q, E0, I×I, T ×T) where

(p, q)−σ/(x, y)−−−−→(p0, q0)∈E0 if and only if

p−→σ/x p0, q−→σ/y q0∈E.

It follows from this definition that there exists a path (p, q)−u/(x, y)−−−−→(p0, q0) inT × T if and only if there are paths

p−→u/x p0 and q−→u/y q0 inT.

For each state (p, q) of T × T, we denote by ∆pq the set

pq ={(x, y)∆ : there exists a path (i, i0)−u/(x, y)−−−−→(p, q) in T × T with i, i0 ∈I}.

We call a pair in ∆pq a difference of (p, q).

We start with the decidability whether a rational relation is a function. The algorithm relies on the fact that

(4.2.1) T is functional if and only if for every final state (t, t0), ∆tt0 ={(1,1)}, and on the following proposition:

Proposition 4.2.1 If T is a real-time functional Σ-Γ-transducer, then, for every accessible and coaccessible state (p, q) in T × T, ∆pq is a singleton, and∆pq ⊆(1×Γ)∪(Γ×1).

Given a set X of transitions, we denote by (T × T)[X] the restriction ofT × T toX. The set of transition of the trim part of T × T will be denoted by F.

The algorithm visits the states of the trim part of T × T. Whenever a state (p, q) is visited, a pair in ∆pq is constructed. For each new pair constructed, the conditions of Proposition 4.2.1are verified. If all states satisfy these conditions, the algorithm verifies (4.2.1).

An economy in time and space complexities can be achieved by considering that if c: (p, q)−−−−−→w/(u, v) (p0, q0)

is a path inT × T, then there exists a path

c0 : (q, p)−−−−−→w/(v, u) (q0, p0)

36 4.2. Two decidability algorithms

in this transducer. So, for every state (p, q), if

(x, y)∈∆pq, then

(y, x)∈∆qp.

We say that c0 is thesymmetrical path of c, that (y, x) is thesymmetrical difference of (x, y), and that (q, p) is the symmetrical state of (p, q). Given a set X of states, differences or paths, the set of the symmetrical ones will be denoted byX0.

Due to the symmetry, the algorithm needs to visit only the states (p, q) such that p ≤q. We call them essentials, and denote by G the subset of F of the transitions that start in an essential state.

The algorithm performs a sequence of iterations. Each one starts with a subsetXof transitions and a partial function δ:Q×Q→ (1×Γ)∪(Γ×1). We denote the image byδ of a pair (p, q) by δpq.

The first iteration starts with X =∅and δii0 = (1,1), for all (i, i0) with i≤i0 that is initial, accessible and coaccessible. In the other states, δ is undefined. Throughout the execution of the algorithm,X has only transitions that start in an essential state, and δ is only defined in essential states. Each iteration consists of the following:

Case 1 X=G

If δtt0 = (1,1) for every final state (t, t0) such that t ≤t0, answer yes and stop. Otherwise, answerno and stop.

Case 2 X6=G

Lete: (p, q)−u/(x, y)−−−−→(p0, q0) be a transition in G−X such thatδpq6=∅.

Case 2a p0 ≤q0

If some of the following conditions occurs, answernoand stop. Otherwise, defineδp0q0 = δpq·(x, y) and inserteinX.

• δpq·(x, y)6∈(1×Γ)∪(Γ×1);

• δp0q0 6=∅and δpq·(x, y)6=δp0q0. Case 2b p0 > q0

If some of the following conditions occurs, answer no and stop. Otherwise, define δq0p0 as the symmetrical ofδpq·(x, y) and inserteinX.

• δpq·(x, y)6∈(1×Γ)∪(Γ×1);

• δq0p0 6=∅and the symmetrical ofδpq·(x, y) is different fromδq0p0. The following invariant holds at the beginning of every iteration:

Invariant 4.2.1 The restriction (T × T)[X∪X0]is accessible, and the domain ofδ is exactly the union of the states of this transducer with the initial states of the trim part of T × T. Furthermore, for every path(i, i0)−u/(x, y)−−−−→(p, q)in (T × T)[X∪X0]such that(i, i0)is an initial state,(x, y)∆ = δpq.

4. Rational functions 37

A detailed description can be seen in the Algorithm4.2.1. In this description, a set P of states ofT × T is maintained, where the algorithm stores all the essential states already visited and that start at some transition not yet selected (that is, inG−X). In each iteration, a pair (p, q)∈P is selected and all transitions that start in (p, q) are analyzed.

The time complexity of the algorithm is O(M m2n2), and the space complexity isO(M n4).

We turn now to the decidability whether a rational function is subsequential. The notations introduced in Section3.3will be employed in the description. Let us suppose that T is a real-time trim functional Σ-Γ-transducer.

We call a state (p, q) limited if for all (x, y)∈∆pq and every closed path (p, q)−−−−→s/(u, v) (p, q), (x, y)·(u, v) = (x, y).

The following theorem brings out the relationship between the concept of uniformly divergent function and that of limited state. Its first form has appeared in [Cho78]. The algorithm verifies the conditioniv.

Theorem 4.2.1 (Choffrut 1978) Let T be a real-time trim functional Σ-Γ-transducer. The fol-lowing conditions are equivalent:

i. Every accessible state of T × T that belongs to a closed path with output different from (1,1) is limited.

ii. For every accessible state (p, q),

(4.2.2) |x|,|y| ≤2M

n 2

, ∀(x, y)∈∆pq. iii. For every accessible state (p, q),

card (∆pq)<∞.

iv. For every state (p, q) that is accessible and belongs to a closed path with output different from (1,1),

card (∆pq)<∞.

v. |T | is a subsequential function.

A proof given in [dS04] follows the implications i⇒ii⇒iii⇒v⇒i, and after iii⇒iv⇒i.

An accessible state is said to be special if it is coaccessible to a limited state belonging to a closed path with output different from (1,1). The main task in finding these states is to mark the states that belongs to a closed path with output different from (1,1). A possibility is to construct the strongly connected components of the accessible part ofT ×T, and then to study the transitions with output different from (1,1) inside each component.

The algorithm may be seen as a search in the directed graph GT defined as follows. The vertex set of this graph is

R= [

(p, q)special

((p, q)×∆pq).

38 4.2. Two decidability algorithms

Algoritmo 4.2.1 Decidability whether a real-time Σ-Γ-transducer T = (Q, E, I, T) realizes a rational function.

Functionality(T)

1 let R be the states of the trim part ofT × T 2 P ←∅

3 for each (i, i0)∈R such that i≤i0 and i, i0 are initial states 4 do δii0 ←(1,1)

5 P ←P∪(i, i0)

6 while P 6=∅and P 6=∞ 7 do (p, q)←Remove(P)

8 for each (p, q)−σ/(x, y)−−−−→(p0, q0) in the trim part of T × T 9 do w←δpq·(x, y)

10 if w6∈(1×Γ)∪(Γ×1)

11 then P ← ∞

12 else if p0 ≤q0

13 then if δp0q0 =∅

14 then δp0q0 ←w

15 P ←P∪(p0, q0)

16 else if w6=δp0q0

17 then P ← ∞

18 else if δq0p0 =∅

19 then δq0p0 ←w0

20 P ←P∪(q0, p0)

21 else if w0 6=δq0p0

22 then P ← ∞

23 for each (t, t0)∈R such thatt≤t0 and t, t0 are final 24 do if δtt0 6= (1,1)

25 then P ← ∞

26 if P 6=∞

27 then return yes 28 else return no

4. Rational functions 39

There is an arc

((p, q),(x, y))→((p0, q0),(x0, y0)) for each transition

(p, q)−−−−−→w/(u, v) (p0, q0) inT × T such that (p0, q0) is a special state and

(x0, y0) = (x, y)·(u, v).

We denote by F the arc set of GT. This graph has a path

c: ((i, j),(1,1))−→((p, q),(x, y)) whereiand j are initial states if and only if there exists a path

c0 : (i, j)−−−−−→w/(u, v) (p, q)

in T × T such that (x, y) = (u, v)∆ and (p, q) is a special state. From this property, it follows thatGT is accessible from the vertices of the form ((i, j),(1,1)).

From the definition of the vertex set of GT and the condition iv of Theorem 4.2.1, it follows that|T | is subsequential if and only ifGT is finite.

An economy in time and space complexities can be achieved by noticing that if there exists a path

c: ((p, q),(x, y))→((p0, q0),(x0, y0)) inGT, then there also exists a symmetrical path

c0 : ((q, p),(y, x))→((q0, p0),(y0, x0)).

Thus, for every vertex

((p, q),(x, y)) inGT, there exists a symmetrical vertex

((q, p),(y, x)).

Therefore, only the vertices ((p, q),(x, y)) ∈ R such that p ≤ q need to be visited. We call the states (p, q) essentials.

The efficiency of the search depends on a clever storage of the vertices of GT based on the following property, that has been noticed in [BCPS03]:

Proposition 4.2.2 Let (p, q) be a special state. Then, if T is subsequential, the following proper-ties holds:

pq ⊆(1×Γ)∪(Γ×1);

(4.2.3a)

for all (x, y),(x0, y0)∈∆pq, the pairs x, x0 andy, y0 are comparable by prefix.

(4.2.3b)

40 4.2. Two decidability algorithms

The algorithm performs a sequence of iterations. Each one starts with a subset X of arcs of F and a subset S of vertices of R. The first iteration begins with X=∅and

S = [

(i, i0)special i, i0∈I

i≤i0

((i, i0)×(1,1)).

Each iteration is as follows:

Case 1 X=G

Stop and answeryes.

Case 2 X6=G

Lete: ((p, q),(x, y))→((p0, q0),(x0, y0)) be an arc inG−X such that ((p, q),(x, y))∈S.

Case 2a p0 ≤q0

If some of the following conditions occurs, stop and answer no. Otherwise, insert ((p0, q0),(x0, y0)) inS and einX.

• (x0, y0)6∈(1×Γ)∪(Γ×1);

• |x0|> M(n2−n) or |y0|> M(n2−n);

• there exists a vertex ((p0, q0),(z, w)) inS such that x0 andz are not comparable by prefix, ory0 and w are not comparable by prefix.

Case 2b p0 > q0

If some of the following conditions occurs, stop and answer no. Otherwise, insert ((q0, p0),(y0, x0)) inS and einX.

• (x0, y0)6∈(1×Γ)∪(Γ×1);

• |x0|> M(n2−n) or |y0|> M(n2−n);

• there exists a vertex ((q0, p0),(w, z)) inS such that x0 andz are not comparable by prefix, ory0 and w are not comparable by prefix.

The following invariant holds at the beginning of every iteration. The following notation are used: given an arc or vertex set X,X0 denotes the set of its symmetrical ones.

Invariant 4.2.2 The restriction GT[X∪X0] is accessible, and S∪S0 is exactly the union of the vertices of this graph with the vertices

[

(i, i0) special i, i0∈I

((i, i0)×(1,1)).

A more accurate description of the algorithm requires the study of the storage of the vertices of GT. We expose briefly the possibility proposed in [BCPS03].

Let b: Γ→Γ0 be a copy of Γ andf : (Γ∪Γ0) →Γ be the morphism generated by σf =

(σ ifσ∈Γ σb−1 ifσ∈Γ0

4. Rational functions 41

The algorithm maintains a set δ0pq and two words δpq1 , δ2pq ∈ (Γ∪Γ0) for each special state (p, q). These data represent the vertices of S according to the following rules:

• if there is not exist a vertex of the form ((p, q),(x,1)) with x 6= 1 in S, then δpq1 = 1.

Otherwise, let ((p, q),(x1,1)), . . . ,((p, q),(xk,1)) be the enumeration of the vertices of S withxi6= 1, for every i, that satisfy

(4.2.4) x1· · ·xk.

For each word xi, let xi =uiγi be the factorization of this such that γi is a letter. Then, δ1pq = (u1)(γ1b)(x−11 u2)(γ2b). . .(x−1k−1uk)(γkb).

• if there is not exist a vertex of the form ((p, q),(1, y)) with y 6= 1 in S, then δ2pq = 1.

Otherwise, let ((p, q),(1, y1)), . . . ,((p, q),(1, yl)) be the enumeration of the vertices of S withyi 6= 1, for every i, that satisfy

(4.2.5) y1· · ·yl.

For each wordyi, letyi=viξi be the factorization of this word such thatξi is a letter. Then, δ2pq= (v1)(ξ1b)(y−11 v2)(ξ2b). . .(y−1l−1vl)(ξlb).

• δpq0 6=∅if and only if ((p, q),(1,1))∈S. If ((p, q),(1,1))∈S, thenδpq0 ={1}.

The enumerations (4.2.4) and (4.2.5) are possible in view of Proposition4.2.2.

With these data, a vertex

((p, q),(x, y))∈S can be stored as

((p, q),(|x|,|y|)).

A detailed description is given in the Algorithm 4.2.2. In this description, the algorithm main-tains a set P with the vertices of S that start at some arc not visited yet. In each iteration, the algorithm selects a vertex ((p, q),(k, l))∈P, and all the arcs of the form

e: ((p, q),(x, y))→((p0, q0),(x0, y0)), with x= (δ1pq[1. . . k])f and y= (δpq2 [1. . . l])f, are analyzed.

Example 4.2.1 We shall reproduce the example of Figure 4 of [BCPS03].

The transducer

a/x3

a/x3

a/x a/x4 a/x

a/x2

1 2 3 4

42 4.2. Two decidability algorithms

Algoritmo 4.2.2Decidability whether a functional real-time transducerT = (Q, E, I, T) realizes a subsequential function. The operation δp10q0 +x0 in line 23 is defined as follows. Let d= |δ1p0q0|.

If|x0|> d, thenδ1p0q0 +x0p10q0(x0[(d+ 1)...(|x0| −1)])(x0[|x0|]b). Otherwise, δp10q0+x0 differs from δp10q0 only in the position|x0|, whereδ1p0q0+x0 has the letterx0[|x0|]b. The operations at lines 27, 36 e 40 are analogous.

Subsequentiality(T)

1 mark the special states ofT × T 2 P

3 for each special state (p, q) such thatpq 4 doδpq1 δpq2 1

5 δpq0

6 for each special state (i, i0) such thatii0andi, i0I 7 doδii00 1

8 P P∪ {((i, i0),(0,0))}

9 N 0

10 while P 6=andN < 11 do((p, q),(k, l))Remove(P) 12 x= (δpq1 [1. . . k])f

13 y= (δ2pq[1. . . l])f

14 for each transition (p, q)−−−−−→w/(u, v) (p0, q0) such that (p0, q0) is special 15 do(x0, y0)(x, y)·(u, v)

16 if (x06= 1 andy06= 1) or|x0|> M(n2n) or|y0|> M(n2n)

17 then N← ∞

18 else ifp0q0

19 then ifx06δ1p0q0 and δp10q06x0 or y06δp20q0 and δp20q06y0

20 then N← ∞

21 else ifx06= 1

22 then if|x0|>p10q0|orδ1p0q0[|x0|]6∈Γ0

23 then δ1p0q0 δ1p0q0+x0

24 PP∪ {((p0, q0),(|x0|,0))}

25 else ify06= 1

26 then if|y0|>2p0q0|orδp20q0[|y0|]6∈Γ0

27 then δp20q0 δ2p0q0+y0

28 PP∪ {((p0, q0),(0,|y0|))}

29 else ifδ0p0q0=

30 then PP∪ {((p0, q0),(0,0))}

31 δp00q0 1

32 else ifx06δ2q0p0 and δq20p06x0 or y06δq10p0 and δq10p06y0

33 then N← ∞

34 else ifx06= 1

35 then if|x0|>q20p0|orδ2q0p0[|x0|]6∈Γ0

36 then δ2q0p0 δ2q0p0+x0

37 PP∪ {((q0, p0),(0,|x0|))}

38 else ify06= 1

39 then if|y0|>1q0p0|orδq10p0[|y0|]6∈Γ0

40 then δq10p0 δ1q0p0+y0

41 PP∪ {((q0, p0),(|y0|,0))}

42 else ifδ0q0p0=

43 then PP∪ {((q0, p0),(0,0))}

44 δq00p0 1

45 if N <

46 then returnyes 47 else returnno

4. Rational functions 43

is functional. Its square is illustrated below, with the indication of ∆pq for each state (p, q). The notation of [BCPS03] is adopted.

1 2 3 4

1 ←→ 0 1 1 0 ←→

2 1 0 2 1

3 1 2 0 1

4 ←→ 0 1 1 0 ←→

The following figure illustrates only the essential pairs and the transitions visited when the algorithm takes advantage of the symmetry property.

←→ 0

1 0

1 2 0

←→ 0 1 1 0 ←→

N

Documentos relacionados