Algorithm Search⌘K

Proofs: Schützenberger's theorem

These are the human proofs of Schützenberger's theorem, at full length.

Proof of Schützenberger's theorem full

This proof shows: statement.

We prove that a regular language L⊆Σ∗L \subseteq \Sigma^* is star-free if and only if its syntactic monoid M(L)M(L) is aperiodic. The second half follows the proof in Pin's book, by induction on the ideals of the monoid.

Notation

Σ\Sigma is a finite alphabet. A finite monoid MM is aperiodic if there is an integer N≥0N \ge 0 with mN=mN+1m^N = m^{N + 1} for all m∈Mm \in M; we fix such an NN. For a language LL, ηL:Σ∗→M(L)\eta_L : \Sigma^* \to M(L) is the syntactic morphism, which is onto, and u≡Lvu \equiv_L v means ηL(u)=ηL(v)\eta_L(u) = \eta_L(v), that is, xuy∈L⇔xvy∈Lxuy \in L \Leftrightarrow xvy \in L for all strings x,yx, y. A language LL is NN-aperiodic if for all strings x,u,yx, u, y:

xuNy∈L  ⟺  xuN+1y∈L.x u^N y \in L \iff x u^{N + 1} y \in L.

For elements s,ts, t of a monoid MM, write sM={sx:x∈M}sM = \{ sx : x \in M \}, MsMs and MsMMsM in the same way, and

  • sRts \mathrel{\mathcal R} t if sM=tMsM = tM,
  • sLts \mathrel{\mathcal L} t if Ms=MtMs = Mt,
  • sJts \mathrel{\mathcal J} t if MsM=MtMMsM = MtM.

These are equivalence relations, and sRts \mathrel{\mathcal R} t or sLts \mathrel{\mathcal L} t implies sJts \mathrel{\mathcal J} t. Since sx∈sMsx \in sM, we have sxM⊆sMsxM \subseteq sM and MsxM⊆MsMMsxM \subseteq MsM for all xx.

Lemma 0. For a regular language LL, M(L)M(L) is aperiodic with constant NN if and only if LL is NN-aperiodic.

Proof. M(L)M(L) is finite since LL is regular. Each m∈M(L)m \in M(L) is ηL(u)\eta_L(u) for some uu, and mN=ηL(uN)m^N = \eta_L(u^N), mN+1=ηL(uN+1)m^{N + 1} = \eta_L(u^{N + 1}). So mN=mN+1m^N = m^{N + 1} for all mm if and only if uN≡LuN+1u^N \equiv_L u^{N + 1} for all uu, which is the definition of NN-aperiodic. □\square

Part 1: star-free languages are aperiodic

Star-free languages are regular, since ∅\emptyset and {a}\{a\} are regular and regular languages are closed under union, complement and concatenation. By Lemma 0 it is enough to show that every star-free language is NN-aperiodic for some NN. We use induction on a star-free expression.

Raising NN. If KK is NN-aperiodic, it is N′N'-aperiodic for every N′≥NN' \ge N: xuN′y=xuN(uN′−Ny)x u^{N'} y = x u^N (u^{N' - N} y) and xuN′+1y=xuN+1(uN′−Ny)x u^{N' + 1} y = x u^{N + 1} (u^{N' - N} y), so the definition with y′=uN′−Nyy' = u^{N' - N} y gives the claim.

Base cases. ∅\emptyset is 00-aperiodic, since both sides are false. {a}\{a\} is 22-aperiodic: if u=εu = \varepsilon, the two strings xu2yx u^2 y and xu3yx u^3 y are both xyxy; if u≠εu \ne \varepsilon, both have length at least 2, so neither is aa.

Complement. If KK is NN-aperiodic, so is Σ∗∖K\Sigma^* \setminus K, since the condition is symmetric in membership and non-membership.

Union. If KK is NKN_K-aperiodic and LL is NLN_L-aperiodic, both are NN-aperiodic for N=max⁡(NK,NL)N = \max(N_K, N_L), by raising, and then K∪LK \cup L is NN-aperiodic.

