Notes
Outline
Finite Model Theory
Lecture 11
Second Order Logic
Outline
Chapter 7 in the textbook:
Games for SO, application to reachability
Buchi’s theorem
Star Free Languages
Tree automata
Buchi’s Theorem
Proof
Part 1: regular languages µ MSO
Every regular language is in 9MSO
  [in class]
Every regular language is in 8 MSO
  [in class]
Buchi’s Theorem
MSO µ regular languages
This is harder: let f 2 MSO.  Need to show that the set {M | M ² f} is regular
Proof 1 (not in the book): induction on f [in class]
Proof 2 (from the book): using types [in class]
Applications
Corollary 
Over strings, 9 MSO = 8 MSO = MSO
Does this hold in general ?
Applications
Consider s = {<}
A structure M = a string in {1}* = a number
Applications
Proposition Hamiltonean path on undirected graphs is not definable in MSO
Proof in class
Star-free regular languages
Let S = {a,b,c}  (can be larger in general)
A regular language is defined by the grammar:
E ::= ;
E ::= e |  a  |  b  |  c
E ::= E [ E
E ::= E.E
E ::= E*
A star-free regular language:
drop  E*, add E  (need overline, not underline)
Star-free Regular Languages
Which of the following are star-free ?
Theorem
L is star-free iff it is in FO.
L is regular iff it is in MSO
Ranked Trees
A ranked alphabet is a set S and r : S ! N
For a 2 S, r = r(a) ¸ 0 is it’s rank; also write ar
Rank(S)=max(r(a) | a 2 S)
A ranked tree T is a tree labeled with symbols in S s.t. each node x labeled with a has exactly r(a) children
Tree Automtata
Notations:
Trees(S)
A tree language is L µ Tree(S)
This generalizes languages over strings (why ?)
Example
Symbolic expressions:

S = {a,b,c,f1,g2,h2,k3}
Tree Automata
A = (S, Q, q0, d, F) where:

q0 2 Q,   F µ Q
d is a set of tuples of the form:
        (w, a, q)    w 2 Q*, a 2 S, q 2 Q, s.t. |w| = r(a)
Execution: given a tree T, A executes
bottom up or top down  [show in class]
A language L µ Tree[S] is a regular tree language iff there exists A s.t. L = {T | T accepted by A}
Tree Automata
Example: S = {0,1,:, Æ, Ç}
A = (S, Q, q0, d, F)
Q = {false, true}
q0 = (not needed)
F = { true }
 d = (e, 0, false), (e, 1, true)
    (false, :, true), (true, :, false)
    (false.false, Æ, false), …, (true.true, Æ, true)
    (false.false, Ç, false), …, (true.true, Ç, true)
Ranked Trees as Structures
Let’s restrict to Rank(S) = 2
easy to generalize
Let s = {<, (Pa)a 2 S, succ1, succ2}
Consider only structures in STRUCT[s] that are trees, where < is the ancestor-descendant relation, and succ1, succ2 are the left and right child respectively
MSO and Regular Tree Languages
Theorem A set of trees is definable in MSO iff it is regular
Proof: almost identical to Buchi’s theorem
What are star-free regular tree languages ?