Lavall Sylvain

Christophe Ée

Vladimir Reutenauer

Dominique Retakh

Perrin
email: perrin@univ-mlv.fr

Dominique Perrin

CODES AND NONCOMMUTATIVE STOCHASTIC MATRICES

Given a matrix over a skew field fixing the column t (1, . . . , 1), we give formulas for a row vector fixed by this matrix. The same techniques are applied to give noncommutative extensions of probabilistic properties of codes.

Basics

Langages and codes.

A language is a subset of a free monoid A * ; the latter is generated by the alphabet A. A language is rational if it is obtained from finite languages by the operations (called rational) union, product (concatenation) and star. The product of two languages

It is well-known that rational languages may be obtained by using only unambiguous rational operations; these are: disjoint union, unambiguous product (meaning that if w ∈ L 1 L 2 , then w has a unique factorization w = w 1 w 2 , w i ∈ L i ) and the star L * restricted to languages which are codes, or equivalently bases of free submonoids of A * . 2.2. Series. By a series we mean an element of the Q-algebra of noncommutative series Q A , where A is a set of noncommuting variables. A rational series is an element of the least subalgebra of Q A , which contains the Q-algebra of noncommutative polynomials Q A , and which is closed under the operation

Introduction

By a noncommutative stochastic matrix we mean a square matrix S = (a ij ) 1≤i, j≤n over a skew field, satisfying n j=1 a ij = 1 for any i; in other words, the row-sums are all equal to 1. Equivalently the vector t (1, . . . , 1) is fixed by S. We are answering here the following problem: find a row vector fixed by S.

In the commutative case, formulas are known. They occur in probability theory, where this problem is relevant. Indeed, it amounts to finding the stationary distribution of the finite Markov chain whose transition matrix is S. See Appendix 1 for details.

But this problem may also be considered as a problem of noncommmutative linear algebra: given a square matrix over some skew field, which has a given column as eigenvector for some eigenvalue, find a corresponding row vector. It is easy to reduce this general problem to the previous one, where the eigenvector is t (1, . . . , 1) and the eigenvalue is 1.

In order to give formulas, which necessarily involve inverses of elements of the skew field and thus may be undefined, we take a generic noncommutative stochastic matrix : this is the matrix (a ij ) of noncommuting variables a ij subject only to the condition that this matrix fixes t (1, . . . , 1).

We seek now a row vector fixed by the matrix. We work in the free field generated by these variables (in the sense of Paul Cohn), which we call the stochastic free field. The formula giving the row eigenvector uses the theory of variable-length codes. Considering the complete digraph on the set {1, . . . , n}, let M i be the set of paths from i to i. This is a free monoid and its basis C i is a prefix code. Let P i be the set of proper prefixes of C i , that is, the paths starting from i and not passing through i again. We identify P i with the noncommutative power series which is equal to the sum of all the words in P i and we still denote this series by P i . Then we show that the elements P -1 i can be evaluated in the stochastic free field and that the vector (P -1 1 , . . . , P -1 n ) is fixed by our matrix; moreover, the P -1 i sum to 1, hence they form a kind of noncommutative limiting probability. See Theorem 1 and Example 1 to have a flavor of the result.

The second part of the article deals with general variable-length codes, not necessarily prefix. One motivation is the fact that the proofs are quite similar. The other motivation is that we obtain noncommutative generalization of well-known probabilistic results in the theory of codes, mostly due to Schützenberger (see [START_REF] Berstel | Theory of Codes[END_REF] and [START_REF] Berstel | Codes and automata[END_REF]), who generalized the recurrent events of Feller.

In Appendix 1, we review the commutative case. In Appendix 2, we show how the theory of quasideterminants may be used to obtain our results on noncommutative stochastic matrices.

this is a well-formed expression involving scalars, letters (elements of A), products and star operations, the latter restricted to series with 0 constant term. We say that a * -rational expression is positive if the scalars involved are all ≥ 0.

Let L be a rational language. Since L may be obtained by unambiguous rational expressions, it follows that its characteristic series w∈L w ∈ Q A is rational. We shall identify a language and its characteristic series. For all this, see [START_REF] Berstel | Rational Series and Their Languages[END_REF] or [START_REF] Berstel | Noncommutative rational Series with Applications[END_REF].

2.3. Free fields. The ring Q A rat contains Q A ; it is not a skew field. There exist skew fields containing Q A . Among them is the so called free field. We denote it F. It is generated by Q A and has the following universal property (which characterizes it): for each Q-algebra homomorphism µ : Q A → D, where D is a skew field, there exists a Q-subalgebra O µ of F and a homomorphism µ : O µ → D, extending µ and such that

f ∈ O µ , µf = 0 ⇒ f -1 ∈ O µ .
The free field F is also characterized by the following property: say that a square matrix M ∈ Q A n×n is full if there exists no factorization

M = P Q, P ∈ Q A n×r , Q ∈ Q A r×n , with r < n.
Then the square matrices over Q A which are invertible in F are exactly the full matrices. See [START_REF] Cohn | Free Rings and Their Relations[END_REF]. By a rational expression over Q A we mean a well-formed expression involving elements of Q A and the operations sum, product and inversion. Such an expression can be naturally evaluated in the free field F, provided one never inverts 0. For example, (a + b -1 ) -1 can be evaluated in the free field whereas (ab -(b -1 a -1 ) -1 ) -1 cannot. If rational expression can be evaluated in the free field, we say it is evaluable.

We shall consider also rational expressions over any skew field D, and say that such an expression is evaluable if it can be evaluated without inversion of 0. If the elements of D appearing in the rational expression are actually in a subring R of D, we say that the expression is over R.

There is a canonical embedding of Q A rat into F, which can be seen as follows: let S be any rational series; it has a * -rational expression; replace in it the operation T * by (1 -T ) -1 ; then one obtains a rational expression in F, which is evaluable and represents the image of S under the embedding Q A rat ֒→ F. Thus, each rational language and each rational series is an element of the free field. See [START_REF] Fliess | Sur le plongement de l'algèbre des séries rationelles non commutatives dans un corps gauche[END_REF]. In this way, each * -rational expression is equivalent to a evaluable rational expression over Q A .

In the sequel, we use the notation x * for (1 -x) -1 , when x is in a ring and 1 -x is invertible.

2.4.