Concatenation. Let KK be NKN_K-aperiodic and LL be NLN_L-aperiodic; by raising, we may take NK,NL≥1N_K, N_L \ge 1. Let N=NK+NL+1N = N_K + N_L + 1. We show that KLKL is NN-aperiodic. Fix x,u,yx, u, y. If u=εu = \varepsilon there is nothing to show, so let u≠εu \ne \varepsilon. Consider a string xueyx u^e y with e∈{N,N+1}e \in \{N, N + 1\}, and a factorization xuey=vzx u^e y = vz with v∈Kv \in K, z∈Lz \in L. The cut between vv and zz lies inside xx, inside one of the ee copies of uu, at a border between them, or inside yy. Let ii be the number of copies of uu that lie entirely in vv and jj the number that lie entirely in zz. At most one copy is cut, so i+j≥e−1i + j \ge e - 1. If i≥1i \ge 1, then vv contains xx and the first ii copies, so v=xuirv = x u^i r for some string rr; likewise, if j≥1j \ge 1, then z=r′ujyz = r' u^j y for some string r′r'. Below, i≥NKi \ge N_K or j≥NLj \ge N_L always gives i≥1i \ge 1 or j≥1j \ge 1 respectively.

  • From e=N+1e = N + 1 to NN. Here i+j≥N=NK+NL+1i + j \ge N = N_K + N_L + 1, so i≥NK+1i \ge N_K + 1 or j≥NL+1j \ge N_L + 1. If i≥NK+1i \ge N_K + 1, then i−1≥NKi - 1 \ge N_K, and since KK is (i−1)(i - 1)-aperiodic by raising, xui−1r∈Kx u^{i - 1} r \in K. Removing one copy of uu from vv gives xuNy=(xui−1r)z∈KLx u^N y = (x u^{i - 1} r) z \in KL. If j≥NL+1j \ge N_L + 1, remove one copy from zz in the same way.
  • From e=Ne = N to N+1N + 1. Here i+j≥N−1=NK+NLi + j \ge N - 1 = N_K + N_L, so i≥NKi \ge N_K or j≥NLj \ge N_L. If i≥NKi \ge N_K, then xui+1r∈Kx u^{i + 1} r \in K, since KK is ii-aperiodic, and xuN+1y=(xui+1r)z∈KLx u^{N + 1} y = (x u^{i + 1} r) z \in KL. If j≥NLj \ge N_L, add one copy to zz.

So xuNy∈KLx u^N y \in KL if and only if xuN+1y∈KLx u^{N + 1} y \in KL. By induction, every star-free language is NN-aperiodic for some NN, and its syntactic monoid is aperiodic by Lemma 0.

Part 2: aperiodic languages are star-free

Let LL be regular with M=M(L)M = M(L) aperiodic, and let φ=ηL\varphi = \eta_L. Since L=φ−1(φ(L))L = \varphi^{-1}(\varphi(L)) and φ(L)\varphi(L) is finite, it is enough to show that φ−1(m)\varphi^{-1}(m) is star-free for every m∈Mm \in M. The argument uses only that φ:Σ∗→M\varphi : \Sigma^* \to M is an onto morphism to a finite aperiodic monoid. Fix NN with mN=mN+1m^N = m^{N + 1} for all m∈Mm \in M.

Lemma 1 (stability). For s,t∈Ms, t \in M: if s∈MstMs \in MstM, then sRsts \mathrel{\mathcal R} st; if s∈MtsMs \in MtsM, then sLtss \mathrel{\mathcal L} ts.

Proof. Let s=xstys = x s t y. By induction on kk, s=xks(ty)ks = x^k s (ty)^k for all k≥0k \ge 0. With k=N+1k = N + 1 and xN+1=xNx^{N + 1} = x^N,

s=xNs(ty)N+1=(xNs(ty)N)ty=sty.s = x^N s (ty)^{N + 1} = \bigl(x^N s (ty)^N\bigr) ty = s t y.

So s∈stMs \in stM, hence sM⊆stMsM \subseteq stM; also stM⊆sMstM \subseteq sM. So sM=stMsM = stM. The second claim is the mirror image. □\square

