Logic: Lecture 20, 29 October 2015 ---------------------------------- (Reference: Applied Automata Theory by Wolfgang Thomas, Chapters 0,1) Recall syntax MSO over finite words DFAs Unique run on any input Complementation: Swap final and non-final states Emptiness: View the automaton as a graph and check for a path from the initial state to some final state More constructions Union: A_1 = (Q_1,delta_1,qin_1,F_1) A_2 = (Q_2,delta_2,qin_2,F_2) Want A that accepts L(A_1) union L(A_2) Run A_1 and A_2 in parallel and check if either accepts: Product construction Q = Q_1 x Q_2 delta((q_1,q_2),a) = (delta_1(q_1,a), delta_2(q_2,a)) qin = (qin_1,qin_2) F = (F_1 x Q_2) union (Q_1 x F_2) Intersection: Again product construction, but check that both accept F = F_1 x F_2 Examples L = { w | w has at least two b's } More complex L = { w | word ends with aa} In MSO: P_a(max) and Ay [ S(y,max) -> P_a(y) ] (Naive) DFA keeps track of last two letters read -- 1+3+9 = 13 states Instead, nondeterministic transition relation: Delta is set of triples (q,a,q') - Can have zero or more moves for each combination (q,a) - Accept if at least one run accepts Nondeterminism = ability to always guess perfectly, if a good guess is possible For the language above: Read {a,b,c} in initial state. Guess that a given a is the second last letter, make two moves on a and accept. Loop on {a,b,c} q_in ---a---> q_1 ---a---> f Constructions on NFA Union and Intersection: Use product construction, like DFA Emptiness: graph reachability: path from initial state to some final state Complementation? Not enough to exchange final and non-final states Subset construction: converts an NFA to an equivalent DFA NFA : (Q,Delta,q_in,F) DFA : (2^Q, delta, {q_in}, FF) delta(X,a) = { q' | q' in Delta(q,a) for some q in X } FF = { X in 2^Q | F intersection X is nonempty } To complement, convert NFA to DFA and then exchange final/non final states. In general, this blows up the state space by an exponential factor. More examples: There is some pair of b's with only a's in between (over {a,b,c}) - we allow the pair of b's to be consecutive There is no such pair of b's For every pair of consecutive b's, we have only a's in between Formal MSO syntax - Variables x, y, z, ... denoting positions - Variables X, Y, Z, ... denoting sets of positions - Constants min and max - the atomic formulas (with explicit semantics) - x = y - S(x,y) - x < y - P_a(x) - X(y) "y belongs to X" - min and max can be used in atomic formulas in place of x, y - Boolean connectives and quantifiers (individual and set) Words as models (underlying structure, canonical interpretation etc) word w -> model ^w Formulas with free variables: assign values to individual and free variables: (^w,i1,...,im,I1....,In) |= phi(x1,...,xm,X1,..,Xn) ^w |= phi(i1,...,im,I1....,In) MSO definable languages Sentence phi L = { w | ^w |= phi } ----------------------------------------------------------------------