The derivation λ of the free field. There is a unique derivation λ of Q A such that λ(a) = a, for any a ∈ A. It maps each word w ∈ A * onto |w|w, where |w| is the length of w. It has a unique extension to the free field F, which we still denote λ. Indeed, this follows from T h.7.5.17, p.451 in [START_REF] Cohn | Free ideal rings and localization in general rings[END_REF]; see also [START_REF] Cohn | From Hermite rings to Sylvester domains[END_REF].

D(t) with a subset of D((t)). A series S ∈ D[[t]] is called rational if S is in D(t). The ring of rational series is denoted by D[[t]] rat . Thus D[[t]] rat = D[[t]] ∩ D(t).

Each polynomial P ∈ D[t] may uniquely be written

P = (1 -t) n Q, with n ∈ N, Q ∈ D[t] and Q(1) = 0. Thus if S ∈ D(t), one has S = (1-t) n QR -1 , with n ∈ Z, Q, R ∈ D[t] and Q(1), R (1)
= 0. We say that S is evaluable at t = 1 if n ≥ 0, and in this case, its value at t = 1 is Q(1)R(1) -1 if n = 0, and 0 if n ≥ 1. This value is a well-defined element of D, which does not depend on the fraction chosen to represent S.

We extend this to matrices: a matrix over D(t) is said to be evaluable at t = 1 if all his entries are, and then its value at t = 1 is defined correspondingly.

Consider a rational expression E(t) over the skew field D(t). We obtain a rational expression over the skew field D by putting t = 1 in E(t). Suppose that the rational expression E(1) obtained in this way is evaluable in D and evaluates to α ∈ D; then the rational expression E(t) is evaluable in D(t), evaluates to an element P (t)Q(t) -1 in D(t), with P, Q ∈ D[t], and P Q -1 is evaluable at t = 1 with value α ∈ D. The standard details are left to the reader.

2.6. Central eigenvalues of matrices over a skew field. Let M be a square matrix over D. Then 1 -M t is invertible over D[[t]], hence over D((t)). Since D(t) is a skew field, contained in D((t)), and containing the coefficients of 1 -M t, the coefficients of its inverse (tM ) * = (1 -tM ) -1 lie also in D(t) and finally in D[[t]] rat . Recall that a square matrix over a skew field is left singular (that is, has a nontrivial kernel when acting at the left on column vectors) is and only if it is right singular. Thus M has an eigenvector for the eigenvalue 1 at the left if and only if it holds on the right.

By the multiplicity of the eigenvalue 1 of M we mean the maximum of the nullity (that is, dimension of kernel) of the positive powers of 1-M . Observe that this coincides with the usual multiplicity (of 1 in the characteristic polynomial) if D is commutative. Note that the same properties hold for any nonzero central eigenvalue λ by considering 1 -λ -1 M ; we treat only the case λ = 1 for the future application. Lemma 1. Let M be a square matrix over the skew-field D and t be a central variable.

(i) M has the eigenvalue 1 if and only if (1 -tM ) -1 is not evaluable at t = 1.

(ii) If M has the eigenvalue 1 with multiplicity 1, then (1 -t)(1 -tM ) -1 is evaluable at t = 1, is nonnull and its rows span the eigenspace for the eigenvalue 1.

Proof (i) Suppose that M has the eigenvalue 1. Then M is conjugate over D to a matrix of the form

N = 1 0 P Q , where Q is square. Then, computing in D[[t]], we have (1-tN ) -1 = (1 -t) -1 0 × ×
. This is clearly not evaluable for t = 1, and therefore (1 -tM ) -1 is also not evaluable for t = 1. Conversely, suppose (1 -tM ) -1 is not evaluable for t = 1. Then, we have

(1 -tM ) -1 = ((1 -t) n ij P ij /Q ij ) i, j , with P ij , Q ij ∈ D[t], P ij (1), Q ij (1) = 0, n ij ∈ Z
and some n ij < 0. Let -n be the minimum of the n ij . Then n > 0 and (1 -t) n (1 -tM ) -1 is evaluable at t = 1 and its value P at t = 1 is nonnull. Now, we have

(1 -tM ) -1 = 1 + (1 -tM ) -1 tM, thus (1 -t) n (1 -tM ) -1 = (1 -t) n + (1 -t) n (1 -tM ) -1 tM.
Since n > 0, we obtain for t = 1:

P = P M,
which shows that M has the eigenvalue 1, since each row of P is fixed by M and P = 0.

(ii) We write as before N = 1 0 P Q , where N is conjugate to M over D.

Then (1 -tN ) -1 = (tN ) * = t * 0 (tQ) * tP t * (tQ) * .
We claim that (tQ) * is evaluable at t = 1. Indeed, otherwise, by (i), Q has the eigenvalue 1 and is conjugate to a matrix N = 1 0 R S , S square. Then

M is conjugate to N =   1 0 0 × 1 0 × R S 
 and the square of 1 -M has nullity ≥ 2, contradiction. Now, we see that

(1 -t)(tN ) * = 1 0 (tQ) * tP (1 -t)(tQ)
* is evaluable at t = 1 and that its value at t = 1 is nonnull. Thus, by the first part of the proof, its rows span the eigenspace for the eigenvalue 1.

Generic noncommutative stochastic matrices

3.1. Generic matrices. Let M = (a ij ) 1≤i, j≤n be a generic noncommutative matrix ; in other words, the a ij are noncommuting variables. We denote by F the corresponding free field. Associated to M is the matrix S: it is the same matrix, but this time we assume that the a ij are noncommuting variables subject to the stochastic identities

(1) ∀i = 1, . . . , n, n j=1 a ij = 1.
In other words, the row sums of S are equal to 1; equivalently, S has t (1, . . . , 1) as column eigenvector with the eigenvalue 1. We call S a generic noncommutative stochastic matrix. The algebra over Q generated by its coefficients (hence subject to the relations (1)) is a free associative algebra, since it is isomorphic with Q a ij , i = j . Indeed, we may eliminate a ii using (1). We denote this algebra by Q a ij /(1) , referring to the relations (1). Hence there is a corresponding free field, which we call the stochastic free field, denoted S.

3.2.

Existence of elements and identities in the stochastic free field.

We want to verify that certain rational expressions make sense in the stochastic free field S. For example, anticipating on the example to come, we want to show that (1

+ bd * ) -1 = (1 + b(1 -d) -1 ) -1 makes sense in S (hence under the hypothesis a + b = c + d = 1
). It is necessary to take care of this existence problem, since otherwise, one could invert 0 (and our proved identities will be meaningless). The idea is to prove the existence of certain specializations of the variables, compatible with the identities in S (identities (1) above), such that the specialized rational expression makes sense.