Lemma 2. Let m,s∈Mm, s \in M with s∈mM∩Mms \in mM \cap Mm and m∈MsMm \in MsM. Then s=ms = m.

Proof. Write s=mp=qms = mp = qm and m=usvm = usv with p,q,u,v∈Mp, q, u, v \in M.

  1. m=usv=um(pv)m = usv = u m (pv). By induction on kk, m=ukm(pv)km = u^k m (pv)^k. With k=N+1k = N + 1 and uN+1=uNu^{N + 1} = u^N, m=uNm(pv)N+1=(uNm(pv)N)pv=mpv=svm = u^N m (pv)^{N + 1} = \bigl(u^N m (pv)^N\bigr) pv = m p v = s v.
  2. s=qm=qsvs = q m = q s v, using step 1. By induction on kk, s=qksvks = q^k s v^k. With k=N+1k = N + 1 and qN+1=qNq^{N + 1} = q^N, s=qNsvN+1=(qNsvN)v=svs = q^N s v^{N + 1} = \bigl(q^N s v^N\bigr) v = s v.

So s=sv=ms = sv = m. □\square

Corollary 3. If 1∈MsM1 \in MsM, then s=1s = 1. Proof. Lemma 2 with m=1m = 1: s∈1M∩M1s \in 1M \cap M1 holds for every ss. □\square

The rank. For m∈Mm \in M let r(m)=∣M∖MmM∣r(m) = |M \setminus MmM|. We show that φ−1(m)\varphi^{-1}(m) is star-free by induction on r(m)r(m). If MnM⊋MmMMnM \supsetneq MmM then r(n)<r(m)r(n) < r(m). By Corollary 3, r(m)=0r(m) = 0, that is MmM=M∋1MmM = M \ni 1, holds only for m=1m = 1.

The element 1. Let B={a∈Σ:φ(a)=1}B = \{ a \in \Sigma : \varphi(a) = 1 \}. Then φ−1(1)=B∗\varphi^{-1}(1) = B^*. Indeed, if φ(w)=1\varphi(w) = 1 and w=xayw = x a y with a∈Σa \in \Sigma, then 1=φ(x)φ(a)φ(y)∈Mφ(a)M1 = \varphi(x) \varphi(a) \varphi(y) \in M \varphi(a) M, so φ(a)=1\varphi(a) = 1 by Corollary 3; and every string over BB maps to 1. The language B∗=Σ∗∖⋃a∈Σ∖BΣ∗aΣ∗B^* = \Sigma^* \setminus \bigcup_{a \in \Sigma \setminus B} \Sigma^* a \Sigma^* is star-free, with Σ∗=∅‾\Sigma^* = \overline{\emptyset}.

An element m≠1m \ne 1. Define the finite sets

  • E={(n,a)∈M×Σ:nφ(a)Rm, n∉mM}E = \{ (n, a) \in M \times \Sigma : n \varphi(a) \mathrel{\mathcal R} m,\ n \notin mM \},
  • F={(a,n)∈Σ×M:φ(a)nLm, n∉Mm}F = \{ (a, n) \in \Sigma \times M : \varphi(a) n \mathrel{\mathcal L} m,\ n \notin Mm \},
  • C={a∈Σ:m∉Mφ(a)M}C = \{ a \in \Sigma : m \notin M \varphi(a) M \},
  • G={(a,n,b)∈Σ×M×Σ:m∈Mφ(a)nM∩Mnφ(b)M, m∉Mφ(a)nφ(b)M}G = \{ (a, n, b) \in \Sigma \times M \times \Sigma : m \in M \varphi(a) n M \cap M n \varphi(b) M,\ m \notin M \varphi(a) n \varphi(b) M \},

and the languages

U=⋃(n,a)∈Eφ−1(n) a,V=⋃(a,n)∈Fa φ−1(n),W=⋃(a,n,b)∈Ga φ−1(n) b.U = \bigcup_{(n, a) \in E} \varphi^{-1}(n) \, a, \qquad V = \bigcup_{(a, n) \in F} a \, \varphi^{-1}(n), \qquad W = \bigcup_{(a, n, b) \in G} a \, \varphi^{-1}(n) \, b.

