Prefix Rewriting and the Pushdown Hierarchy Wolfgang Thomas - - PowerPoint PPT Presentation
Prefix Rewriting and the Pushdown Hierarchy Wolfgang Thomas - - PowerPoint PPT Presentation
Prefix Rewriting and the Pushdown Hierarchy Wolfgang Thomas Francqui Lecture, Mons, April 2013 Reachability Problem Wolfgang Thomas Overview 1. Prefix Rewriting and the reachability problem 2. Interpretations 3. Unfoldings and Muchniks
Reachability Problem
Wolfgang Thomas
Overview
- 1. Prefix Rewriting and the reachability problem
- 2. Interpretations
- 3. Unfoldings and Muchnik’s Theorem
- 4. The pushdown hierarchy
Wolfgang Thomas
Prefix Rewriting and the Reachability Problem
Wolfgang Thomas
Rewriting Over Words
Rewriting system: Finite set S of rules u → v Different uses of a rule u → v for the rewrite relation ⊢ Infix rewriting: xuy ⊢ xvy Post’s canonical systems: ux ⊢ xv Prefix rewriting (B¨ uchi’s regular canonical systems):
ux ⊢ vx
Fundamental results: Infix rewriting systems and Post’s canonical systems allow to simulate Turing machines. B¨ uchi 1965: Prefix rewriting systems generate regular sets from regular sets of “axioms”, and the derivability relation is decidable.
Wolfgang Thomas
The Setting of Pushdown Automata
A pushdown automaton has the form P = (P, Σ, Γ, p0, Z0, ∆) Configurations are words from PΓ∗ A transition induces a move from pγw to quw Write pγw ⊢ quw So pushdown automata are a special from of prefix rewriting systems. Consequence of B¨ uchi’s Theorem: The reachable configurations of a pushdown automaton form a regular set.
Wolfgang Thomas
The Reachability Sets
Given a pushdown automaton P = (P, Σ, Γ, p0, Z0, ∆) and
T ⊆ PΓ∗ pre∗(T) := {pv ∈ PΓ∗ | ∃qw ∈ T : pv ⊢∗ qw}
Analogously post∗(T). We may suppress Σ and q0, Z0 and obtain a “pusdown system
P = (Q, Γ, ∆) with transitions of the form (p, γ, v, q).
Given a pushdown system P = (P, Γ, ∆) and a finite automaton recognizing a set T ⊆ PΓ∗, one can compute a finite automaton recognizing pre∗(T), similarly for post∗(T). Deciding p1w1 ⊢∗ p2w2: Set T = {p2w2} and check whether the automaton recognizing pre∗(T) accepts p1w1.
Wolfgang Thomas
Example
P = (P, Γ, ∆) with P = {p0, p1, p2}, Γ = {a, b, c},
∆ =
{(p0a → p1ba), (p1b → p2ca), (p2c → p0b), (p0b → p0)}
T = {p0aa}. P-automaton for T:
A:
p0 s1 p1 p2 s2 a a
Wolfgang Thomas
Saturation Algorithm: Idea
Wolfgang Thomas
Saturation Algorithm
Input: P-automaton A, pushdown system P = (P, Γ, ∆)
A0 := A, i := 0
REPEAT: IF pa → p′v ∈ ∆ and Ai : p′
v
− → q THEN
add (p, a, q) to Ai and obtain Ai+1
i := i + 1 UNTIL no transition can be added
A := Ai
Output: A′
Wolfgang Thomas
Example: Result
A′:
p0 s1 p1 p2 s2 a a b c b a b
So for T = {p0aa}:
pre∗(T) = p0b∗(a + aa) + p1b + p1ba + p2cb∗(a + aa)
Wolfgang Thomas
Alternative: Work in the Tree of Words
Consider a prefix rewriting system over {0, 1}. Convert prefix rewriting to suffix rewriting. Then a rewrite step is definable in S2S. Example: Rule R : 11 → 0 leads from a word w11 to w0 Defining formula ϕR(z, z′): ∃x(z = x11 ∧ z′ = x0) For a system S let ϕS(z, z′) :=
R∈S ϕR(z, z′)
Wolfgang Thomas
Preservation of Regularity
Let L ⊆ {0, 1}∗ be regular. There is an S2S-formula ϕL(x) defining L in the tree T2 We can write L ⊆ Y for ∀y(ϕL(y) → Y(y)) Then x ∈ post∗(L) iff
∀Y[(L ⊂ Y and ∀z, z′(Y(z) ∧ϕS(z, z′)) → Y(z′)) → Y(x)]
The formula ψ(X) :
∀x(X(x) ↔ “x ∈ post∗(L)′′) is satisfied
by a unique set. By Rabin’s Basis Theorem it must be regular.
Wolfgang Thomas
Interpretations
Wolfgang Thomas
A First Example
Show Rabin’s Tree Theorem for T3 = ({0, 1, 2}∗, S3
0, S3 1, S3 2).
Idea: Obtain a copy of T3 in T2: Consider T2-vertices in T = (10 + 110 + 1110)∗.
Wolfgang Thomas
Interpretation: Details
The element i1 . . . im of T3 is coded by
1i1+10 . . . 1im+10 in T2.
Define the set of codes by
ϕ(x): “x is in the closure of ε under 10-, 110-, and
1110-successors” Define the 0-th, 1-st 2-nd successors by
ψ0(x, y), ψ1(x, y), ψ2(x, y)
The structure (ϕT2, (ψT2
i )i=0,1,2) restricted to ϕT2 is isomorphic
to T3.
Wolfgang Thomas
Interpretations in General
An MSO-interpretation of a structure A = (A, RA, . . .) in a structure B is given by a “domain formula” ϕ(x) for each relation RA of A, say of arity m, an MSO-formula
ψ(x1, . . . , xm)
such that A is isomorphic to (ϕB, ψB, . . .) Then there is a transformation OF MSO-sentenceS χ (in the signature of A) to sentences χ′ (in the signature of B) such that
A | = χ iff B | = χ′.
Consequence: If A is MSO-interpretable in B and the MSO-theory of B is decidable, then so is the MSO-theory of A.
Wolfgang Thomas
Pushdown Graphs
Consider A for language L = {anbn | n ≥ 0}:
A = ({q0, q1}, {a, b}, {Z0, Z}, q0, Z0, ∆) with
∆ = (q0, Z0, a, q0, ZZ0),
(q0, Z, a, q0, ZZ), (q0, Z, b, q1, ε), (q1, Z, b, q1, ε)
- Initial and final configuration: q0Z0
The associated pushdown graph (of reachable configurations
- nly) is:
q1Z0 q1ZZ0 q1ZZZ0 . . . q0Z0 q0ZZ0 q0ZZZ0 . . . b b b b b b a a a
Wolfgang Thomas
Interpretation: Second Example
A pushdown graph is MSO-interpretable in T2 Given pushdown automaton A with stack alphabet {1, . . . , k} and states q1, . . . , qm. Let GA = (VA, EA) be the corresponding PD graph.
n := max{k, m}
Find an MSO-interpretation of GA in Tn. Represent configuration (qj, i1 . . . ir) by the vertex ir . . . i1j.
A-steps lead to local moves in Tn.
E.g. a push step from vertex ir . . . i1j to ir . . . i1i0j′. These edges are easily definable in MSO. Hence: The MSO-theory of a PD graph is decidable.
Wolfgang Thomas
Prefix-Recognizable Graphs
Instead of rules u → v we have rules U → Y wuth regular sets
U, V.
Instead of describing a move from one word wu0 to one wv0 describe all admissible moves from a word wu to a word wv for a rule U → V with u ∈ U, v ∈ V. This can be done by describing successful runs of the automata AU, AV on the path segments from w to wu and from w to wv. A graph is MSO-interpretable in T2 iff its is prefix-recognizable.
Wolfgang Thomas
Unfolding and Muchnik’s Theorem
Wolfgang Thomas
Unfoldings
Given a graph (V, (Ea)a∈Σ, (Pb)b∈Σ′) the unfolding of G from a given vertex v0 is the following tree
TG(v0) = (V′, (E′
a)a∈Σ, (P′ b)b∈Σ′):
V′ consists of the vertices v0a1v1 . . . arvr with
(vi−1, vi) ∈ Eai,
E′
a contains the pairs (v0a1v1 . . . arvr, v0a1v1 . . . arvrav)
with (vr, v) ∈ Ea,
P′
b the vertices v0a1v1 . . . arvr with vr ∈ Pb.
Wolfgang Thomas
Examples
Wolfgang Thomas
Unfolding Preserves Decidability
Theorem (Muchnik, Courcelle/Walukiewicz) If the MSO-theory of G is decidable and v0 is an MSO-definable vertex of G, then the MSO-theory of TG(v0) is decidable. We sketch the proof for pushdown graphs. Their unfoldings are the “algebraic trees”.
Wolfgang Thomas
Proof Architecture
Given an unfolding T of a pushdown graph G.
T is finitely branching, with labels say in Σ inherited from G.
For each MSO-formula ϕ(X1, . . . , Xn) find a parity tree automaton Aϕ such that
Aϕ accepts T(P1, . . . , Pn) iff T[P1, . . . , Pn) | = ϕ(X1, . . . , Xn)
The construction of the Aϕ follows precisely the pattern of Rabin’s equivalence theorem. Essential: In the complementation step we use the finite
- ut-degree of G.
The general case is more involved.
Wolfgang Thomas
Muchnik’s Theorem: Continued
Result: For a sentence ϕ we obtain a tree automaton Aϕ, say with state set Q and transition set ∆, with
Aϕ accepts T iff T | = ϕ
The left-hand side says: Automaton has a positional winning strategy in the associated game ΓA,T If G = (V, E, v0) for simplicity, the game graph consists of vertices in V × Q (for Automaton) in V × ∆ (for Pathfinder)
Wolfgang Thomas
Muchnik’s Theorem Finished
The game ΓA,T is played on a graph
G′ = (V × {1, . . . , k}, E′, (v0, 1))
We use the following fact (shown next Friday): The set of vertices v from where Player Automaton wins in the parity game over G′ = (V′, E′, v′) is MSO-definable by a formula χ(x). Translation Theorem: For each sentence ϕ we can build a sentence ϕ+ such that
G′ |
= ϕ iff G | = ϕ+
Since the MSO theory of G is decidable, we can decide the left-hand side.
Wolfgang Thomas
Final Step
How to infer decidability of MTh(G × {1, 2}) from decidability
- f MTh(G)?
We do not address the definition of the edge relation but just give the idea: Simulate a set quantifier over G × {1, 2} by two set quantifiers
- ver G.
Wolfgang Thomas
Pushdown Hierarchy
Wolfgang Thomas
Caucal’s Proposal
We have now two processes which preserve decidability of MSO-theory: interpretation (transforming a tree into a graph) unfolding (transforming a graph into a tree) Let us apply them in alternation! We obtain the Caucal hierarchy or pushdown hierarchy.
Wolfgang Thomas
Definition
T0 = the class of finite trees Gn = the class of graphs which are MSO-interpretable in a
tree of Tn
Tn+1 = the class of unfoldings of graphs in Gn
Each structure in the pushdown hierarchy has a decidable MSO-theory. Nontrivial fact: The sequence G0, G1, G2, . . . is strictly increasing.
Wolfgang Thomas
The First Levels
G0 is the class of finite graphs. T1 contains the regular trees. G1 contains the prefix-recognizable graphs.
Wolfgang Thomas
A Finite Graph, a Regular Tree, a PD Graph
- a
- b
- a
- c
- a
- b
- a
- c
- a
- c
- a
- c
- a
- c
- a
c
- · · ·
- · · ·
- a
- b
- a
- c
- a
- c
- a
- c
- a
- c
- a
c
- · · ·
- f
- d
- e
- d
- e
- d
- e
- d
- e
- · · ·
d
- e
- Wolfgang Thomas
Unfolding Again
- a
b
- a
c
- c
- a
c
- a
c
- a
· · ·
- ✹
✹ ✹
- f
- d
✑✑✑✑✑✑
e
- ✲
✲ ✲ ✲ ✲ ✲
- d
✄✄✄✄✄✄✄
e
- ❀
❀ ❀ ❀ ❀ ❀ ❀
- d
✄✄✄✄✄✄✄
e
- ❀
❀ ❀ ❀ ❀ ❀ ❀
- ✲
✲ ✲ •
f
- f
- d
✑✑✑✑✑✑
e
- ✲
✲ ✲ ✲ ✲ ✲
- d
✑✑✑✑✑✑
e
- ✲
✲ ✲ ✲ ✲ ✲
- d
✑✑✑✑✑✑
e
- ✲
✲ ✲ ✲ ✲ ✲
- d
✑✑✑✑✑✑
e
- ✶
✶ ✶ ✶ ✶ ✶
- ❴
❴
- ✲
✲ ✲ •
f
- f
- f
- f
- d
✑✑✑✑✑✑
e
- ✲
✲ ✲ ✲ ✲ ✲
- ❴
❴
- ❴
❴
- ❴
❴
- ✲
✲ ✲ •
f
- f
- · · ·
- ❴
❴
- Wolfgang Thomas
Interpretation of Bottom Line
The sequence of leaves defines a copy of the successor structure of the natural numbers. Domain expression: b + a∗c(d + e)∗ f Successor relation:
bacf+ fe∗cacd∗ f+ fe∗ded∗ f
Predicate “power of 2”: b + a∗cd∗ f Result: (N, Succ, Pow2) is a structure in the Caucal hierarchy.
Wolfgang Thomas
Factorial Predicate
(N, Succ, Fac)
We start as follows:
- a
- b
- a
- b
- a
- b
- a
b
- · · ·
- c
- c
- c
- · · ·
c
- Wolfgang Thomas
Continuation: Unfolding and Interpretation
- · · ·
b b b b c c c c c c
Wolfgang Thomas
Another Unfolding
- 1
- 2
- • • • • •
- • • • • •
3
- a
a a a b b b b c c c c c c c c c
Wolfgang Thomas
Scope of Hierarchy?
The pushdown hierarchy is a very rich class of structures all of which have a decidable MSO-theory. Open questions: Understand which structures belong to the hierarchy Compute the smallest level on which a strcuture occurs
Wolfgang Thomas