In our example, we could take b = 0: then bd * specializes to 0 and 1 + bd * to 1, hence (1 + bd * ) -1 is evaluable under the specialization. A fortiori, since S is a free field, (1 + bd * ) -1 is evaluable in S.

By a Bernouilli morphism we mean a Q-algebra morphism π of the free associative algebra Q a ij into R such that (i) for any i = 1, . . . , n, n j=1 π(a ij ) = 1; (ii) π(a ij ) > 0, for any i, j = 1, . . . , n.

Clearly, such a morphism induces naturally a Q-algebra morphism form Q a ij /(1) into R.

Lemma 2. There exists a subring S π of the stochastic free field S such that

(i) S π contains Q a ij /(1) ; (ii) there is an extension of π to S π (we still denote it by π); (iii) if f ∈ S π and π(f ) = 0, then f -1 ∈ S π .
Proof This is a consequence of the fact that S is a free field, corresponding to the free associative algebra Q a ij /(1) , hence is the universal field of fractions of Q a ij /(1) . This implies that there exists a specialization S → R extending π : Q a ij /(1) → R, and the lemma follows from [9] 7.2 and Cor. 7.5.11.

Corollary 1. Suppose that π is a Bernouilli morphism and that S = w∈L w, where L is a rational subset of the free monoid {a ij } * such that w∈L π(w) < ∞. Then any positive * -rational expression for S is evaluable in the stochastic free field S.

Proof This is proved inductively on the size of the rational expression for S. Note that for each subexpression and corresponding series S ′ , π(S ′ ) converges and is > 0. Hence, we apply inductively the lemma and see that for each subexpression, the corresponding element is in S π .

Lemma 3. Let S be a * -rational series in Q a ij having a * -rational ex- pression which is evaluable in S. Then it is evaluable in the free field F. If moreover S = 0 in F, then S = 0 in S.
Proof There exists a specialization F → S, since F is the universal field of fractions of Q a ij , see [START_REF] Cohn | Free Rings and Their Relations[END_REF] chapter 7. Hence there is a subring H of F and a surjective Q-algebra morphism σ : H → S such that:

∀ f ∈ H, σf = 0 ⇒ f -1 ∈ H, and such that H contains Q a ij .
We may therefore prove, by induction on the size of the rational expression, that S exists in H and that σ(S) is the element of S defined by the rational expression. It follows that, if S = 0 in F, then S = 0 in S.

3.3.

Paths. Each path in the complete directed graph with set of vertices {1, . . . , n} defines naturally an element of the free associative algebra Q a ij , hence of the free field F. This is true also for each rational series in Q a ij .

We define now several such series. First, consider the set of nonempty paths i → i which do not pass through i; we denote by C i the sum in Q a ij of all the corresponding words. It is classically a rational series, and thus defines an element of the free field F. Now, let P i be the sum of the paths (that is, the corresponding words) from i to any vertex j, which do not pass again through i; this set of words is the set of proper prefixes of the words appearing in C i . Likewise, P i defines an element of F.

Example 1. M = a b c d . The graph is 1 2 a d b c Then C 1 = a + bd * c, C 2 = d + ca * b, P 1 = 1 + bd * , P 2 = 1 + ca * . 3.4. Results.
Theorem 1. The elements P i can be evaluated in the stochastic free field S and (P -1 1 , . . . , P -1 n ) is a left eigenvector of the noncommutative generic stochastic matrix S. Moreover, in S, (i)

n i=1 P -1 i = 1;
(ii) C i can be evaluated in S and is equal to 1; (iii) λ(C i ) can be evaluated in S and is equal to P i .

Here λ is the unique derivation of the free field F which extends the identity on the set {a ij }.

Exemple 1. (continued) We verify that (P

-1 1 , P -1 2 ) a b c d = (P -1 1 , P -1 2 ). It is enough to show that P -1 1 a + P -1 2 c = P -1 1 . This is equivalent to P -1 2 c = P -1 1 (1 -a) ⇔ c -1 P 2 = a * P 1 ⇔ c -1 + a * = a * + a * bd * .
Now, we take the stochastic identities:

a + b = 1 ⇒ 1 -a = b ⇒ a * = b -1 ⇒ a * b = 1, c + d = 1 ⇒ d * = c -1 .
Thus, we may conclude.

(i) Similarly:

P -1 1 + P -1 2 = 1 ⇔ P 2 + P 1 = P 1 P 2 ⇔ 2 + bd * + ca * = 1 + bd * + ca * + bd * ca * and we conclude since d * c = ba * = 1. (ii) In S, C 1 = a + bd * c = a + b = 1. (iii) In F, λ(C 1 ) = a + bd * c + bλ(d * )c + bd * c, since λ is a derivation such that λ(b) = b and λ(c) = c. Now λ(d * ) = λ((1 -d)) -1 = -(1 -d) -1 λ(1 -d)(1 -d) -1 = d * dd * .
Thus, this time in S,

λ(C 1 ) = a + 2bd * c + bd * dd * c = a + 2b + bd * d = a + b + b(1 + d * d) = 1 + bd * = P 1 . 3.
T = N 0 λ 1 ,
where

n ij = a ij -a nj for 1 ≤ i, j ≤ n -1 and λ j = a nj for j = 1, . . . , n -1. We claim that N -1 is inversible in S. It is enough to show that it is full in Q a ij /(1) . Suppose that N -1 is not full: then N -1 = P Q, with P, Q over Q a ij /(1) of size n × (n -1
) and (n -1) × n. By replacing a nj by 0 and a ii by a ii + 1, we find that the matrix (

a ij ) 1≤i, j≤n-1 is nonfull over Q a ij , 1 ≤ i, j ≤ n -1 , which is absurd, since it is a generic matrix.
Thus N -1 is inversible, and no power of it has a kernel. Consequently, the positive powers of T -1 have all rank n -1. Therefore the multiplicity of 1 as eigenvalue of T , hence of S, is 1.

Proof of Theorem 1