Lemma 4. Every nn that occurs in EE, FF or GG satisfies MnM⊋MmMMnM \supsetneq MmM.

Proof. Case (n,a)∈E(n, a) \in E. From nφ(a)Rmn \varphi(a) \mathrel{\mathcal R} m, m∈nφ(a)M⊆nMm \in n \varphi(a) M \subseteq nM, so MmM⊆MnMMmM \subseteq MnM. Suppose MmM=MnMMmM = MnM. Then n∈MmM=Mnφ(a)Mn \in MmM = M n \varphi(a) M, since nφ(a)Jmn \varphi(a) \mathrel{\mathcal J} m, and Lemma 1 gives nRnφ(a)Rmn \mathrel{\mathcal R} n \varphi(a) \mathrel{\mathcal R} m. So n∈nM=mMn \in nM = mM, which contradicts n∉mMn \notin mM.

Case (a,n)∈F(a, n) \in F: the mirror image, with Lemma 1 for L\mathcal L.

Case (a,n,b)∈G(a, n, b) \in G. From m∈Mnφ(b)M⊆MnMm \in M n \varphi(b) M \subseteq MnM, MmM⊆MnMMmM \subseteq MnM. Suppose MmM=MnMMmM = MnM. Then n∈MmM⊆Mnφ(b)Mn \in MmM \subseteq M n \varphi(b) M, and Lemma 1 gives nRnφ(b)n \mathrel{\mathcal R} n \varphi(b), so n=nφ(b)tn = n \varphi(b) t for some t∈Mt \in M. Then φ(a)n=φ(a)nφ(b)t\varphi(a) n = \varphi(a) n \varphi(b) t, so m∈Mφ(a)nM⊆Mφ(a)nφ(b)Mm \in M \varphi(a) n M \subseteq M \varphi(a) n \varphi(b) M, which contradicts the definition of GG. □\square

By Lemma 4 and the induction hypothesis, each φ−1(n)\varphi^{-1}(n) in UU, VV and WW is star-free. So UU, VV and WW are finite unions of concatenations of star-free languages and letters, and they are star-free; so is the finite set CC of one-letter strings.

Lemma 5. For m≠1m \ne 1,

φ−1(m)=(UΣ∗∩Σ∗V)∖Σ∗(C∪W)Σ∗.\varphi^{-1}(m) = \bigl( U \Sigma^* \cap \Sigma^* V \bigr) \setminus \Sigma^* (C \cup W) \Sigma^*.

Proof of ⊆\subseteq. Let φ(w)=m\varphi(w) = m.

  • w∈UΣ∗w \in U \Sigma^*. Let pp be the shortest prefix of ww with φ(p)Rm\varphi(p) \mathrel{\mathcal R} m; it exists, since ww itself qualifies. p≠εp \ne \varepsilon: else 1Rm1 \mathrel{\mathcal R} m, so 1∈mM⊆MmM1 \in mM \subseteq MmM and m=1m = 1 by Corollary 3. Write p=p′ap = p' a with a∈Σa \in \Sigma, and n=φ(p′)n = \varphi(p'). Then nφ(a)=φ(p)Rmn \varphi(a) = \varphi(p) \mathrel{\mathcal R} m. If n∈mMn \in mM, then nM⊆mM=φ(p)M⊆nMnM \subseteq mM = \varphi(p) M \subseteq nM, so nRmn \mathrel{\mathcal R} m, and the shorter prefix p′p' qualifies, a contradiction. So (n,a)∈E(n, a) \in E and p∈φ−1(n)a⊆Up \in \varphi^{-1}(n) a \subseteq U.
  • w∈Σ∗Vw \in \Sigma^* V, by the mirror argument with the shortest suffix ss with φ(s)Lm\varphi(s) \mathrel{\mathcal L} m.
  • w∉Σ∗CΣ∗w \notin \Sigma^* C \Sigma^*. If w=xayw = x a y with a∈Ca \in C, then m=φ(x)φ(a)φ(y)∈Mφ(a)Mm = \varphi(x) \varphi(a) \varphi(y) \in M \varphi(a) M, a contradiction.
  • w∉Σ∗WΣ∗w \notin \Sigma^* W \Sigma^*. If w=xagbyw = x a g b y with (a,φ(g),b)∈G(a, \varphi(g), b) \in G, then m∈Mφ(a)φ(g)φ(b)Mm \in M \varphi(a) \varphi(g) \varphi(b) M, a contradiction.

