Relating logic to formal languages

Similar documents
Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Theory of Computation Regular Languages

CS375: Logic and Theory of Computing

1.3 Regular Expressions

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

1.4 Nonregular Languages

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

Non-deterministic Finite Automata

Minimal DFA. minimal DFA for L starting from any other

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Finite-State Automata: Recap

5.1 Definitions and Examples 5.2 Deterministic Pushdown Automata

Deterministic Finite Automata

Finite Automata-cont d

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

State Minimization for DFAs

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

CS 275 Automata and Formal Language Theory

Regular expressions, Finite Automata, transition graphs are all the same!!

A tutorial on sequential functions

Non-deterministic Finite Automata

Nondeterminism and Nodeterministic Automata

Coalgebra, Lecture 15: Equations for Deterministic Automata

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

Harvard University Computer Science 121 Midterm October 23, 2012

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.

Non-Deterministic Finite Automata

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

Chapter 2 Finite Automata

Deterministic Finite-State Automata

Automata and Languages

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

C. C^mpenu, K. Slom, S. Yu upper boun of mn. So our result is tight only for incomplete DF's. For restricte vlues of m n n we present exmples of DF's

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Formal Languages and Automata

Fundamentals of Computer Science

Lecture 9: LTL and Büchi Automata

CHAPTER 1 Regular Languages. Contents

Let's start with an example:

FORMAL LANGAUGES & AUTOMATA

CSCI FOUNDATIONS OF COMPUTER SCIENCE

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

COMPUTER SCIENCE TRIPOS

Lecture 08: Feb. 08, 2019

Probabilistic Model Checking Michaelmas Term Dr. Dave Parker. Department of Computer Science University of Oxford

This lecture covers Chapter 8 of HMU: Properties of CFLs

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

Introduction to ω-autamata

For convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

MATH 101A: ALGEBRA I PART B: RINGS AND MODULES 35

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

3 Regular expressions

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

CS 330 Formal Methods and Models

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

CISC 4090 Theory of Computation

Homework 3 Solutions

Java II Finite Automata I

Convert the NFA into DFA

NFAs continued, Closure Properties of Regular Languages

Chapter 14. Matrix Representations of Linear Transformations

A negative answer to a question of Wilke on varieties of!-languages

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Kleene Theorems for Free Choice Nets Labelled with Distributed Alphabets

CS 275 Automata and Formal Language Theory

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Boolean Algebra. Boolean Algebras

1 Nondeterministic Finite Automata

Good-for-Games Automata versus Deterministic Automata.

Worked out examples Finite Automata

LTL Translation Improvements in Spot

CMSC 330: Organization of Programming Languages

Math 4310 Solutions to homework 1 Due 9/1/16

TREE AUTOMATA AND TREE GRAMMARS

The Regulated and Riemann Integrals

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Formal languages, automata, and theory of computation

Closure Properties of Regular Languages

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Designing finite automata II

Streamed Validation of XML Documents

PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA

Results on Planar Near Rings

Automata and semigroups recognizing infinite words

Closure Properties of Regular Languages

THEOTY OF COMPUTATION

Nondeterministic Biautomata and Their Descriptional Complexity

Automata, Games, and Verification

Transcription:

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