Let us identify paths in the complete directed graph on {1, . . . , n}, and corresponding words in the free monoid {a ij } * . We identify also an infinite sum of paths with the corresponding series in Q a ij . Let P ij denote the set of paths from i to j that do no pass through i again. We therefore have P i = j P ij . Denote by D(u 1 , . . . , u n ) the diagonal matrix whose diagonal elements are u 1 , . . . , u n . Observe that each path from i to j may be decomposed as the concatenation of a path from i to i (thus, an element of C * i ) and a path from i to j that does not pass again through i (thus, an element of P ij ). Since (M * ) ij is the sum of all paths from i to j, we obtain the identity in Q a ij : (M * ) ij = C * i P ij . Thus we have the matrix identity:

M * = D(C * 1 , . . . , C * n )(P ij ). Now P ii = 1 and P ij has no constant term. Hence (P ij ) is invertible over Q a ij . Inverting, we obtain D(C 1 -1, . . . , C n -1) = (P ij )(M -1), since M * = (1 -M ) -1 and similarly C * i = (1 -C i ) -1 .
If we multiply by the column vector γ = t (1, . . . , 1), we obtain

t (C 1 -1, . . . , C n -1) = (P ij ) (M -1) γ.
This equality holds in Q a ij , and actually, in its subalgebra of rational series, since C i , P ij are rational series. Hence it holds in the free field F.

We also obtain, applying the derivation λ of F:

t (λ(C 1 ), . . . , λ(C n )) = (λ(P ij )) (M -1) γ + (P ij ) M γ.
Now, we claim that C i , P ij and λ(C i ) can be evaluated in the stochastic free field S. Thus, since M γ = γ in S, we obtain that in S :

t (C 1 -1, . . . , C n -1) = 0, and t (λ(C 1 ), . . . , λ(C n )) = (P ij ) γ = t (P 1 , . . . , P n ),
which proves parts (ii) and (iii) of the theorem.

In order to prove the claim, we take a Bernouilli morphism π. Let i be some element of {1, . . . , n} and consider the set E of paths not passing through i. Then π(E) < ∞ since the matrix N , which is obtained from M by removing row and column i, satisfies: π(N ) has row sums < 1. It follows that π(C i ), π(P ij ) are finite. For λ(C i ), it is easy to see inductively on the size of a rational expression of C i that, since C i can be evaluated in S, so is λ(C i ); one has simply to use the identity λ(H * ) = H * λ(H) H * . Note also that π(P i ) > 0, hence P i is nonzero in S, and P -1 i is an element in S, by Corollary 1.

We now prove (i). Let Q i denote the set of paths from 1 to some vertex, that do not pass by i; in particular, Q 1 = 0. Then, for any i, j, we have

(M * ) 1i P i + Q i = (M * ) 1j P j + Q j ,
since both sides represent all the paths departing from 1. Let t be a central variable. Replacing each path w by t |w| w and writing correspondingly P 1 (t), . . . , P n (t), we obtain

(tM ) * 1i P i (t) + Q i (t) = (tM ) * 1j P j (t) + Q j (t). This holds in Q A [[t]
] and actually in its subalgebra of rational elements Q A [[t]] rat . Now, we have canonical homomorphisms (see 2.5 and 2.7)

Q A [[t]] rat → Q A/(1) [[t]] rat → S[[t]] rat → S(t).
The composition maps the matrix M onto S. Hence, we have in S(t)

(tS) * 1i P i (t) + Q i (t) = (tS) * 1j P j (t) + Q j (t)
, where we keep the notation P i (t) ∈ S(t) for the image under the composition. Observe that P i , by Cor. 1, has a rational expression which can be evaluated in S. Hence P i (t) can be evaluated for t = 1 and equal to P i . Similarly, Q i (t) can be evaluated for t = 1 and evaluates to Q i .

Multiply the last equality by 1 -t. By Lemma 4, (1 -t) (tS) * 1i can be evaluated for t = 1 and is equal to α i say. Thus, we obtain

α i P i = α j P j .
Now (tS) * = 1 + (tS) * tS, so that, putting t = 1, we obtain that each row of (1 -t)(tS) * | t=1 is fixed by S. In particular, so is (α 1 , . . . , α n ). Since by Lemma 4, (1 -t)(tS) * | t=1 is nonzero, some row of it is nonzero, and by symmetry, each row is nonzero. Hence, since we already know that each P i is nonzero in S, we see that each α i is = 0. Thus, since

P -1 i α -1 i = P -1 1 α -1 1 , (P -1 1 , . . . , P -1 n ) = P -1 1 α -1 1 (α 1 , . . . , α n ), which shows that (P -1 1 , . . . , P -1 n ) is fixed by S. Now n i=1 (M * ) 1i = M * 11 P 1
, since both sides represent the paths departing from 1. Thus we deduce that n i=1 α i = α 1 P 1 in S, by the same technique as above. Thus

n i=1 P -1 i = n i=1 P -1 1 α -1 1 α i = 1.

Unambiguous automata

4.1. Unambiguous automata. An unambiguous automata is equivalent to a multiplicative homomorphism µ from the free monoid A * into Q n×n such that each matrix µw, w ∈ A * , has entries in {0, 1}. This may be expressed by associating to µ the directed graph with edges labelled in A with vertices 1, . . . , n, and edges i a / / j if and only if (µa) ij = 1. Then the non-ambiguity means that for any vertices i, j and any word w, there is at most one path from i to j labelled w (the label of a path is the product of the label of the edges). The matrix of the automaton is by definition M = a∈A a µa.

We say that the unambiguous automaton is complete if the zero matrix does not belong to the monoid µA * . Equivalently, for each word w there is some path labelled w. We say that the automaton is transitive is the underlying graph is strongly connected. This means that for any vertices i, j, there is some path i → j; equivalently, (µw) ij = 0 for some word w.

The monoid µA * is finite. Hence it has a unique minimal ideal I. There is a rank function on µA * , and the elements of minimum rank are precisely the elements of I. Since µA * ⊆ {0, 1} n×n , the rows of an element in µA * are ordered by inclusion (by identifying a subset of {1, 2, . . . , n} and its characteristic row vector). It is shown that the nonzero rows of elements of the minimal ideal are precisely the maximal rows of elements of µA * . Similarly for columns. The ideal I is the disjoint union of the minimal right (resp. left) ideals of µA * , and the intersection of a minimal left and a minimal right ideal is a group. For this, see [START_REF] Berstel | Theory of Codes[END_REF] Chapter V I, and [START_REF] Berstel | Codes and automata[END_REF] Chapter V I, especially Exercice 3.4 and also [START_REF] Béal | Unambiguous automata[END_REF].