Proof of ⊇\supseteq. Let ww be in the right side and s=φ(w)s = \varphi(w). Since w∈UΣ∗w \in U \Sigma^*, w=paxw = p a x with (φ(p),a)∈E(\varphi(p), a) \in E, so s∈φ(p)φ(a)M=mMs \in \varphi(p) \varphi(a) M = mM, where the equality is φ(p)φ(a)Rm\varphi(p) \varphi(a) \mathrel{\mathcal R} m. In the same way w∈Σ∗Vw \in \Sigma^* V gives s∈Mms \in Mm.

We show m∈MsMm \in MsM. Suppose not. Then some factor ff of ww has m∉Mφ(f)Mm \notin M \varphi(f) M, for example f=wf = w; take a shortest one. f≠εf \ne \varepsilon, since Mφ(ε)M=M∋mM \varphi(\varepsilon) M = M \ni m. If ∣f∣=1|f| = 1, then f∈Cf \in C and w∈Σ∗CΣ∗w \in \Sigma^* C \Sigma^*, a contradiction. If ∣f∣≥2|f| \ge 2, write f=agbf = a g b with a,b∈Σa, b \in \Sigma and n=φ(g)n = \varphi(g). The factors agag and gbgb are shorter than ff, so m∈Mφ(a)nMm \in M \varphi(a) n M and m∈Mnφ(b)Mm \in M n \varphi(b) M; and m∉Mφ(a)nφ(b)Mm \notin M \varphi(a) n \varphi(b) M. So (a,n,b)∈G(a, n, b) \in G, f∈Wf \in W, and w∈Σ∗WΣ∗w \in \Sigma^* W \Sigma^*, a contradiction.

So s∈mM∩Mms \in mM \cap Mm and m∈MsMm \in MsM, and Lemma 2 gives s=ms = m, that is, w∈φ−1(m)w \in \varphi^{-1}(m). □\square

Conclusion. The right side of Lemma 5 is built from star-free languages by concatenation, intersection and difference, so it is star-free. By induction on r(m)r(m), φ−1(m)\varphi^{-1}(m) is star-free for every m∈Mm \in M, and L=⋃m∈φ(L)φ−1(m)L = \bigcup_{m \in \varphi(L)} \varphi^{-1}(m) is star-free. Together with Part 1, this proves the theorem. ■\blacksquare

A worked case

For L=(ab)∗L = (ab)^* over {a,b}\{a, b\}, M(L)={1,a,b,ab,ba,0}M(L) = \{1, a, b, ab, ba, 0\} (see the syntactic monoid page), and no letter maps to 1, so B=∅B = \emptyset and φ−1(1)={ε}\varphi^{-1}(1) = \{\varepsilon\}. For m=abm = ab: the R\mathcal R-class of abab is {a,ab}\{a, ab\} and its L\mathcal L-class is {b,ab}\{b, ab\}, which give E={(1,a)}E = \{(1, a)\} and F={(b,1)}F = \{(b, 1)\}. Both letters satisfy ab∈Mφ(c)Mab \in M \varphi(c) M, so C=∅C = \emptyset, and G={(a,1,a),(b,1,b)}G = \{(a, 1, a), (b, 1, b)\}. So U={a}U = \{a\}, V={b}V = \{b\}, W={aa,bb}W = \{aa, bb\}, and Lemma 5 gives

φ−1(ab)=(aΣ∗∩Σ∗b)∖Σ∗{aa,bb}Σ∗=(ab)+.\varphi^{-1}(ab) = \bigl(a \Sigma^* \cap \Sigma^* b\bigr) \setminus \Sigma^* \{aa, bb\} \Sigma^* = (ab)^+.

With φ(L)={1,ab}\varphi(L) = \{1, ab\}, L={ε}∪(ab)+L = \{\varepsilon\} \cup (ab)^+.

Back to Schützenberger's theorem