Relting logic to forml lnguges Kml Lody The Institute of Mthemticl Sciences, Chenni October 2018 Reding 1. Howrd Strubing: Forml lnguges, finite utomt nd circuit complexity, birkhäuser. 2. Wolfgng Thoms: Lnguges, utomt nd logic, in Hndbook of forml lnguge theory III, springer. 3. Pscl Tesson nd Denis Thérien: Logic meets lgebr: the cse of regulr lnguges, lmcs.
Finite utomt (McCulloch nd Pitts 1943) Fix finite lphbet A M = (Q, I, F, δ) Finite set of sttes Q Initil sttes I Q Finl sttes F Q Nondeterministic trnsition reltion δ() Q Q, A M ccepts word in A The set of words ccepted is its lnguge b b,b X Y b Z b
Algebr (Myhill 1957) Binry reltions (Q Q) form finite monoid (M, ) under composition, generted by the A-lbelled trnsitions using δ(w) δ(x) = δ(wx) Morphism δ : A (Q Q) from A (the free monoid on A) to finite monoid M ccepts word w when δ(w) (I F) (lnguge is inverse imge of finite subset of the finite monoid) Congruence A A w x δ(w) = δ(x) b b A =, b b = 0,b X Y b Z b = 1, b b = 1 (symmetric group S 3 )
The utomt-lgebr connection (Myhill-Nerode 1950s) Theorem (Myhill 1957, Nerode 1958, Rbin-Scott 1959) Nondeterministic finite utomt, finite monoids nd deterministic finite utomt re equivlent. 1. Given finite utomton (possibly nondeterministic), the lnguge ccepted by it is n inverse imge of subset of finite monoid (those reltions which tke n initil stte to finl stte), clled its trnsition monoid 2. Given finite monoid M with distinguished set of elements D, (M, 1, {_ A}, D) is deterministic finite utomton (trnsition function insted of reltion) For lnguge, the syntctic monoid is the trnsition monoid of the miniml deterministic finite utomton for tht lnguge
Counter-free utomt (McNughton-Ppert 1971) Given finite utomton, the nonempty word w A + is counter if δ(w) induces nontrivil permuttion on Q The word is counter in the bottom utomton on the sttes X, Y, Z, the word b is counter on X, Y An utomton without ny counter is counter-free, for exmple, the top utomton b b A =, b b = 0,b X Y b Z b = 1, b b = 1 (symmetric group S 3 ) The trnsition monoid of counter-free utomton does not contin ny nontrivil subgroup.
Prtilly ordered utomt (Meyer-Thompson 1969) In prtilly ordered utomton, the sttes (Q, ) re prtilly ordered A trnsition from stte q cn only go to sttes r such tht q r Hence the only cycles llowed re self-loops where q = r, flling trnsitions where q > r cnnot climb bck (Schwentick-Thérien-Vollmer 2002) A prtilly ordered two-wy deterministic utomton cn ccept more lnguges (e.g. checking the k th lst letter of the word) Prtilly ordered two-wy utomt re counter-free The trnsition monoid of prtilly ordered two-wy deterministic utomton is in DA, defined s: if there is n idempotent element in D-clss, then the entire D-clss is idempotents (this seprtes the self-loops from the flling trnsitions)
Logic on words (Büchi 1960) FO ::= (x) x = y x < y Suc(x, y) φ φ ψ xφ, x, y Vr 1 Formuls re interpreted over words with pointers indicting the positions of vribles bbb = Suc(x, y) b(x) b(y) bbb = x < y b(x) b(y) bbb = Suc(x, y) b(x) b(y) Pointer functions like s = [x 5, y 6] bove re clled ssignments nd written w, s = φ in logic textbooks Formlly one cn use pointers lphbet A (V 1 ) where ech vrible is constrined to occur exctly once in the word model. For the first formul bove: ( ) ( ) b ( ) ( ) ( b ) ( ) b {x} {y} = Suc(x, y) b(x) b(y)
Sentences FO ::= (x) x = y x < y Suc(x, y) φ φ ψ b b xφ, x, y Vr 1 A sentence is formul with no free vribles, ll vribles re bound to quntifiers The lnguge {w w = x y(suc(x, y) b(x) b(y))} of words where the sentence holds is tht ccepted by the top utomton; the sentence defines the lnguge A bba Sentence x y(suc(x, y) b(x) b(y)) defines A bba
Sentences define lnguges Let mx(x) = ysuc(x, y) be n bbrevition, similrly define min(x), etc. x[(x) y(suc(x, y) b(y)) (b(x) mx(x) y(suc(x, y) (y)))] defines (A \ {, b}) ((b) b(b) ) Adding conjuncts min(x) (x) nd mx(x) b(x) to the previous sentence defines (b) x y[(min(x) (x)) (mx(x) b(x)) Suc(x, y) (b(x) b(y)) ((x) (y))] defines: Over the lphbet {,b}, the lnguge (b) Over the lphbet {,b,c}, the lnguge c (c bc )
Formuls define pointed lnguges Let A be {,b,c}; truth checking procedure is outlined below: 1. We hve uv = (x) 2. Since u,v re rbitrry, the formul (x) defines the pointed lnguge A A 3. Similrly uv(b c)w = α(x, y) def = x < y (y) 4. So y α(x, y) defines A (b c) 5. Agin tubvcw = β(x, y, z) def = x < y < z b(y) 6. So y β(x, y, z) defines A b ca 7. Hence z(c(z) y β(x, y, z))) defines A b ca 8. Since b c is included in (b c) (nd not conversely), the intersection A b c(b c) = A (b c) A (b ca ) of 4 nd 7 is definble in Σ 2 [<] by x((x) y(x < y (y)) z(c(z) y(x < y < z b(y))))
FO 2 logic to prtilly ordered two-wy utomt Theorem (Schwentick-Thérien-Vollmer 2002) Given n FO 2 sentence (formul), the (pointed) lnguge defined by it is ccepted by finite prtilly ordered two-wy utomton. Proof. For FO 2 formuls with free vribles V 1, we construct n utomton over the lphbet A (V 1 ): for (x), we hve n edge; for φ we exchnge finl nd non-finl sttes; for φ ψ we hve product construction. All done using prtilly ordered one-wy utomt. There re only two vribles, so one cn hve y > x((y) φ) or y < x((y) φ). These determine instructions to go forwrd nd/or bckwrd on the word looking for letters of the lphbet on self-loop. Finding the position y one flls down the prtil order. This cn be done by prtilly ordered two-wy utomt. Boolen opertions now done by stisfying ech formul in sequence.
FO logic to counter-free utomt Theorem (Schützenberger 1966, McNughton-Ppert 1971) Given n FO sentence (formul), the (pointed) lnguge defined by it is ccepted by finite counter-free utomton. Proof. By induction on FO formuls with free vribles V 1, we construct counter-free utomton over the pointers lphbet A (V 1 ): for (x), x = y nd x < y we directly construct the utomt; for φ ψ we hve product construction; for φ we ssume deterministic utomton nd exchnge finl nd non-finl sttes; for xφ we project the utomton to the lphbet A (V 1 \ {x}) by nondeterministiclly guessing the position interpreting x. Corollry {w w 0 mod q, q 2} nd () re not FO-definble. Becuse their syntctic monoids contin subgroups Z q nd Z 3.
More logics on words MSO ::= (FO nd ) x Y Yφ, x, y Vr 1, Y Vr 2 FO ::= (x) x = y Suc(x, y) x < y φ φ ψ xφ, x, y Vr 1 The MSO sentence O E x[(x) (min(x) x O) (mx(x) x E) y((x O Suc(x, y) y E) (x E Suc(x, y) y O))] defines the lnguge () which is not FO-definble An FO sentence is Σ r [<]/Π r [<] if it hs r lternting blocks of quntifiers, with first block existentil/universl r [<] is the clss of lnguges which re definble by both Σ r [<] nd Π r [<] sentences (Σ r [<] Π r [<] lnguges) An MSO sentence is MQ 1 s -q0 r if it hs s lternting blocks of set quntifiers, followed by r lternting blocks of first-order quntifiers (sentence bove is MΣ 1 1 -Π0 1 [<])
MSO logic to finite utomt Theorem (Büchi 1960, Elgot 1961, Trkhtenbrot 1962) Given n MSO sentence (formul), the (pointed) lnguge defined by it is ccepted by finite utomton. Proof. Extending the proof for FO formuls, with free first-order vribles V 1 nd free set vribles V 2, we construct n utomton over the extended pointers lphbet A (V 1 ) (V 2 ): for the tomic formul x Y, we hve direct construction nd for the set quntifier Y φ we gin do projection by nondeterministiclly guessing the positions which re lbelled Y. As there cn be mny such positions lbelled Y, there is no gurntee tht the construction is counter-free. For the even-length words MSO sentence, nontrivil cycle is introduced round n E-stte (nd n O-stte).
The utomt-logic connection (Büchi-Elgot-Trkhtenbrot) Theorem Given finite utomton, the lnguge ccepted by it is defined by n MΣ 1 1 -Π0 [<] sentence. 1 X Y Z stte positions [ x y(x X Suc(x, y) y Y) y z(y Y Suc(y, z) ((b(y) z X) ((y) z Z))) z x(z Z Suc(z, x),b X Y b Z b ((b(z) x Z) ((z) x X))) y z(y Y Suc(y, z) b(y)) goes to finl stte X z x(z Z Suc(z, x) (z)) goes to finl stte X x((x(x) Y(x) Z(x)) ((x) b(x))) unique stte/letter ] By closure under complement, on finite words MSO = M 1 1.
Strfree expressions Strfree expressions e ::= A e 1 e 2 e 1 e 2 e 1 Strfree expressions re defined s, { A}, corresponding to the empty nd singleton lnguges, nd tking the closure under the opertions e 1 e 2 (conctention), e 1 e 2 (union) nd e 1 (complement). (Avoiding the empty word.) Regulr expressions e ::= A e 1 e 2 e 1 e 2 e + 1 The regulr expressions re obtined by closing the strfree expressions under the opertion str (itertion of conctention). Here we use plus. The corresponding lnguge is {w 1... w n w i L(e 1 ), 1 i n}. Theorem (Kleene 1956) Regulr expressions define exctly the lnguges ccepted by finite utomt.
Dot-depth hierrchy (Brzozowksi-Knst-Thoms) Strfree expressions e ::= A e 1 e 2 e 1 e 2 e 1 The empty lnguge nd its complement (which is A + ) re dot-depth 0 expressions Closing dot-depth r expressions under conctention nd then boolen opertions gives dot-depth r + 1 expressions Theorem (McNughton-Ppert 1971) The dot-depth r lnguges re B r [<, min, mx, Suc]-definble. Hence the strfree lnguges re FO-definble. flse, (min = mx) (min) e 1 e 2 x(e [min,x] 1 e [Suc(x),mx] 2 ). Here n FO sentence is reltivized to n intervl, e.g. (x) [i,j] = i x j (x) nd ( xφ(x)) [i,j] = x(i x j (φ(x) [i,j] )) The positions min nd mx t the beginning nd end of word, the successor function Suc(x) cn be defined in FO
Dot-depth hierrchy (Brzozowksi-Knst-Thoms) Suppose the lphbet A hs t lest two letters. Theorem (Brzozowski-Knst 1978) The dot-depth hierrchy is infinite: B 0 [<] B 1 [<] B 2 [<]... Let Cycle r be the lnguge of W ll words w hving n equl X Y number of s nd b s, such tht b b for ll prefixes v of w, the number of b s is t most the num- b ber of s, the number of s is greter thn the number of b s Z,b by t most r. Automton for Cycle 2 There is B r+1 [<]-sentence defining the lnguge Cycle r. There is no B r [<]-sentence which defines Cycle r.
Algebr-expression connection for FO(Schützenberger) Theorem (Schützenberger 1965) The lnguge recognized by finite group-free monoid is strfree. Hence counter-free utomt cn only ccept strfree lnguges. The two-sided idels MmM = {nmp n, p M} in the finite monoid M (with h : A M), re prtilly ordered by inclusion The bsence of nontrivil subgroup mens tht the intersection of right idel mm = {mp p M} nd left idel Mm = {nm n M} of the monoid M is t most singleton Using this one cn build strfree expression for the inverse h 1 (m) of every singleton by n induction on the idel order For the utomton for the lnguge (b b) not obviously strfree Schützenberger s proof yields the strfree expression (A b(b) A ) (A b (b) ba ), where the lnguge (b) is described by the expression A A b A ( bb)a
Algebr-logic connection for FO 2 Theorem (Schütz.1976, Schwentick-Thérien-Vollmer 2002) The lnguge recognized by finite monoid in DA is unmbiguous strfree. Hence prtilly ordered two-wy utomt cn only ccept unmbiguous lnguges, which re definble in FO 2. The left nd right idels Mm, mm in the finite monoid with h : A M, re prtilly ordered by inclusion A word u cn be fctorized u 0 1... t u t where ech u i stys in n R-clss, nd ech i moves to new R-clss for i u i Ech u i mps to n idempotent nd ech i+1 tkes one to the next D-clss, i+1 hs to use letter not in u i A word v = v 0 1... t v t, where every pir h(u i ) = h(v i ) mps to the sme element, must mp to the sme h(u) = h(v) A symmetric result holds for right-to-left fctoriztions, giving n unmbiguous expression A 0 1... t A t, A i A Boolen combintion of expressions cn be written in FO 2