We shall use the following result Proposition 1. Let c be a maximal column and R be the sum of the distinct rows of some element in the minimal ideal. Then Rc = 1.

Proof There exist x, y in I such that c is a column of x and R is the sum of the distinct rows of y. The element xy is in I and belongs therefore to a group with neutral element e, say. Then e has a column-row decomposition e = st, where s (resp. t) is a n × r (resp. r × n) matrix with entries in {0, 1}, with r the minimal rank of µA * , where ts = I r (the identity matrix), and where the set of nonzero rows of e is the set of rows of t, which has distinct rows, and similarly for the columns of s (see [START_REF] Berstel | Theory of Codes[END_REF] Prop. IV.3.3 or [START_REF] Berstel | Codes and automata[END_REF], Prop.

VI.2.3).

Now, xM is a minimal right ideal of µA * , containing e, hence xM = eM and therefore x = em = stm. Hence c is a sum of columns of s, and since c is a maximal column, c is a column of s. Similarly, y = nst and each nonzero row of y is a row of t. We have also e = n ′ y, hence each nonzero row of t, being a row of e, is a row of y. Thus R is the sum of the rows of t: R = λt, with λ = (1, . . . , 1). Finally Rc = λtc and since ts = I r and c is a column of s, tc is a column of I r and λtc = 1.

Example 2.

The unambiguous automaton is The associated representation µ is defined by

µa =   0 1 0 1 0 1 0 0 0   , µb =   0 0 1 1 0 1 1 0 0   , µc =   1 0 1 1 0 1 0 0 0   .
The matrix of the automaton is The maximal rows are (1, 0, 1) and (0, 1, 0) and the maximal columns are t (1, 1, 0) and t (0, 1, 1).

M =   c a b + c a + b + c 0 a + b + c b 0 0  

4.2.

Codes. Recall that a code is the basis of some free submonoid of the free monoid. Given an unambiguous automaton with associated representation µ, and some vertex i, the language {w ∈ A * | (µw) ii = 1} is a free submonoid of A * ; we denote by C i its unique basis, which is therefore a code. This code is moreover rational. Explicitly, C i is the set of labels of paths i → i which do not contain i as internal vertex. Note that C i is a rational code and that each rational code is obtained in this way. We shall use also the set P i of labels of paths starting at i and not passing again through i.

See [START_REF] Berstel | Theory of Codes[END_REF].

Example 2. (continued) Write A = a + b + c, then C 1 = c + aA(1 + Ab) + (b + c)b, C 2 = A(c + b 2 + cb) * a + Ab(c + b 2 + cb) * a, C 3 = b(c + aA) * (b + c + aA), P 1 = 1 + a + aA + b + c, P 2 = 1 + A(c + b 2 + cb) * (1 + b + c) + A(1 + b(c + b 2 + cb) * (b + c)) + Ab(c + b 2 + cb) * , P 3 = 1 + b(c + aA) * (1 + a).
We shall use the following property of rational maximal codes: let C be such a code; then there exists rational languages P, S, F , whose elements are factors of words of C, such that in Q A A * = SC * P + F. Moreover 1 ∈ F , 1 ∈ S, 1 ∈ P . This property is proved in [START_REF] Berstel | Codes and automata[END_REF] Lemma XII.4.3 for finite codes. The proof is extended straightforward to rational codes.

Bernouilli morphisms. A Bernouilli morphism is a multiplicative morphism

π : A * → R + such that π | A is a probability on A such that π(a) > 0 for any a in A.
It is known that if L is a language having the property that it does not intersect some ideal in A * , then π(L) = w∈L π(w) < ∞. This property is true if L is rational code. See [START_REF] Berstel | Theory of Codes[END_REF] Prop. I.5.6 and Prop. I.5.12.

From this, we deduce that π(L) < ∞ for each language L = C i , P i , S, P, F considered in Section 4.2. 4.4. Probabilistic free field. We know that Q A is embedded in the corresponding free field denoted F. Consider now the Q-algebra Q A /A -1, which is the quotient of Q A by its two-sided ideal generated by A -1 = a∈A a -1. This Q-algebra is a free associative algebra, since the relation A = 1 allows to eliminate one variable. We denote it Q A/(A -1) Hence, there is a corresponding free field, denoted P and which we call the probabilistic free field.

Theorem 2. Let µ : A * → Q n×n be the homomorphism corresponding to a complete and transitive unambiguous automaton. Let M = a∈A aµa be its matrix, P the image of M in the probabilistic free field P, C i the code generating the fixpoints of vertex i, P i the sum of the labels of all paths starting at i and not passing again through i. Then P i , C i and P -1 i can be evaluated in P. Moreover, the following equalities hold in P:

(i)

C i = 1; (ii) (1 -t)(tP ) * ∈ P(t) can be evaluated at t = 1 and its diagonal elements are λ(C i ) -1 , i = 1, . . . , n. (iii) (P -1 1 , . . . , P -1 n )P = (P -1 1 , . . . , P -1 n ); (iv)
n i=1 P -1 i = 1;
(v) for any maximal columns ℓ, ℓ ′ , (P -1 1 , . . . , P -1

n ) ℓ = (P -1 1 , . . . , P -1 n ) ℓ ′ . Example 2. (continued) C 1 = 1 holds in P, since one has, even in Q A : C 1 -1 = (1 + a)(a + b + c -1)(1 + b). Moreover, we have in P C 2 = (c + b 2 + cb) * a + b(c + b 2 + cb) * a = (1 + b)(c + b 2 + cb) * a. Now, in Q b, c , one has (1 + b)(c + b 2 + cb) * = (b + c) * , since {c, b 2 ,
cb} is a complete suffix code with set of suffixes {1, b} (see [START_REF] Berstel | Theory of Codes[END_REF]). Thus

C 2 = (b + c) * a = 1 since a = 1 -b -c. Also, C 3 = b(c + a) * (b + c + a) = b(c + a) * = 1. In P, we have S =   c a b + c 1 0 1 b 0 0   .
We show that P 2 = a -1 P 1 ; indeed

