Logic: Lecture 21, 03 November 2015 ---------------------------------- (Reference: Applied Automata Theory by Wolfgang Thomas, Chapters 0,1) Recall formal MSO syntax, word w defines a model ^w For free variables, fix an assignment to the variables: ^w |= phi(i1,...,im,I1....,In) MSO definable languages Sentence phi L = { w | ^w |= phi } FO fragment, FO definable languages Theorem [Buechi, Elgot, Trakhtenbrot 1960] A language (of nonempty words) is MSO definable iff it is regular. Eliminating min and max psi(min) ---> Ey (psi(y) and ~Ez z < y) psi(max) ---> Ey (psi(y) and ~Ez y < z) Eliminate < x < y ---> Ex [ ~X(x) and Az Az'(X(z) and S(z,z') -> X(z')) and X(y) ] Encoding a model for phi(x1,..,xl,X1,..,Xm) Word a_0 .. a_{n-1} plus an encoding of the assignment to the variables - Encode the assignment by the characteristic function - x_i |-> k_i is a 0/1 sequence of length n with exactly one 1 at k_i - X_i |-> K_i is a 0/1 sequence of length n with ones at each k in K_i Alphabet is now Sigma x {0,1}^{l+m} Proof of BET Theorem: A. Encoding automata in MSO ---------------------------- - A = (Q = {q_1,...,q_m}, Delta, q_1, F) Assume initial state is q_1 - Use set variables X_1,...,X_m to describe runs X_j is those positions in the run where the state is q_j EX_1 EX_2 ... EX_m [ X_j's form a partition and X_1(min) and Ax Ax S(x,y) -> a valid transition is applied and the move from max can lead to a final state ] EX_1 EX_2 ... EX_m [ Ax Or_j X_j(x) and ~Ex And_i,j X_i(x) and X_j(x) and X_1(min) and Ax Ax S(x,y) -> Or_{q_j,a,q_k in Delta} X_j(x) and Q_a(x) and X_k(y) and Or_{q_j,a,f in Delta, f in F} X_j(max) and Q_a(max) ] Note: - Only existential set quantifiers needed to encode automata: EMSO - Can make do with log n quantifiers using binary encoding for n states B. Encoding MSO in automata --------------------------- Reduce to MSO_0 -- no individual variables - X subseteq Y, X subseteq P_a - Sing(X) [ "X is a singleton"] - S(X,Y) [ "X = {x}, Y = {y} and S(x,y)" ] - X < Y [ "X = {x}, Y = {y} and x < y" ] Can transform MSO to MSO_0 by induction e.g phi(X_1) = Ax (P_a(x) -> Ey (S(x,y) and X_1(y)) phi(X_1) = AX (Sing(X) and X subseteq P_a -> EY (Sing(Y) and S(X,Y) and Y subseteq X_1) Now, inductively build NFAs for MSO_0 formulas: 1. X_1 subseteq X_2 2. X_1 subseteq P_a 3. Sing(X_1) 4. S(X_1,X_2) 5. X_1 < X_2 For existential quantification, use projection: Lemma: Let f: Sigma -> Gamma. Extend f to words in the obvious way. L is regular implies f(L) is regular. Proof: Given automaton A for L, replace labels on transitions: (q,a,q') becomes (q,f(a),q'). New automaton accepts f(L). Given automaton for phi(X_1,X_2,...,X_n), automaton for EX_n phi(X_1,X_2,...,X_n) is obtained using the canonical projection (a,x_1,...,x_{n-1},x_n) |-> (a,x_1,...,x_{n-1}) Take the automaton for phi(X_1,...,X_n) and omit the last component of each transition label. Complexity ---------- Individual operations are polynomial, except complementation, which requires subset construction, so exponential. Overall worst-case complexity is a tower of exponentials of unbounded height [Meyer, Stockmeyer 1971]. More precisely, There is no translation of MSO-formulas phi to automata in which the number of states of the resulting automaton can be bounded by a function of the form 2^{2^{2^ ...{2^n}...}} where the height of the exponential is some constant k. ---------------------------------------------------------------------- Infinite words Buechi automata (BA) Same structure as DFA/NFA but interpret F differently: Infinite word is accepted iff it has a run that visits F infinitely often (which implies that some f in F is visited infinitely often) Examples: Sigma = {a,b} L = { w | w has infinitely many a's} a ------> (self loop on b) q0 q1 (self loop on a) <------ b q0 is initial state, F = {q1} This automaton is deterministic. If we make F = {q0} we get L' = { w | w has infinitely many b's}, which is not the complement of the original language! L" = { w | w has finitely many a's} b (self loop on a,b) q0 ------> q1 (self loop on b) q0 is initial state, F = {q1} Finitely many a's means the word ends with an infinite suffix of b's. Guess when we are in this infinite suffix and move to q1. This automaton is nondeterministic. Claim: There is no deterministic BA for this langauge. Theorem: Deterministic BA are strictly weaker than nondeterministic BA. Omega-regular languages: languages accepted by nondeterministic BA Complementation is a nontrivial problem, solved by Buechi using Ramsey Theory and later simpler proofs have been presented by modifying the automaton model and translating back and forth. Product construction works with minor modification for union and instersection. Projection is as for finite automata. Using these, we can get a correspondence between MSO(N,0,S) and omega-regular languages (Buchi, 1960). ======================================================================