Descriptive Complexity
and Nested Words
Neil Immerman
www.cs.umass.edu/∼immerman
I decided to start with a survey of Descriptive Complexity,
and end with a survey of Nested Words.
Please ask questions during my talk because two-way
communication is more fun and allows much more
understanding!
Descriptive Complexity and Nested Words – 1/46
Descriptive Complexity
Descriptive Complexity and Nested Words – 1/46
Descriptive Complexity
Input
q1 q2 · · · qn
Output
7
→
Computation →
7
a1 a2 · · · ai · · · ank
Descriptive Complexity and Nested Words – 1/46
Descriptive Complexity
Input
q1 q2 · · · qn
Output
7
→
Computation →
7
a1 a2 · · · ai · · · ank
Descriptive Complexity and Nested Words – 1/46
Descriptive Complexity
Input
q1 q2 · · · qn
7→ Computation 7→
Descriptive Complexity and Nested Words – 1/46
Output
a
Descriptive Complexity
Input
q1 q2 · · · qn
7→ Computation 7→
Output
a
How much computation is needed to check if input has
property S ?
Descriptive Complexity and Nested Words – 1/46
Descriptive Complexity
Input
q1 q2 · · · qn
7→ Computation 7→
Output
a
How much computation is needed to check if input has
property S ?
How rich a language do we need to express property S ?
Descriptive Complexity and Nested Words – 1/46
Encode Input as Finite Logical Structure
Graph
({v1 , . . . , vn }, E, s, t)
G =
r
*
r
r
*
H
s HH r
jH
H
HH
jr
H
Binary
String
Aw
S
w
r
H
HH
j
H
r
*
t
r
= ({p1 , . . . , p8 }, S)
= {p2 , p5 , p7 , p8 }
= 01001011
Vocabularies: τg = (E 2 , s, t),
τs = (S 1 )
Descriptive Complexity and Nested Words – 2/46
First-Order Logic
from τ
x, y, z, . . .
∧, ∨, ¬
∀, ∃
=, ≤, +, ×, 0, max
input symbols:
variables:
boolean connectives:
quantifiers:
numeric symbols:
α
≡
∀x∃y(E(x, y))
∈ L(τg )
β
≡
∃x∀y(x ≤ y ∧ S(x)) ∈
L(τs )
β
≡
S(0)
∈
L(τs )
Descriptive Complexity and Nested Words – 3/46
Second-Order Logic
= first-order logic + quantifiable relational variables
Φ3−color ≡ ∃ R1 Y 1 B 1 ∀ x y ((R(x) ∨ Y (x) ∨ B(x)) ∧
(E(x, y) → (¬(R(x) ∧ R(y)) ∧ ¬(Y (x) ∧ Y (y))
∧
s
¬(B(x) ∧ B(y)))))
t
d
b
a
f
c
g
e
Descriptive Complexity and Nested Words – 4/46
Second-Order Logic
NP = SO∃
Fagin’s Theorem:
Φ3−color ≡ ∃ R1 Y 1 B 1 ∀ x y ((R(x) ∨ Y (x) ∨ B(x)) ∧
(E(x, y) → (¬(R(x) ∧ R(y)) ∧ ¬(Y (x) ∧ Y (y))
∧
s
¬(B(x) ∧ B(y)))))
t
d
b
c
a
g
f
e
Descriptive Complexity and Nested Words – 4/46
Addition is First-Order
Q+ : STRUC[τAB ] → STRUC[τs ]
A
B
a1
+ b1
a2
b2
...
...
an−1
bn−1
an
bn
S
s1
s2
...
sn−1
sn
C(i) ≡ (∃j > i) A(j) ∧ B(j) ∧
(∀k.j > k > i)(A(k) ∨ B(k))
Q+ (i) ≡ A(i) ⊕ B(i) ⊕ C(i)
Descriptive Complexity and Nested Words – 5/46
Parallel Machines
CRAM[t(n)] = CRCW-PRAM-TIME[t(n)]-HARD[nO(1) ]
Pr
P
1
P2
Global
Memory
P3
P4
P5
synchronous, concurrent read and write
nO(1) processors and memory
Descriptive Complexity and Nested Words – 6/46
Parallel Machines
CRAM[t(n)] = CRCW-PRAM-TIME[t(n)]-HARD[nO(1) ]
Pr
P
1
P2
Global
Memory
P3
P4
P5
Quantifiers are parallel: If array A[x] : x = 1, . . . , r in
memory, ∀x(A(x)) ≡ write(1); proc pi : if (A[i] = 0) then
Descriptive Complexity and Nested Words – 6/46
write(0)
Parallel Machines
CRAM[t(n)] = CRCW-PRAM-TIME[t(n)]-HARD[nO(1) ]
Pr
P
1
1
1
P2
1
1
Global
1
1
Memory
0
P3
1
1
1
1
P4
P5
Quantifiers are parallel: If array A[x] : x = 1, . . . , r in
memory, ∀x(A(x)) ≡ write(1); proc pi : if (A[i] = 0) then
Descriptive Complexity and Nested Words – 6/46
write(0)
Parallel Machines
CRAM[t(n)] = CRCW-PRAM-TIME[t(n)]-HARD[nO(1) ]
Pr
P
1
1
1
P2
1
1
Global
1
1
Memory
0
P3
0
1
1
1
P4
P5
Quantifiers are parallel: If array A[x] : x = 1, . . . , r in
memory, ∀x(A(x)) ≡ write(1); proc pi : if (A[i] = 0) then
Descriptive Complexity and Nested Words – 6/46
write(0)
Inductive Definitions
E ⋆ (x, y)
≡ x = y ∨ E(x, y) ∨ ∃z(E ⋆ (x, z) ∧ E ⋆ (z, y))
r
*
r
r
H
*
s HH jH
H
r
HH
jr
H
r
H
HH
jr
H
*
t
r
Descriptive Complexity and Nested Words – 7/46
Inductive Definitions
E ⋆ (x, y)
ϕtc (R, x, y)
≡ x = y ∨ E(x, y) ∨ ∃z(E ⋆ (x, z) ∧ E ⋆ (z, y))
≡ x = y ∨ E(x, y) ∨ ∃z(R(x, z) ∧ R(z, y))
A ∈ REACH
r
*
r
r
H
*
s HH jH
H
r
H
H
jr
H
⇔
A |= (LFPϕtc )(s, t)
r
H
H
H
jr
H
*
t
r
Descriptive Complexity and Nested Words – 7/46
Inductive Definitions
E ⋆ (x, y)
ϕtc (R, x, y)
≡ x = y ∨ E(x, y) ∨ ∃z(E ⋆ (x, z) ∧ E ⋆ (z, y))
≡ x = y ∨ E(x, y) ∨ ∃z(R(x, z) ∧ R(z, y))
A ∈ REACH
⇔
A |= (LFPϕtc )(s, t)
Thus, REACH ∈ IND[log n].
r
*
r
r
H
*
s HH jH
H
r
H
H
jr
H
r
H
H
H
jr
H
*
t
r
Descriptive Complexity and Nested Words – 7/46
Inductive Definitions
E ⋆ (x, y)
ϕtc (R, x, y)
≡ x = y ∨ E(x, y) ∨ ∃z(E ⋆ (x, z) ∧ E ⋆ (z, y))
≡ x = y ∨ E(x, y) ∨ ∃z(R(x, z) ∧ R(z, y))
A ∈ REACH
⇔
A |= (LFPϕtc )(s, t)
Thus, REACH ∈ IND[log n].
r
*
r
r
H
*
s HH jH
H
r
H
H
jr
H
r
H
H
H
jr
H
*
t
r
Next, we’ll show that REACH ∈ FO[log n].
Descriptive Complexity and Nested Words – 7/46
ϕtc (R, x, y)
≡
x = y ∨ E(x, y) ∨ (∃z)(R(x, z) ∧ R(z, y))
1. Dummy universal quantification for base case:
ϕtc (R, x, y) ≡ (∀z.M1 )(∃z)(R(x, z) ∧ R(z, y))
M1 ≡ ¬(x = y ∨ E(x, y))
Descriptive Complexity and Nested Words – 8/46
ϕtc (R, x, y)
≡
x = y ∨ E(x, y) ∨ (∃z)(R(x, z) ∧ R(z, y))
1. Dummy universal quantification for base case:
ϕtc (R, x, y) ≡ (∀z.M1 )(∃z)(R(x, z) ∧ R(z, y))
M1 ≡ ¬(x = y ∨ E(x, y))
2. Using ∀, replace two occurrences of R with one:
ϕtc (R, x, y) ≡ (∀z.M1 )(∃z)(∀uv.M2 )R(u, v)
M2 ≡ (u = x ∧ v = z) ∨ (u = z ∧ v = y)
Descriptive Complexity and Nested Words – 8/46
ϕtc (R, x, y)
≡
x = y ∨ E(x, y) ∨ (∃z)(R(x, z) ∧ R(z, y))
1. Dummy universal quantification for base case:
ϕtc (R, x, y) ≡ (∀z.M1 )(∃z)(R(x, z) ∧ R(z, y))
M1 ≡ ¬(x = y ∨ E(x, y))
2. Using ∀, replace two occurrences of R with one:
ϕtc (R, x, y) ≡ (∀z.M1 )(∃z)(∀uv.M2 )R(u, v)
M2 ≡ (u = x ∧ v = z) ∨ (u = z ∧ v = y)
3. Requantify x and y .
M3
≡
(x = u ∧ y = v)
ϕtc (R, x, y) ≡ (∀z.M1 )(∃z)(∀uv.M2 )(∃xy.M3 )R(x, y)
Descriptive Complexity and Nested Words – 8/46
Define the quantifier block:
QBtc ≡ (∀z.M1 )(∃z)(∀uv.M2 )(∀xy.M3 )
Operator ϕtc is equivalent to QBtc :
ϕtc (R, x, y)
Thus, for any r,
≡
[QBtc ]R(x, y)
ϕrtc (∅) ≡ [QBtc ]r (false)
Thus, for any structure A ∈ STRUC[τg ],
A ∈ REACH ⇔ A |= (LFPϕtc )(s, t)
⇔ A |= ([QBtc ]⌈1+log ||A||⌉ false)(s, t)
Descriptive Complexity and Nested Words – 9/46
CRAM[t(n)] = concurrent parallel random access
machine; polynomial hardware, parallel time O(t(n))
IND[t(n)] = first-order, depth t(n) inductive definitions
FO[t(n)] = t(n) repetitions of a block of restricted
quantifiers:
QB = [(Q1 x1 .M1 ) · · · (Qk xk .Mk )];
ϕn
=
Mi quantifier-free
[QB][QB] · · · [QB] M0
{z
}
|
t(n)
Descriptive Complexity and Nested Words – 10/46
parallel time = inductive depth = quantifier-block iteration
Thm:
For all constructible, polynomially bounded t(n),
CRAM[t(n)] = IND[t(n)] = FO[t(n)]
Thm:
For all t(n), even beyond polynomial,
CRAM[t(n)]
=
FO[t(n)]
Descriptive Complexity and Nested Words – 11/46
Thm: For v = 1, 2, . . . ,
DSPACE[nv ] = VAR[v + 1]
Number of variables corresponds to amount of hardware.
Since variables range over a universe of size n, a constant
number of variables can specify a polynomial number of
gates:
A bounded number of variables corresponds to
polynomially much hardware.
Descriptive Complexity and Nested Words – 12/46
Arithmetic Hierarchy
co−r.e.
complete
r.e.
complete
r.e.
co−r.e.
Recursive
Primitive Recursive
EXPTIME
PSPACE
co−NP
complete
Polynomial−Time Hierarchy
NP
complete
NP
co−NP
NP
co−NP
P
"truly feasible"
NC
log(CFL)
NSPACE[log n]
DSPACE[log n]
Regular
FO
0
AC
Descriptive Complexity and Nested Words – 13/46
Arithmetic Hierarchy
co−r.e.
complete
r.e.
complete
r.e.
co−r.e.
Recursive
Primitive Recursive
EXPTIME
PSPACE
co−NP
complete
Polynomial−Time Hierarchy
NP
complete
NP
co−NP
NP
co−NP
P
"truly feasible"
NC
NC 2
log(CFL)
1
SAC
NSPACE[log n]
DSPACE[log n]
1
NC
Regular
0
ThC
FO
Logarithmic−Time Hierarchy
0
AC
Descriptive Complexity and Nested Words – 14/46
Arithmetic Hierarchy
co−r.e.
complete
r.e.
complete
r.e.
co−r.e.
Recursive
Primitive Recursive
EXPTIME
PSPACE
Polynomial−Time Hierarchy
NP
complete
NP
co−NP
SO
NP
E
co−NP
complete
co−NP
FO(LFP)
P
"truly feasible"
NC
NC 2
log(CFL)
FO(TC)
1
SAC
NSPACE[log n]
DSPACE[log n]
1
NC
Regular
0
ThC
FO
Logarithmic−Time Hierarchy
0
AC
Descriptive Complexity and Nested Words – 15/46
Arithmetic Hierarchy
co−r.e.
complete
r.e.
complete
r.e.
co−r.e.
Recursive
Primitive Recursive
EXPTIME
O(1)
PSPACE
]
FO(PFP)
Polynomial−Time Hierarchy
co−NP
complete
NP
complete
NP
co−NP
SO
NP
FO[n
O(1)
E
FO[2
n
co−NP
FO(LFP)
P
]
"truly feasible"
FO[(log n)
O(1)
NC
]
NC 2
log(CFL)
FO(TC)
FO(DTC)
1
SAC
NSPACE[log n]
DSPACE[log n]
1
NC
Regular
0
FO(M)
FO
ThC
Logarithmic−Time Hierarchy
0
AC
Descriptive Complexity and Nested Words – 16/46
Arithmetic Hierarchy
co−r.e.
complete
r.e.
complete
r.e.
co−r.e.
Recursive
Primitive Recursive
EXPTIME
O(1)
PSPACE
]
Polynomial−Time Hierarchy
co−NP
complete
SO
co−NP
NP
complete
NP
SO
A
SO
FO(PFP)
NP
FO[n
O(1)
co−NP
FO(LFP)
P
]
SO−Horn
"truly feasible"
FO[(log n)
O(1)
E
FO[2
n
NC
]
NC 2
log(CFL)
FO(TC)
FO(DTC)
1
SAC
NSPACE[log n]
SO−Krom
DSPACE[log n]
1
NC
Regular
0
FO(M)
FO
ThC
Logarithmic−Time Hierarchy
0
AC
Descriptive Complexity and Nested Words – 17/46
Arithmetic Hierarchy
co−r.e.
complete
r.e.
complete
r.e.
co−r.e.
Recursive
Primitive Recursive
SO[2
O(1)
SO[n
]
O(1)
]
SO(LFP)
PSPACE
SO(TC)
FO(PFP)
Polynomial−Time Hierarchy
co−NP
complete
SO
co−NP
NP
complete
NP
SO
A
SO
EXPTIME
]
NP
FO[n
O(1)
co−NP
FO(LFP)
P
]
SO−Horn
"truly feasible"
FO[(log n)
O(1)
E
FO[2
n
n O(1)
NC
]
NC 2
log(CFL)
FO(TC)
FO(DTC)
1
SAC
NSPACE[log n]
SO−Krom
DSPACE[log n]
1
NC
Regular
0
FO(M)
FO
ThC
Logarithmic−Time Hierarchy
0
AC
Descriptive Complexity and Nested Words – 18/46
Arithmetic Hierarchy
FO (N)
co−r.e.
A
FO (N)
r.e.
complete
r.e.
E
co−r.e.
complete
FO (N)
Recursive
Primitive Recursive
SO[2
O(1)
SO[n
]
O(1)
]
SO(LFP)
PSPACE
SO(TC)
FO(PFP)
Polynomial−Time Hierarchy
co−NP
complete
SO
co−NP
NP
complete
NP
SO
A
SO
EXPTIME
]
NP
FO[n
O(1)
co−NP
FO(LFP)
P
]
SO−Horn
"truly feasible"
FO[(log n)
O(1)
E
FO[2
n
O(1)
n
NC
]
NC 2
log(CFL)
FO(TC)
FO(DTC)
1
SAC
NSPACE[log n]
SO−Krom
DSPACE[log n]
1
NC
Regular
0
FO(M)
FO
ThC
Logarithmic−Time Hierarchy
0
AC
Descriptive Complexity and Nested Words – 19/46
We Need an Ordering on the Universe
G = (V, E);
V = {0, 1, . . . , n − 1};
0 < 1 < ··· < n − 1
An unordered graph makes sense mathematically, but you
can’t store such an object in a computer as far as I know.
If you remove the ordering then the first-order descriptive
characterizations fail:
EVEN requires Ω(n) variables without ordering.
Thus, EVEN 6∈
O(1)
n
];
FO(wo≤)[2
O(1)
n
(FO[2
]
= PSPACE)
Fagin (SO∃ = NP) didn’t run into this problem because in
SO∃ you can guess an ordering (unless we are dealing with
SO∃(monadic)).
Descriptive Complexity and Nested Words – 20/46
Ehrenfeucht-Fraïssé Games
Delilah: hide any differences between the two structures
Two-person combinatorial game for characterizing what is expressible in a given
quantifier depth.
Fundamental Thm: D has a winning strategy on the m-move, k -pebble game on
A, B iff A and B agree on all formulas using k variables and quantifier depth m.
A ∼km B
⇔
Samson: show a difference
Descriptive Complexity and Nested Words – 21/46
A ≡km B
dist(x, y) ≤ 2k
∈ FO3k
6∈ FOk−1
move 0
x
↓
• • ···
0 1 ···
• • ···
↑
x
•
···
2k−2 · · ·
•
···
•
···
2k−1 · · ·
•
···
•
···
2k−1 + 2k−2 · · ·
•
Descriptive Complexity and Nested Words – 22/46
···
y
↓
•
2k 2k + 1
•
•
↑
y
dist(x, y) ≤ 2k
move 1
x
↓
• • ···
0 1 ···
• • ···
↑
x
∈ FO3k
6∈ FOk−1
∃z(dist(x, z) ≤ 2k−1 ∧ dist(z, y) ≤ 2k−1 )
•
···
2k−2 · · ·
•
···
z
↓
•
···
2k−1 · · ·
•
···
•
···
2k−1 + 2k−2 · · ·
•
Descriptive Complexity and Nested Words – 22/46
···
y
↓
•
2k 2k + 1
•
•
↑
y
dist(x, y) ≤ 2k
move 1
x
↓
• • ···
0 1 ···
• • ···
↑
x
∈ FO3k
6∈ FOk−1
∃z(dist(x, z) ≤ 2k−1 ∧ dist(z, y) ≤ 2k−1 )
•
···
2k−2 · · ·
•
···
z
↓
•
···
2k−1 · · ·
•
↑
z
···
•
···
2k−1 + 2k−2 · · ·
•
Descriptive Complexity and Nested Words – 22/46
···
y
↓
•
2k 2k + 1
•
•
↑
y
dist(x, y) ≤ 2k
move 2
• • ···
0 1 ···
• • ···
∈ FO3k
6∈ FOk−1
∃x(dist(z, x) ≤ 2k−2 ∧ dist(x, y) ≤ 2k−2 )
•
···
2k−2 · · ·
•
···
z
↓
•
···
2k−1 · · ·
•
↑
z
···
x
↓
•
···
2k−1 + 2k−2 · · ·
•
Descriptive Complexity and Nested Words – 22/46
···
y
↓
•
2k 2k + 1
•
•
↑
y
dist(x, y) ≤ 2k
move 2
• • ···
0 1 ···
• • ···
∈ FO3k
6∈ FOk−1
∃x(dist(z, x) ≤ 2k−2 ∧ dist(x, y) ≤ 2k−2 )
•
···
2k−2 · · ·
•
···
z
↓
•
···
2k−1 · · ·
•
↑
z
···
x
↓
•
···
2k−1 + 2k−2 · · ·
•
↑
x
Descriptive Complexity and Nested Words – 22/46
···
y
↓
•
2k 2k + 1
•
•
↑
y
dist(x, y) ≤ 2k
∈ FO3k
6∈ FOk−1
move k-1: Delilah wins
dist(x, y) ≤ 21
• • ···
x
y
↓
↓
··· • • •
0 1 ···
• • ···
•
···
2k−2 · · ·
•
···
•
2k−1 · · ·
•
···
···
•
···
2k 2k + 1
• • • • ···
↑
↑
x
y
Descriptive Complexity and Nested Words – 22/46
•
•
dist(x, y) ≤ 2k
∈ FO3k
6∈ FOk−1
move k: Samson wins
E(x, z) ∧ E(z, y)
• • ···
x z y
↓ ↓ ↓
··· • • •
0 1 ···
• • ···
•
···
2k−2 · · ·
•
···
•
2k−1 · · ·
•
···
···
•
···
2k 2k + 1
• • • • ···
↑
↑
x
y
Descriptive Complexity and Nested Words – 22/46
•
•
These games have been used to prove many beautiful
lower bounds without the ordering, and thus separate most
descriptive classes without ordering. Among others:
McColm and Grädel: DTC, TC, LFP
Grohe: arity hierarchies for TC and LFP
Etessami: lower bounds with counting and one-way
local orderings
Libkin: lower bounds with counting via locality
arguments
Grohe and Schwentick: locality of order-independent
queries
Descriptive Complexity and Nested Words – 23/46
One Historical Thread
Fagin: REACH 6∈ SO∃(monadic) and thus since
REACH ∈ SO∃(monadic), SO∃(monadic) is not closed
under complementation.
de Rougemont: remains true with successor
Schwentick: remains true with ordering!
Doesn’t give us a complexity lower bound, cf.,
Lynch: NTIME[nk ] ⊆ SO∃(+)(arity k)
Descriptive Complexity and Nested Words – 24/46
Ehrenfeucht-Fraïssé games: lower bounds on depth.
With ordering, depth 2 + log n suffices to express any graph
property for graphs on n vertices. Let G = (V, E)
#i (x) ≡ “exists a path of length i from 0 to x” ∈ depth(log n)
^
ϕG ≡
∃x, y(#i (x) ∧ #j (y) ∧ E(x, y))
hi,ji∈E
^
∃x, y(#i (x) ∧ #j (y) ∧ ¬E(x, y))
hi,ji6∈E
For S an arbitrary set of graphs on n vertices:
ϕS ≡
_
ϕG ;
depth(ϕS ) = 2 + log n
G∈S
Descriptive Complexity and Nested Words – 25/46
∧
Newish Size Lower Bound Game
Adler & I defined these games and proved a pair of optimal
succinctness result for temporal logics.
Karchmer and Wigderson used similar communication
complexity games to prove lower bound on monotone
circuits for REACH.
Idea: unlike Ehrenfeucht-Fraïssé games, we play on a pair
of sets of structures, A, B . We determine the size of the
smallest sentence true of all of A and none of B .
More recent lower bounds by Grohe and Schweikardt
Descriptive Complexity and Nested Words – 26/46
Newish Size Lower Bound Game
Adler & I defined these games and proved a pair of optimal
succinctness result for temporal logics.
Karchmer and Wigderson used similar communication
complexity games to prove lower bound on monotone
circuits for REACH.
Idea: unlike Ehrenfeucht-Fraïssé games, we play on a pair
of sets of structures, A, B . We determine the size of the
smallest sentence true of all of A and none of B .
More recent lower bounds by Grohe and Schweikardt
Not surprisingly, these games are much harder to play than
Ehrenfeucht-Fraïssé games . . .
Descriptive Complexity and Nested Words – 26/46
Size versus Number of Variables on Line Graphs
dist(x, y) ≤ 1 ≡ x = y ∨ E(x, y)
dist(x, y) ≤ 2k ≡ ∃z(dist(x, z) ≤ k ∧ dist(z, y) ≤ k)
dist(x, y) ≤ n ∈ FO3log n ;
SIZE(n)
Descriptive Complexity and Nested Words – 27/46
Size versus Number of Variables on Line Graphs
dist(x, y) ≤ 1 ≡ x = y ∨ E(x, y)
dist(x, y) ≤ 2k ≡ ∃z(dist(x, z) ≤ k ∧ dist(z, y) ≤ k)
dist(x, y) ≤ n ∈ FO3log n ;
SIZE(n)
distu (x, y) ≤ 1 ≡ x = y ∨ E(x, y) ∨ E(y, x)
distu (x, y) ≤ 2k ≡ ∃z∀w((w = x ∨ w = y) → distu (z, w) ≤ k)
distu (x, y) ≤ n ∈ FO4log n ;
SIZE(O(log n))
Descriptive Complexity and Nested Words – 27/46
Size versus Number of Variables on Line Graphs
dist(x, y) ≤ 1 ≡ x = y ∨ E(x, y)
dist(x, y) ≤ 2k ≡ ∃z(dist(x, z) ≤ k ∧ dist(z, y) ≤ k)
dist(x, y) ≤ n ∈ FO3log n ;
SIZE(n)
distu (x, y) ≤ 1 ≡ x = y ∨ E(x, y) ∨ E(y, x)
distu (x, y) ≤ 2k ≡ ∃z∀w((w = x ∨ w = y) → distu (z, w) ≤ k)
distu (x, y) ≤ n ∈ FO4log n ;
SIZE(O(log n))
Grohe-Schweikardt:
FO2 and FO3 are polynomially SIZE-related
Exponential Size gap between FO3 and FO4
Gap between FOk and FOk+1 is open for k > 3
Descriptive Complexity and Nested Words – 27/46
FO2 on Words: [Philipp Weis & I]
FO on words reduces to FO3 on words
FO2 on words was well studied, except alternation
hierarchy was open
Descriptive Complexity and Nested Words – 28/46
FO2 on Words: [Philipp Weis & I]
FO on words reduces to FO3 on words
FO2 on words was well studied, except alternation
hierarchy was open
Rankers
b a c d b b a c d
Descriptive Complexity and Nested Words – 28/46
FO2 on Words: [Philipp Weis & I]
FO on words reduces to FO3 on words
FO2 on words was well studied, except alternation
hierarchy was open
Rankers
b a c d b b a c d
↑
⊲a
1 ranker
Descriptive Complexity and Nested Words – 28/46
FO2 on Words: [Philipp Weis & I]
FO on words reduces to FO3 on words
FO2 on words was well studied, except alternation
hierarchy was open
Rankers
b a c d b b a c d
↑
⊲a ⊲ b
2 ranker
Descriptive Complexity and Nested Words – 28/46
FO2 on Words: [Philipp Weis & I]
FO on words reduces to FO3 on words
FO2 on words was well studied, except alternation
hierarchy was open
Rankers
b a c d b b a c d
↑
⊲a ⊲ b ⊳ c
3 ranker
Descriptive Complexity and Nested Words – 28/46
FO2 on Words: [Philipp Weis & I]
FO on words reduces to FO3 on words
FO2 on words was well studied, except alternation
hierarchy was open
Rankers
b a c d b b a c d
⊲a ⊲ b ⊳ c ⊳ d
4 ranker
Descriptive Complexity and Nested Words – 28/46
FO2 on Words: [Philipp Weis & I]
FO on words reduces to FO3 on words
FO2 on words was well studied, except alternation
hierarchy was open
Rankers
b a c d b b a c d
↑
Thm:
FO2m
≡
⊲a ⊲ b ⊳ c
3 ranker
which m-rankers exist, and,
relative order with smaller rankers.
Descriptive Complexity and Nested Words – 28/46
FO2 on Words: [Philipp Weis & I]
FO on words reduces to FO3 on words
FO2 on words was well studied, except alternation
hierarchy was open
Rankers
b a c d b b a c d
↑
Thm:
FO2m
Thm:
FO2k,m
≡
≡
⊲a ⊲ b ⊳ c
2, 3 ranker
which m-rankers exist, and,
relative order with smaller rankers.
which k, m-rankers exist, and,
relative order with smaller rankers.
Descriptive Complexity and Nested Words – 28/46
FO2 on Words: [Philipp Weis & I]
FO on words reduces to FO3 on words
FO2 on words was well studied, except alternation
hierarchy was open
Rankers
b a c d b b a c d
↑
Thm:
FO2m
Thm:
FO2k,m
≡
≡
⊲a ⊲ b ⊳ c
2, 3 ranker
which m-rankers exist, and,
relative order with smaller rankers.
which k, m-rankers exist, and,
relative order with smaller rankers.
Thm: FO2 has a strict alternation hierarchy.
Descriptive Complexity and Nested Words – 28/46
Ultimately, want to understand the VAR-SIZE trade-off in
many settings.
Currently, Philipp Weis and I would be happy to settle what
Grohe and Schweikardt left open, then to move on to
words, and other simple graphs, 2 and 3 variables . . .
Descriptive Complexity and Nested Words – 29/46
Ultimately, want to understand the VAR-SIZE trade-off in
many settings.
Currently, Philipp Weis and I would be happy to settle what
Grohe and Schweikardt left open, then to move on to
words, and other simple graphs, 2 and 3 variables . . .
Would one day like to understand the following:
PSPACE
NC1
nO(1)
=
FO[2
⊆
]
=
SO[nO(1) ]
FO[log n/ log log n]
NC1 ⊆ L ⊆ NL ⊆ sAC1 ⊆ AC1 = FO[log n]
Descriptive Complexity and Nested Words – 29/46
Arithmetic Hierarchy
FO (N)
co−r.e.
A
FO (N)
r.e.
complete
r.e.
E
co−r.e.
complete
FO (N)
Recursive
Primitive Recursive
SO[2
O(1)
SO[n
]
O(1)
]
SO(LFP)
PSPACE
SO(TC)
FO(PFP)
Polynomial−Time Hierarchy
co−NP
complete
SO
co−NP
NP
complete
NP
SO
A
SO
EXPTIME
]
NP
FO[n
O(1)
co−NP
FO(LFP)
P
]
SO−Horn
"truly feasible"
FO[(log n)
O(1)
E
FO[2
n
O(1)
n
NC
]
NC 2
log(CFL)
FO(TC)
FO(DTC)
1
SAC
NSPACE[log n]
SO−Krom
DSPACE[log n]
1
NC
Regular
0
FO(M)
FO
ThC
Logarithmic−Time Hierarchy
0
AC
Descriptive Complexity and Nested Words – 30/46
Nested Words & Descriptive Complexity
Neil Immerman
www.cs.umass.edu/∼immerman
I’ll survey work by Alur, Madhusudan, Kumar, Viswanathan,
Arenas, Barceló, Etessami, and Libkin [LICS 2007].
Descriptive Complexity and Nested Words – 31/46
Nested Words
0
0
1
0
1
1
0
Descriptive Complexity and Nested Words – 32/46
1
0
1
0
Nested Words
0
0
1
0
1
1
0
1
0
1
words on some alphabet, Σ
well-nested edges
Three kinds of nodes: call, return, and internal
Descriptive Complexity and Nested Words – 32/46
0
Nested Words
0
0
1
0
1
1
0
1
0
1
0
words on some alphabet, Σ
well-nested edges
Three kinds of nodes: call, return, and internal
Applications:
calls and returns: model checking recursive programs
parse trees: linguistics
XML
Descriptive Complexity and Nested Words – 32/46
Nested Words
0
0
1
0
1
1
0
1
0
1
0
words on some alphabet, Σ
well-nested edges
Three kinds of nodes: call, return, and internal
Applications:
calls and returns: model checking recursive programs
parse trees: linguistics
XML
“CFL’s for the price of regular languages”
Descriptive Complexity and Nested Words – 32/46
Nested Word Automata: NWA
An NWA, (Q, Σ, δ, s, F ), is just like a finite automaton
except, at return nodes, the new state depends on both
previous states.
0
q
0
0
q
1
1
q
2
0
q
3
1
q
4
1
q
5
0
q
6
1
q
7
For example, q4 = δr (q1 , q3 , 0)
Descriptive Complexity and Nested Words – 33/46
0
q
8
1
q
9
0
q
10
q
11
Example of a Regular Nested Language
The balanced parentheses languages of nested words, in
which the nesting edges go from each open parenthesis to
its mate, are regular.
[
(
a
)
(
a
)
Descriptive Complexity and Nested Words – 34/46
]
[
]
a
Regular Nested Languages
Closed under ∪, ∩,⋆ , concatenation, complementation.
For every n-state nondeterministic NWA, there is an
2
n
equivalent deterministic NWA with at most 2 states.
EMPTY-NWA, minimal deterministic NWA, union
intersection, language containment for deterministic
NWA are all polynomial time.
Language containment given nondeterministic NWA’s
is exptime complete.
Compare this with CFL’s where containment is undecidable.
Descriptive Complexity and Nested Words – 35/46
(u, i) ⊕ v = insert v after letter i in u.
Descriptive Complexity and Nested Words – 36/46
(u, i) ⊕ v = insert v after letter i in u.
⊕
h
e
r
e
g
o
e
s
Descriptive Complexity and Nested Words – 36/46
n
e
w
(u, i) ⊕ v = insert v after letter i in u.
⊕
h
e
r
e
g
o
e
s
n
e
w
=
h
e
r
e
n
e
w
Descriptive Complexity and Nested Words – 36/46
g
o
e
s
Myhill Nerode Theorem for Nested Words
x ∼L y
iff
∀u, i
(u, i) ⊕ x ∈ L
↔
Descriptive Complexity and Nested Words – 37/46
(u, i) ⊕ y ∈ L
Myhill Nerode Theorem for Nested Words
x ∼L y
iff
∀u, i
(u, i) ⊕ x ∈ L
↔
(u, i) ⊕ y ∈ L
Thm: [Alur, Kumar, Madhusudan, and Viswanathan]
The nested word language, L, is regular
iff
∼L
has finitely many equivalence classes.
Descriptive Complexity and Nested Words – 37/46
Notation
µ(i, j):
i is a call node,
and j is its matching return
r(i) = j
a
c(j) = i
i
m
j
Descriptive Complexity and Nested Words – 38/46
z
Notation
µ(i, j):
i is a call node,
and j is its matching return
r(i) = j
a
c(j) = i
i
m
j
z
C(x) is the innermost call that x is within, e.g.,
C(i) = C(j) = a;
Descriptive Complexity and Nested Words – 38/46
C(m) = i
Notation
µ(i, j):
i is a call node,
and j is its matching return
r(i) = j
a
c(j) = i
i
m
j
z
C(x) is the innermost call that x is within, e.g.,
C(i) = C(j) = a;
C(m) = i
R(x) is the innermost return that x is within, e.g.,
R(i) = R(j) = z;
R(m) = j
Descriptive Complexity and Nested Words – 38/46
Monadic Second-Order Logic, (MSOµ )
ϕ := Qa (x) | x ∈ X | x ≤ y | µ(x, y) | ¬ϕ | ϕ∨ϕ | ∃x(ϕ) | ∃X(ϕ)
Descriptive Complexity and Nested Words – 39/46
Monadic Second-Order Logic, (MSOµ )
ϕ := Qa (x) | x ∈ X | x ≤ y | µ(x, y) | ¬ϕ | ϕ∨ϕ | ∃x(ϕ) | ∃X(ϕ)
Thm: [Alur and Madhusudan]
MSOµ = Regular Nested Languages
Descriptive Complexity and Nested Words – 39/46
Monadic Second-Order Logic, (MSOµ )
ϕ := Qa (x) | x ∈ X | x ≤ y | µ(x, y) | ¬ϕ | ϕ∨ϕ | ∃x(ϕ) | ∃X(ϕ)
Thm: [Alur and Madhusudan]
MSOµ = Regular Nested Languages
Proof: Similar to proof that MSO = Regular.
Descriptive Complexity and Nested Words – 39/46
Monadic Second-Order Logic, (MSOµ )
ϕ := Qa (x) | x ∈ X | x ≤ y | µ(x, y) | ¬ϕ | ϕ∨ϕ | ∃x(ϕ) | ∃X(ϕ)
Thm: [Alur and Madhusudan]
MSOµ = Regular Nested Languages
Proof: Similar to proof that MSO = Regular.
MSO ⊆ Regular: new case is µ(c, r). An NWA can check
that the call related to r was c.
Descriptive Complexity and Nested Words – 39/46
Monadic Second-Order Logic, (MSOµ )
ϕ := Qa (x) | x ∈ X | x ≤ y | µ(x, y) | ¬ϕ | ϕ∨ϕ | ∃x(ϕ) | ∃X(ϕ)
Thm: [Alur and Madhusudan]
MSOµ = Regular Nested Languages
Proof: Similar to proof that MSO = Regular.
MSO ⊆ Regular: new case is µ(c, r). An NWA can check
that the call related to r was c.
Regular ⊆ MSO: as usual, in MSO we guess the accepting
run of the automaton. New case: we use µ to check that the
return transitions are correct.
Descriptive Complexity and Nested Words – 39/46
Temporal Logic for Nested Words
Next Operators:
(w, i) |= ϕ
(w, i) |= µ ϕ
Past Operators:
(w, j) |= ⊖ ϕ
(w, j) |= ⊖µ ϕ
⇔
(w, i + 1) |= ϕ
⇔ ∃j µ(i, j) ∧ (w, j) |= ϕ
⇔
(w, j − 1) |= ϕ
⇔ ∃i µ(i, j) ∧ (w, i) |= ϕ
Since and Until Operators for several kinds of paths:
(w, i) |= αUβ
⇔
∃ path i = i0 < i1 < · · · < ik
(w, ik ) |= β ∧ ∀j < k(w, ij ) |= α
(w, i) |= αSβ
⇔
∃ path i = i0 > i1 > · · · > ik
(w, ik ) |= β ∧ ∀j < k(w, ij ) |= α
Descriptive Complexity and Nested Words – 40/46
4 Kinds of Paths
The sequence,
i = i0 < i1 < · · · < ik = j
is
a linear path if ip+1 = ip + 1
1
2
3
4
5
6
7
Descriptive Complexity and Nested Words – 41/46
8
9
10
11
4 Kinds of Paths
The sequence,
i = i0 < i1 < · · · < ik = j
a linear path if ip+1 = ip + 1
a call path if ip = C(ip+1 )
1
5
6
Descriptive Complexity and Nested Words – 41/46
is
4 Kinds of Paths
The sequence,
i = i0 < i1 < · · · < ik = j
is
a linear path if ip+1 = ip + 1
a call path if ip = C(ip+1 )
an abstract path if ip+1 =
2
4
5
(
r(ip )
ip + 1
7
Descriptive Complexity and Nested Words – 41/46
if ip is a call
otherwise
8
9
10
11
4 Kinds of Paths
The sequence,
i = i0 < i1 < · · · < ik = j
is
a linear path if ip+1 = ip + 1
a call path if ip = C(ip+1 )
an abstract path if ip+1 =
a summary path if(
ip+1 =
2
4
5
r(ip )
ip + 1
(
r(ip )
ip + 1
if ip is a call
otherwise
if ip is a call and r(ip ) ≤ j
otherwise
6
Descriptive Complexity and Nested Words – 41/46
4 Resulting Kinds of Until and Since Operators
linear paths: U, S
call paths: Uc , Sc
abstract paths: Ua , Sa
summary paths: Uσ , Sσ
(w, i) |= αUβ
⇔
∃ path i = i0 < i1 < · · · < ik
(w, ik ) |= β ∧ ∀j < k(w, ij ) |= α
(w, i) |= αSβ
⇔
∃ path i = i0 > i1 > · · · > ik
(w, ik ) |= β ∧ ∀j < k(w, ij ) |= α
Descriptive Complexity and Nested Words – 42/46
Nested Word Temporal Logic: NWTL
ϕ := a | ¬ϕ | ϕ ∨ ϕ | ϕ | µ ϕ | ⊖ ϕ | ⊖µ ϕ | ϕUσ ϕ | ϕSσ ϕ
Descriptive Complexity and Nested Words – 43/46
Nested Word Temporal Logic: NWTL
ϕ := a | ¬ϕ | ϕ ∨ ϕ | ϕ | µ ϕ | ⊖ ϕ | ⊖µ ϕ | ϕUσ ϕ | ϕSσ ϕ
Thm: [LICS 07] NWTL is exactly as expressive as FO
over finite, and over infinite, nested words.
Descriptive Complexity and Nested Words – 43/46
Nested Word Temporal Logic: NWTL
ϕ := a | ¬ϕ | ϕ ∨ ϕ | ϕ | µ ϕ | ⊖ ϕ | ⊖µ ϕ | ϕUσ ϕ | ϕSσ ϕ
Thm: [LICS 07] NWTL is exactly as expressive as FO
over finite, and over infinite, nested words.
Proof:
NWTL ⊆ FO: translate each ϕ ∈ NWTL to τ (ϕ) ∈ FO3 s.t.,
(w, i) |= ϕ
⇔
(w, i/x) |= τ (ϕ) .
Descriptive Complexity and Nested Words – 43/46
Nested Word Temporal Logic: NWTL
ϕ := a | ¬ϕ | ϕ ∨ ϕ | ϕ | µ ϕ | ⊖ ϕ | ⊖µ ϕ | ϕUσ ϕ | ϕSσ ϕ
Thm: [LICS 07] NWTL is exactly as expressive as FO
over finite, and over infinite, nested words.
Proof:
NWTL ⊆ FO: translate each ϕ ∈ NWTL to τ (ϕ) ∈ FO3 s.t.,
(w, i) |= ϕ
⇔
(w, i/x) |= τ (ϕ) .
Cor: Every formula in FO on nested words is equivalent to
a formula in FO3 , i.e., using at most three variables, x, y, z .
Descriptive Complexity and Nested Words – 43/46
Nested Word Temporal Logic: NWTL
ϕ := a | ¬ϕ | ϕ ∨ ϕ | ϕ | µ ϕ | ⊖ ϕ | ⊖µ ϕ | ϕUσ ϕ | ϕSσ ϕ
Thm: [LICS 07] NWTL is exactly as expressive as FO
over finite, and over infinite, nested words.
Proof:
NWTL ⊆ FO: translate each ϕ ∈ NWTL to τ (ϕ) ∈ FO3 s.t.,
(w, i) |= ϕ
⇔
(w, i/x) |= τ (ϕ) .
FO ⊆ NWTL: using FO-completeness of a temporal logic
on trees [Marx].
Cor: Every formula in FO on nested words is equivalent to
a formula in FO3 , i.e., using at most three variables, x, y, z .
Descriptive Complexity and Nested Words – 43/46
Model Checking
Thm: Satisfiability of NWTL is EXPTIME complete.
Descriptive Complexity and Nested Words – 44/46
Model Checking
Thm: Satisfiability of NWTL is EXPTIME complete.
Proof: [Sketch]
lower bound: Previously known from Caret Paper [AEM].
Descriptive Complexity and Nested Words – 44/46
Model Checking
Thm: Satisfiability of NWTL is EXPTIME complete.
Proof: [Sketch]
lower bound: Previously known from Caret Paper [AEM].
upper bound: Transform formula ϕ to a nested-word
automaton of size 2O(|ϕ|) and test emptiness.
Cor: Model checking NWTL specifications wrt “boolean
programs” or nested-word automata is EXPTIME complete.
Descriptive Complexity and Nested Words – 44/46
Work To Be Done on Nested Words
Fill out more of the theory of nested words.
Use for model checking recursive programs.
Use for developing better query languages and
algorithms for XML.
Use in Linguistics.
Descriptive Complexity and Nested Words – 45/46
Arithmetic Hierarchy
FO (N)
co−r.e.
A
FO (N)
r.e.
complete
r.e.
E
co−r.e.
complete
FO (N)
Recursive
Primitive Recursive
SO[2
O(1)
SO[n
]
O(1)
]
SO(LFP)
PSPACE
SO(TC)
FO(PFP)
Polynomial−Time Hierarchy
co−NP
complete
SO
co−NP
NP
complete
NP
SO
A
SO
EXPTIME
]
NP
FO[n
O(1)
co−NP
FO(LFP)
P
]
SO−Horn
"truly feasible"
FO[(log n)
O(1)
E
FO[2
n
O(1)
n
NC
]
NC 2
log(CFL)
FO(TC)
FO(DTC)
1
SAC
NSPACE[log n]
SO−Krom
DSPACE[log n]
1
NC
Regular
0
FO(M)
FO
ThC
Logarithmic−Time Hierarchy
0
AC
Descriptive Complexity and Nested Words – 46/46
© Copyright 2026 Paperzz