P 2 = 1 + (c + b 2 + cb) * (1 + b + c) + 1 + b(c + b 2 + cb) * (b + c) + b(c + b 2 + cb) * = 2 + (1 + b)(c + b 2 + cb) * (1 + b + c) = 2 + (b + c) * (1 + b + c) = 2 + (b + c) * + (b + c) * (b + c) = 1 + 2(b + c) * = 1 + 2a -1 = a -1 P 1 , since P 1 = 2 + a. We deduce that P -1 1 a = P -1 2 . Moreover P 3 = 1 + b(c + a) * (1 + a) = 2 + a = P 1 , since b(c + a) * = 1. Thus P -1 1 (b + c) + P -1 2 = P -1 1 (a + b + c) = P -1 1 = P -1 3 , P -1 1 c + P -1 2 + P -1 3 b = P -1 1 (c + a + b) = P -1 1 .
This shows that (P -1 1 , P -1 2 , P -1 3 )S = (P -1 1 , P -1 2 , P -1 3 ). Furthermore, P -1 1 + P -1 2 + P -1 3 = P -1 1 (1 + a + 1) = 1. Now, the only two maximal columns are t (1, 1, 0) and t (0, 1, 1). We have (P -1

1 , P -1 2 , P -1 3 )   1 1 0   = (P -1 1 , P -1 2 , P -1 3 )   0 1 1   since P 1 = P 3 .
4.5. Proof of theorem. We need the following lemma.

Lemma 5. Let P = a∈A aµa ∈ P n×n be the image in P n×n of the matrix M of some complete and transitive unambiguous automaton, with associated homomorphism µ : A * → Q n×n . Then P has the eigenvalue 1 with associated eigenspace of dimension 1. Moreover, if t is a central variable, then in P(t), (1 -t)(tP ) * can be evaluated for t = 1 and its rows span the eigenspace above.

Proof Consider the (left) P-subspace E of P 1×n spanned by the maximal rows. It has as subspace the subspace E ′ spanned by the differences of such rows. Let C be the sum of the distincts columns of some element of the minimal ideal of µA * . Then rC = 1 if r is a maximal row (dual statement of Prop. 1). Thus E ′ is strictly included in E.

By Section 4.1, for each maximal row r and each a ∈ A, rµa is a maximal row, denoted r a . Then

rP = a∈A r(µa)a = a∈A r a a = r + a∈A (r a -r)a,
since a∈A a = 1 in P. Thus r is fixed by P modulo the subspace E ′ . Hence P has 1 as eigenvalue.

We show that its multiplicity is 1. Indeed the multiplicity does not decrease under specialization. For the latter, we take a positive Bernouilli morphism π; then π(P ) is an irreducible matrix because the automaton is transitive; it has nonnegative coefficients. We claim that its eigenvalues are of module ≤ 1. Thus, we may apply the Perron-Frobenius theorem ( [START_REF] Lancaster | Theory of matrices[END_REF] Section 15.3 Th.1) and, since 1 is an eigenvalue of π(P ) by the previous calculations, it is a root of multiplicity 1 of the characteristic polynomial. But we know that 1 is an eigenvalue of P , hence it has multiplicity 1. We conclude by using Lemma 1.

It remains to prove the claim. Since the automaton is unambiguous, the matrix M n = a∈A aµa n = w∈A n wµw has the property that each entry is a subsum of w∈A n w. Hence each entry of π(M n ) = π(P n ) is bounded by 1. Hence each eigenvalue of π(P ) has module ≤ 1.

Proof of Theorem 2

C i is a rational maximal code. So we may use the result at the end of Section 4.2: A * = SC * i P + F , where S, P, F are rational languages contained in the set of factors of C i . Then, by Section 4.3., π(S), π(P ) and π(F ) are < ∞ for any Bernouilli morphism. This implies that S, P, F can be evaluated in P (cf. the proof of Corollary 1). The same holds for C i and P i . Now the equality in Q A above may be rewritten:

A * -F = SC * i P ⇒ 1 -(1 -A) F = (1 -A) SC * i P ⇒ (1 -(1 -A) F ) -1 = P -1 (1 -C i )S -1 A * ⇒ 1 -C i = P (1 -(1 -A) F ) -1 (1 -A)S.
This holds in Q A rat and all these rational expressions can be evaluated in P. Thus, in P, we obtain 1 -C i = 0. Let Q i be the set of paths from 1 to any vertex, that do not pass again through i. Then we have, as in the proof of Th. 1, for any i, j,

(M * ) 1i P i + Q i = (M * ) 1j P j + Q j .
Arguing as in the latter proof, we find that, denoting α i the value of (1t)(tP ) * 1i at t = 1 (which exists by Lemma 5), we obtain α i P i = α j P j .

t (1, . . . , 1). This theorem is attributed to Kirchoff by Persi Diaconis, who gives a probabilistic proof of it (see [START_REF] Broder | Generating random spanning trees[END_REF] p. 443 and 444). See also [START_REF] Anantharam | A proof of the Markov chain tree theorem[END_REF], [START_REF] Aldous | The random walk construction of uniform spanning trees and uniform labelled trees[END_REF].

The Markov chain tree theorem is as follows: let (a ij ) be a stochastic matrix (that is, fixing t (1, . . . , 1)). Then the row vector (b 1 , . . . , b n ) is fixed by this matrix, where b i is the sum of the weights of all spanning trees of the complete digraph on {1, . . . , n}, rooted at i (the edges of the tree all pointing toward i). Here the weight of a subgraph is the product of the a ij , for all edges (i, j) in the subgraph.

Using our Theorem 1, one easily deduces that B = n i=1 b i , the sum of the weights of all rooted trees, is equal to the derivative of det(1 -(a ij )), with respect to the derivation fixing each a ij . 6. Appendix 2: Quasideterminants of stochastic matrices 6.1. Theory of quasideterminants. The theory of quasideterminants was developed as a tool for linear algebra over noncommutative rings replacing the theory of determinants over commutative rings. Quasideterminants were introduced in [START_REF] Gelfand | The determinants of matrices over noncommutative rings[END_REF] and developed in [START_REF] Gelfand | The theory of noncommutative determinants and characteristic[END_REF], [START_REF] Gelfand | A theory of noncommutative determinants and characteristic functions of Graphs, I[END_REF], [START_REF] Gelfand | Quasideterminants I[END_REF] and [START_REF] Gelfand | Quasideterminants[END_REF]. Let R be an associative unital ring and let A = (a ij ), i, j = 1, 2, . . . , n be a matrix over R. Denote by A ij the submatrix of A obtained from from A by deleting its i-th row and its j-th column. Set r i = (a i1 , a i2 , . . . , âij , . . . , a in ) and c j = (a 1j , a 2j , . . . , âij , . . . , a nj ). Recall, that for any matrix C we denote by t C the transposed matrix.

Definition. Suppose that the matrix A ij is invertible. Then the quasideterminant |A| ij is defined as

|A| ij = a ij -r i (A ij ) -1 c j .
Example. If n = 2, then |A| 12 = a 12 -a 11 a -1 21 a 22 .

Let matrix A be invertible and

A -1 = (b pq ). If the quasideterminant |A| ij is invertible then b ji = |A| -1 ij . In the commutative case, |A| ij = (-1) i+j det A/ det A ij .
It is sometimes convenient to use another notation for quasideterminants |A| ij by boxing the leading entry, i.e. We remind now the basic properties of quasideterminants (see [START_REF] Gelfand | The determinants of matrices over noncommutative rings[END_REF]). An equality |A| pq = |B| rs means that the first quasideterminant is defined if and only if the second quasideterminant is defined and that both quasideterminants are equal. The properties are:

(iii) Addition of rows and columns:

Let the matrix B be obtained from A by replacing the k-th row of A with the sum of k-th and l-th row, i.e. b kj = a

kj + a lj , b ij = a ij for i = k. Then |A| ij = |B| ij , i = 1, 2, . . . , k, . . . , n, j = 1, 2, . . . , n.
Let the matrix C be obtained from A by replacing the k-th column of A with the sum of k-th and l-th column, i.e.

c ik = a ik + a il , b ij = a ij , c ij = a ij for j = k. Then |A| ij = |C| ij , i = 1, 2, . . . , n, j = 1, 2, . . . , l, . . . n.
In [START_REF] Gelfand | The determinants of matrices over noncommutative rings[END_REF] a noncommutative analogue of the Cramer's rule for systems of left linear equations, i.e. the systems when coefficients are at the left of the unknowns, was formulated. The analogue for systems of right linear equations can be formulated as follows.

Let B = (b ij ) an n × n-matrix over R, ξ = (ξ i ) be a row-matrix over R and x = (x i ) be a row-matrix of unknowns. Here i, j = 1, 2, . . . , n. x i a ij = x j , j = 1, 2, . . . , n together the equation n i=1

x i = 1.

Then any of the n first equations of the system is a corollary of the other n equations.

Proof Take any 1 ≤ k ≤ n and add all equations (2) for j = k. The right hand side of the sum can be written as 1 -x k and the left hand side can be written as n i=1 x i (1 -a ik ). As a result we have

n i=1 x i (1 -a ik ) = 1 -x k which implies n i=1 x i a ik = x k .
The lemma is proved.

Theorem 3. Let A = (a ij ), i, j = 1, 2, . . . , n be a stochastic matrix. The system n i=1

x i a ij = x j , j = 1, 2, . . . , n, n i=1

x i = 1 has a unique solution over the algebra of series in variables a ij satisfying the relations n j=1 a ij = 1. The solutions are given by the formula

x -1 k = 1 + a ki 1 a i 1 i 2 a i 2 i 3 . . . a i s-1 is
where the sum is taken over all sets of naturals i 1 , i 2 , . . . , i s where s ≥ 1 and i p = k, p = 1, 2, . . . , s.

Proof Lemma 7 implies that x 1 , . . . , x n are solutions of the system n i=1

x i = 1, n i=1

x i (a ij -δ ij ) = 0, j = k.

Write the system in the form xB = ξ, where x = (x 1 , . . . , x n ) and ξ = (1, 0, . . . , 0), and apply Proposition 11. Note that |B(ξ, k)| k1 = 1: indeed, the k-th row of B(ξ, k) is ξ and therefore, by the definition of quasideterminants, r k = (0, . . . , 0) and |B(ξ, k)| k1 = B(ξ, k) k1 = 1. Therefore,

x k |B| k1 = 1.
Recall that A kk is the submatrix of A obtained from A by omitting its k-th row and k-th column. Set C = A kk . Let I be the unit matrix of order n -1 and a(k) = (a k1 , a k2 , . . . , âkk , . . . , a kn ). Note that the first column of matrix B is γ = t (1, 1, . . . , 1). By the definition of quasideterminants

|B| k1 = 1 -a(k)(C -I) -1 γ = 1 + ∞ p=0 C p = 1 +
a ki 1 a i 1 i 2 a i 2 i 3 . . . a i s-1 is .

This proves the theorem.

Remark 1. Note that monomials a ki 1 a i 1 i 2 . . . a i s-1 is can be interpreted as paths in the complete graph with vertices 1, 2, . . . , n. Theorem 4. Let A = (a ij ), i, j = 1, 2, . . . , n annihilate the column vector t (1, 1, . . . , 1). Assume that all quasideterminants |A ii | jj = are defined for i = j. Then xA = 0 where x = (x 1 , x 2 , . . . , x n ) if and only if

x i |A jj | ii = x j |A ii | jj , i = j.
Remark 2. In the commutative case |A ii | jj = det A ii / det A ij,ij provided that the denominator is defined. Here A ij,ij is the submatrix of A obtained from A by removing its rows and columns with the indices i and j. Thus the theorem implies

x i m j = x j m i where m i 's are the main minors of the matrix and we may choose x i = m i , i = 1, 2, . . . , n as a solution of the equation xA = 0 obtaining Lemma 6.

Proof of the theorem. We will prove the "if" part. The "only if" part can be proved by reversing the arguments. Without loss of generality, we assume that i = 1 and j = n. Note that x i 's satisfy the system of linear equations n-1 p=1

x p a pq = -x n a nq , q = 1, 2, . . . , n -1. The Cramer's rules give us the equality .

By properties (i) and (ii), the right hand side equals to -x n |A 1n | n1 .

The theorem now follows from Lemma 8.

By using the results from [START_REF] Gelfand | The theory of noncommutative determinants and characteristic[END_REF] and [START_REF] Gelfand | A theory of noncommutative determinants and characteristic functions of Graphs, I[END_REF] we can show that Theorem 4 implies Theorem 3 provided the corresponding quasideterminants are invertible.

  Idempotents in the minimal ideal are for example µc and µba =

  |A| ij = . . . . . . . . . . . . a ij . . . . . . . . . . . . .

( i )

 i Permutations of rows and columns: Let σ, τ be permutations of {1, 2, . . . , n}. Set B = (a σ(i),τ (j) ). Then |A| pq = B σ(p),τ (q) . (ii) Multiplication of row and columns: Let the matrix B = (b ij ) be obtained from matrix A by multiplying the i-th row by λ ∈ R from the left, i.e. b ij = λa ij and b kj = a kj for all j and k = i. Then |B| kj = λ|A| kj if k = i, and |B| kj = |A| kj if k = i and λ is invertible.Let the matrix C = (c ij ) be obtained from matrix A by multiplying the j-th column by µ ∈ R from the right, i.e. c ij = a ij µ and c il = a il for all i and l = j. Then |C| il = |A| il µ if l = j, and |C| il = A| il if l = j and µ is invertible.

For 1 ≤Proposition 2 .Lemma 7 .

 127 k ≤ n denote by B(ξ, k) the matrix obtained from B by replacing the k-th row of B by ξ. If xB = ξ then x k |B| kq = |B(ξ, k)| kq for any k provided that the both quasideterminants are defined. Example. For n = 2 one has x 1 (b 12 -b 11 b -1 21 b 22 ) = ξ 2 -ξ 1 b -1 21 b 22 and also x 1 (b 11 -b 12 b -1 22 b 21 ) = ξ 1 -ξ 1 b -1 22 b 21 .6.2. Results. Let A = (a ij ), i, j = 1, 2, . . . , n be a stochastic matrix over R.Consider the system of n + 1 equations

6. 3 . 1 .

 31 Stochastic matrices and main quasiminors. Observe that a matrix M is stochastic if and only if t (1, 1, . . . , 1) is in the kernel of M -I. This justifies the next results. Lemma 8. Let A = (a ij ), i, j = 1, 2, . . . , n over an associative unital ring annihilate the column vector t (1, 1, . . . , 1). For p = q one has|A pq | qp = -|A pp | qq if the right hand side is defined.Proof Without loss of generality one can assume that p = 1 and q = n. Then |A 1n | n1 = a 21 a 22 . . . a 2n-1 a 31 a 32 . . . a 3n-1 . . . a n1 a n2 . . . a nn-Since A is stochastic by hypothesis, we can rewrite the elements a k1 , k = 2, 3, . . . , n as a k1 = -a k2 -a k3 -• • • -a kn . By adding the columns in the last quasideterminant to the first one and using property (iii), property (ii) for the first column and µ = -1 and property (i) we get the expression a 2n a 22 . . . a 2n-1 a 3n a 32 . . . a 3n-1 . . . a nn a n2 . . . a nn-1 = -a 22 a 23 . . . a 2n a 32 a 33 . . . a 3n . . . a n2 a n3 . . . a nn which is -|A 11 | nn . Our computations also show the existence of |A 1n | n1 . The lemma is proved.

x 1

 1 |A nn | 11 = -x n a n1 -x n a n2 . . . -x n a nn-

  2.5. D[t] and other rings. Let D be a skew field and t be a central variable. It is well-known that the ring of polynomials in t over D is a left and right Euclidean ring, and thus an Ore ring. It has a field of fractions D(t), each element of which is of the form P Q -1 and R -1 S for suitable P, Q, R, S in D[t]. The ring of series in t over D is denoted D[[t]]. It is contained in the skew field of Laurent series D((t)). The latter also contains canonically D(t), and we may identify

  2.7. Rational series in one variable. Let R be a ring and t a central variable. In the ring of formal power series R[[t]], we consider the subring R[[t]] rat , which is the smallest subring containing R[t] and closed under inversion. If R is a skew field, then R[[t]] rat canonically embeds into the skew field R(t). If R → S is a ring homomorphism, then it induces a ring homomorphism R[[t]] rat → S[[t]] rat fixing t.

Acknowledgments

Thanks are due to Persi Diaconis and George Bergman for useful references; the article was improved by many suggestions of the latter.

Note that (tP ) * 11 = C 1 (t) * , where C 1 (t) * denotes the canonical image of

] rat under the composition of homomorphisms

Thus α 1 is the value at t = 1 of (1 -t)C 1 (t) * . Now taking the previous notations with i = 1, we have in P(t): (tA) * = S(t)C 1 (t) * P (t) + F (t).

Multiplying by (1 -t) and putting t = 1, we obtain, since S, P, F can be evaluated in P:

Now, we have also

We deduce that, in P, λ(C 1 ) = P ′ λ(A)S = P S. This shows that α 1 = λ(C 1 ) -1 . This proves (ii) and in particular, α 1 = 0. Thus, since P 1 = 0 in P, all α i and P i are = 0 in P. Then (iii) and (iv) are proved as in the proof of Th. 1.

In order to prove (v), we observe that the elements of the minimal ideal I of µA * are those of this monoid which have a minimal number of distinct nonnull rows (see [START_REF] Berstel | Codes and automata[END_REF] Exercice VI.3.5 or [START_REF] Béal | Unambiguous automata[END_REF] Proposition 1). This implies that if r 1 , . . . , r k are the distinct nonnull rows of some element µw of I, then for any letter a, r 1 µa, . . . , r k µa are the distinct nonnull rows of µ(wa). We deduce that the span of the elements r 1 + . . . + r k is invariant under the matrices µa. Let F denote this subspace, and F ′ the subspace spanned by the difference of such elements. By Prop.1, we have that F ′ is strictly included in F . Hence, there is a vector in F fixed by each µa. This implies that the eigenvector for eigenvalue 1 of the matrix P is in F and is therefore orthogonal to each difference of maximal columns of µA * . This proves (v).

Appendix 1: the commutative case

The following result in an exercice on determinants. Lemma 6. If the column eigenvector t (1, . . . , 1) is in the right kernel of a square matrix over a commutative ring, then the row vector (m 1 , . . . , m n ) is in its left kernel, where m i is the i-th principal minor of the matrix.

From this, one may deduce the so-called Markov Chain tree theorem, by using, as suggested in [START_REF] Lovász | Exact mixing in an unknown Markov chain[END_REF] page 4, the matrix-tree theorem, see e.g. [START_REF] Stanley | Enumerative Combinatorics[END_REF] Th. 5.6.8.

The Markov chain tree theorem gives a formula, using spanning trees of the complete graph, for the stationary distribution of a finite Markov chain. Equivalently, this formula gives a row vector fixed by a matrix fixing