university of toronto leonid libkin
TRANSCRIPT
![Page 1: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/1.jpg)
LOGICS FOR UNRANKED TREES
Leonid Libkin
University of Toronto
Libkin 1 ICALP 2005
![Page 2: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/2.jpg)
Paper in the proceedings
• A much shortened version of the survey.
• Full version on my webpage
• google.com ⇒ libkin ⇒ “I’m feeling lucky”
• Why? Limits on the number of pages in a single volume.
Libkin 2 ICALP 2005
![Page 3: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/3.jpg)
Paper in the proceedings
• A much shortened version of the survey.
• Full version on my webpage
• google.com ⇒ libkin ⇒ “I’m feeling lucky”
• Why? Limits on the number of pages in a single volume.
• Apparently there is no Moore’s Law in book binding technology:
• Gutenberg’s Bible, published in 1455 — 1282 pages
• Springer’s ICALP Proceedings, published in 2005 – 1477 pages
Libkin 3 ICALP 2005
![Page 4: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/4.jpg)
Trees are everywhere
• One of the most common objects we see in CS.
• Logics and automata on trees found many applications:
• verification;
• program analysis;
• logic programming/constraint programming;
• linguistics;
• databases
Libkin 4 ICALP 2005
![Page 5: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/5.jpg)
Logic/automata connection
• Regular tree languages = given by tree automata.
• Typically characterized via MSO — Monadic Second-Order logic
• MSO is an extension of first-order logic with quantification over sets.
• Classical results (about 35 years old):
• Thatcher-Wright: For finite binary trees, Regular = MS0-definable.
• Rabin: Same is true for infinite trees. Hence S2S, the MSO-theoryof two successors, is decidable.
• This is one of the most powerful decidability results.
• Many more results followed (Thomas+colleagues, Wilke, Walukiewicz,Segoufin, Schwentick, Neven, etc etc)
Libkin 5 ICALP 2005
![Page 6: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/6.jpg)
Ranked Trees
Typically one works with ranked trees; e.g., binary, ternary, etc trees.
A binary tree:
a
b
a b
b
a
b a
a
Libkin 6 ICALP 2005
![Page 7: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/7.jpg)
Unranked trees
Recently focus has shifted towards unranked trees.
In them, nodes can have arbitrarily many children, and different nodes mayhave different number of children.
a
b b
a b a
a b
a
b
Libkin 7 ICALP 2005
![Page 8: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/8.jpg)
Why unranked trees?
• Main reason: XML.
• XML = eXtensible Markup Language, the standard for exchangingdata on the web.
• XML data is modeled as unranked trees.
• A lot of recent work on XML: W3C standards such as XML Schema,XPath, XSLT, XQuery define types, navigation mechanism, transfor-mations, and query languages for XML.
• Active work on XML in many communities, especially databases, infor-mation retrieval.
• Brings techniques (sometimes old and almost forgotten) from formallanguage theory and merges them nicely with logic.
Libkin 8 ICALP 2005
![Page 9: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/9.jpg)
XML documents look like this
<db>
<book>
<title attr_title="Free Nations don’t develop WMD"></title>
<publisher publ_attr="White House Press"></publisher>
<author>
<name name_attr="GW Bush">
</author>
<author>
<name name_attr="C Rice">
</author>
</book>
<book>
<title attr_title="I Love Poor People"></title>
<publisher publ_attr="World Bank Press"></publisher>
<author>
<name name_attr="P Wolfowitz">
</author>
</book>
<book>
<title attr_title="10 Floors of the United Naion"></title>
<publisher publ_attr="Senate Foreign relations Committee"></publisher>
<status status_attr="submitted"></status>
<author>
<name name_attr="J Bolton">
</author>
</book>
</db>
Libkin 9 ICALP 2005
![Page 10: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/10.jpg)
But we like to view them as unranked trees:
db
book book book
titlepubl
titlepubl author
namename
titlepubl author statusauthor
author
”Free
nations
don’t
develop
WMDs”
”WHPress”
”GW Bush” ”C Rice”
name
”I love
poor people”
”World Bank”
”P Wolfowitz”
”10 Floors
of the UN”
”Senate
Foreign
Relations
Cmte””J Bolton”
”submitted”
Libkin 10 ICALP 2005
![Page 11: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/11.jpg)
But we like to view them as unranked trees:
db
book book book
titlepubl
titlepubl author
namename
titlepubl author statusauthor
author
”Free
nations
don’t
develop
WMDs”
”WHPress”
”GW Bush” ”C Rice”
name
”I love
poor people”
”World Bank”
”P Wolfowitz”
”10 Floors
of the UN”
”Senate
Foreign
Relations
Cmte””J Bolton”
”submitted”
Document description (DTD = Document Type Definition)
db → book∗
book → title, publ, author+, status?author → name
plus attribute names.
Libkin 11 ICALP 2005
![Page 12: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/12.jpg)
Why are we interested in logics?
• XML documents describe data.
• Standard relational database approach:
• data model – relations
• declarative languages for specifying queries
• procedural languages for evaluating queries
• Standard declarative languages are all logic-based:
• relational calculus = first-order logic (FO)
• datalog = fragment of fixed-point logic
• basic SQL = FO with counting
Libkin 12 ICALP 2005
![Page 13: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/13.jpg)
What does XML add?
• New logics.
• New procedural languages:
• logic–automata connection.
Libkin 13 ICALP 2005
![Page 14: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/14.jpg)
What do logics do?
Most commonly they define:
• Boolean (that is, yes/no) queries:
• DTD conformance
• Existence of certain paths
• Unary queries which select nodes in trees:
• all nodes reachable by a certain path from the root;
• all nodes with a certain label or certain data element.
Libkin 14 ICALP 2005
![Page 15: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/15.jpg)
Commonalities between logics
• (Almost) all have associated automata models.
• Crucial aspect is navigation.
• Hence we often see close connection with temporal logics.
• Logics are specifically designed for unranked trees.
Libkin 15 ICALP 2005
![Page 16: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/16.jpg)
Ranked/Unranked Connection
(used by Rabin in 1970 to interpret SωS in S2S):
a
b
a
a
a b a
=⇒
a
b
a a
a
⊥ b
⊥ a
⊥
⊥
It preserves recognizability by automata, MSO-definability, FO-definability...
Libkin 16 ICALP 2005
![Page 17: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/17.jpg)
Why not just use it?
• Instead of defining logics for unranked trees, just translate them intobinary trees and use known logical formalisms.
• Problem: hard to navigate!
• A path in a translation becomes a union of arbitrarily many child pathsand sibling paths.
• Hard (at least not natural) to express many properties such as DTDconformance.
Libkin 17 ICALP 2005
![Page 18: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/18.jpg)
Classification: Yardstick logic
Most logics are based either on FO or MSO.
• FO:
• Boolean connectives ∨,∧,¬,
• quantifiers ∃x, ∀x ranging over nodes of trees.
• MSO: in addition
• quantifiers ∃X , ∀X ranging over sets of nodes;
• plus new formulae x ∈ X .
Libkin 18 ICALP 2005
![Page 19: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/19.jpg)
Classification: Ordered vs Unordered Trees
In unordered trees, there is no order among siblings (children of the samenode).
Libkin 19 ICALP 2005
![Page 20: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/20.jpg)
Classification: Ordered vs Unordered Trees
In unordered trees, there is no order among siblings (children of the samenode).
In ordered trees, siblings are ordered (from the oldest to the youngest).
Libkin 20 ICALP 2005
![Page 21: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/21.jpg)
Formal definition of unranked trees
ε
1 2 3 4 5
21 22 41 42 43
Tree domain: prefix-closed subset D of N∗ such that s · i ∈ D implies
s · j ∈ D for j < i.
Libkin 21 ICALP 2005
![Page 22: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/22.jpg)
Formal definition of unranked trees
ε
1 2 3 4 5
21 22 41 42 43
a
b
a a ab
a b b b a
Tree domain: prefix-closed subset D of N∗ such that s · i ∈ D implies
s · j ∈ D for j < i.
Tree over finite alphabet Σ: tree domain plus a mapping from it to Σ.
Libkin 22 ICALP 2005
![Page 23: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/23.jpg)
Basic predicates
child ≺ch
next-sibling ≺ns
first child ≺fc
Transitive closures: • ≺∗ch of ≺ch (descendant)
• ≺∗ns of ≺ns (younger child)
We normally use transitive closures (since they are not definable in FO).
For MSO, we can use either ≺ch, ≺ns or ≺∗ch, ≺∗
ns as they are interdefinable.
Libkin 23 ICALP 2005
![Page 24: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/24.jpg)
LOGICS FOR ORDERED TREES
Libkin 24 ICALP 2005
![Page 25: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/25.jpg)
Logic/automata connection
A set T of trees is definable in a logic L iff there is a sentence ϕ of L suchthat
T ∈ T ⇔ T |= ϕ
A set T of trees is regular if it is recognizable by a tree automaton.
Theorem
• A set of binary trees is regular iff it is MSO-definable (Thatcher-Wright,1966).
• A set of unranked trees is regular iff it is MSO-definable (almost folk-lore; stated many times by different authors).
Libkin 25 ICALP 2005
![Page 26: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/26.jpg)
Tree automata: the ranked case
Transitions are δ : States × States × Σ → 2States.
Libkin 26 ICALP 2005
![Page 27: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/27.jpg)
Tree automata: the ranked case
Transitions are δ : States × States × Σ → 2States.
q1 q2
q
a
if q ∈ δ(q1, q2, a)
Libkin 27 ICALP 2005
![Page 28: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/28.jpg)
Tree automata: the ranked case
Transitions are δ : States × States × Σ → 2States.
q1 q2
q
a
if q ∈ δ(q1, q2, a)
a b a b
a b
a
Libkin 28 ICALP 2005
![Page 29: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/29.jpg)
Tree automata: the ranked case
Transitions are δ : States × States × Σ → 2States.
q1 q2
q
a
if q ∈ δ(q1, q2, a)
a b a b
a b
a
q1 q2 q1 q2
Libkin 29 ICALP 2005
![Page 30: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/30.jpg)
Tree automata: the ranked case
Transitions are δ : States × States × Σ → 2States.
q1 q2
q
a
if q ∈ δ(q1, q2, a)
a b a b
a b
a
q1 q2 q1 q2
q3q4
Libkin 30 ICALP 2005
![Page 31: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/31.jpg)
Tree automata: the ranked case
Transitions are δ : States × States × Σ → 2States.
q1 q2
q
a
if q ∈ δ(q1, q2, a)
a b a b
a b
a
q1 q2 q1 q2
q3q4
q5
Libkin 31 ICALP 2005
![Page 32: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/32.jpg)
Tree automata: the ranked case
Transitions are δ : States × States × Σ → 2States.
q1 q2
q
a
if q ∈ δ(q1, q2, a)
a b a b
a b
a
q1 q2 q1 q2
q3q4
q5
accepted if q5 is a final state
Libkin 32 ICALP 2005
![Page 33: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/33.jpg)
Tree automata: unranked case
Transitions are δ : States × Σ → 2States∗ so that each δ(q, a) ⊆ States∗ isa regular language.
Libkin 33 ICALP 2005
![Page 34: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/34.jpg)
Tree automata: unranked case
Transitions are δ : States × Σ → 2States∗ so that each δ(q, a) ⊆ States∗ isa regular language.
The run is the same as before:
q1 q2 ......... qn−1 qn
a
Libkin 34 ICALP 2005
![Page 35: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/35.jpg)
Tree automata: unranked case
Transitions are δ : States × Σ → 2States∗ so that each δ(q, a) ⊆ States∗ isa regular language.
The run is the same as before:
q1 q2 ......... qn−1 qn
a q
if q1 · · · qn ∈ δ(q, a)
Libkin 35 ICALP 2005
![Page 36: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/36.jpg)
Tree automata: unranked case
Transitions are δ : States × Σ → 2States∗ so that each δ(q, a) ⊆ States∗ isa regular language.
The run is the same as before:
q1 q2 ......... qn−1 qn
a q
if q1 · · · qn ∈ δ(q, a)
A tree is accepted if there is a run such that the root is assigned an acceptingstate.
Libkin 36 ICALP 2005
![Page 37: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/37.jpg)
Unary queries
• A unary query selects a set of nodes in a tree.
• A surprisingly simple automaton model captures them.
• Query automaton QA = unranked tree automaton + selecting set S ⊆States × Σ.
• QA selects a node s from a tree T if there is a run that assigns a stateq to s such that
(q, a) ∈ S.
Theorem (Neven/Schwentick, 1999) For unary queries over unrankedtrees,
Query Automata = MSO.
Libkin 37 ICALP 2005
![Page 38: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/38.jpg)
MSO and DTDs
• Recall that DTDs have rules such as
book → title, publ, author+, status?
• Since regular string languages are precisely those MSO-definable, itfollows that all DTDs are MSO-definable.
• Are DTDs and MSO equal?
• The answer is negative.
Libkin 38 ICALP 2005
![Page 39: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/39.jpg)
MSO and DTDs cont’d
• EDTDs = Extended DTDs: these are DTDs over a larger alphabetΣ′ ⊇ Σ together with a projection π : Σ′ → Σ.
• Trees over Σ that conform to an EDTD: projections of conforming treesover Σ′
Theorem (Thatcher 1967; rediscovered several times recently)
EDTDs = MSO
Libkin 39 ICALP 2005
![Page 40: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/40.jpg)
MSO and DTDs cont’d
• EDTDs = Extended DTDs: these are DTDs over a larger alphabetΣ′ ⊇ Σ together with a projection π : Σ′ → Σ.
• Trees over Σ that conform to an EDTD: projections of conforming treesover Σ′
Theorem (Thatcher 1967; rediscovered several times recently)
EDTDs = MSO
• DTDs are not even closed under ∨ and ¬.
• Unions of DTDs correspond to the existential fragment of MSO over asmaller vocabulary.
Libkin 40 ICALP 2005
![Page 41: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/41.jpg)
MSO over trees: Complexity
• Model-checking problem:
Input: tree T , sentence ϕQuestion: Is T |= ϕ?
• Two parameters:
• ‖T‖ – data complexity
• ‖ϕ‖ – query complexity
• By translation to automata: The data complexity of MSO is linear.
• Problem: if we keep data complexity linear, the query complexity isnecessarily non-elementary! (Frick/Grohe, 2002)
• Can we do better?
• Yes, by finding different logics that have the power of MSO, and yetbetter model-checking properties.
Libkin 41 ICALP 2005
![Page 42: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/42.jpg)
Changing syntax to lower complexity: LTL
Syntax:ϕ := a(∈ Σ) | ϕ ∨ ϕ′ | ¬ϕ | Xϕ | ϕUϕ′
Libkin 42 ICALP 2005
![Page 43: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/43.jpg)
Changing syntax to lower complexity: LTL
Syntax:ϕ := a(∈ Σ) | ϕ ∨ ϕ′ | ¬ϕ | Xϕ | ϕUϕ′
Semantics:
a
a, a ∈ Σ
Libkin 43 ICALP 2005
![Page 44: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/44.jpg)
Changing syntax to lower complexity: LTL
Syntax:ϕ := a(∈ Σ) | ϕ ∨ ϕ′ | ¬ϕ | Xϕ | ϕUϕ′
Semantics:
ϕ
Xϕ
Libkin 44 ICALP 2005
![Page 45: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/45.jpg)
Changing syntax to lower complexity: LTL
Syntax:ϕ := a(∈ Σ) | ϕ ∨ ϕ′ | ¬ϕ | Xϕ | ϕUϕ′
Semantics:
ϕ ϕ ϕ ϕ ψ
ϕUψ
Libkin 45 ICALP 2005
![Page 46: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/46.jpg)
LTL cont’d
• LTL = FO over strings (Kamp’s theorem).
• To evaluate LTL with linear data complexity, one needs non-elementaryquery complexity(modulo some complexity-theoretic assumptions; Frick/Grohe 2002)
• But LTL over strings can be evaluated in time
2O(‖ϕ‖) · |s|
• Of course this implies that translation from FO to LTL is non-elementary.
Libkin 46 ICALP 2005
![Page 47: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/47.jpg)
Efficient Tree Logic (ETL)
Neven/Schwentick, 2000
Idea of ETL: take MSO and
• Disallow:
• next-sibling ≺ns;
• arbitrary quantification;
• Add:
• guarded quantification over children or (sets of) descendants;
• regular expressions over formulae.
• and put some syntactic restrictions.
Libkin 47 ICALP 2005
![Page 48: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/48.jpg)
Efficient Tree Logic (ETL) cont’d
...
....
ϕ1
ϕ2
ϕ3
ϕ4
ϕn−1
ϕn
ψ1 ψ2ψ3 ψ4 ψn
x
y
x
ϕ e(x, y) : ϕ1 · · ·ϕn ∈ e ψ e(x) : ψ1 · · ·ψn ∈ e
Libkin 48 ICALP 2005
![Page 49: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/49.jpg)
Efficient Tree Logic (ETL) cont’d
Theorem (Neven/Schwentick)
• ETL = MSO.
• ETL formulae can be evaluated in time
2O(‖ϕ‖) · ‖T‖
Libkin 49 ICALP 2005
![Page 50: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/50.jpg)
Can one do better? – Monadic Datalog
• Datalog = database query language; essentially extension of positiveFO with least fixed point.
• Can also be viewed as prolog without function symbols.
• Datalog program is monadic if all introduced predicates (intensionalpredicates) are monadic – have one free variable.
• Example: select (in predicate D) all nodes s such that all their descen-dants (including s) are labeled a:
D(x) :– Pa(x), Leaf(x)D(x) :– Pa(x), x ≺fc y, S(y)S(y) :– Pa(x), LastChild(y), D(y)S(y) :– Pa(x), x ≺ns y, S(y), D(y)
Libkin 50 ICALP 2005
![Page 51: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/51.jpg)
Monadic Datalog cont’d
Assume that Leaf and LastChild are available as basic predicates.
Theorem (Gottlob/Koch, 2002)
• Monadic Datalog = MSO
• A Monadic Datalog program P can be evaluated on a tree T in time
O(‖P‖ · ‖T‖)
Libkin 51 ICALP 2005
![Page 52: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/52.jpg)
µ-calculus over unranked trees
• µ-calculus (Kozen 82): extension of a temporal logic with the leastfixed point operator.
• Subsumes many logics used in verification: LTL, CTL, CTL∗.
• Syntax:
ϕ := S | a | ϕ ∨ ϕ′ | ϕ ∧ ϕ′ | ¬ϕ | XEϕ | µS ϕ(S)
• S must occur positively;
• E ranges over relations ≺ch and ≺ns
• Full µ-calculus: one can talk about the past.
• That is, E also ranges over inverses of ≺ch and ≺ns
Libkin 52 ICALP 2005
![Page 53: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/53.jpg)
µ-calculus over unranked trees cont’d
Theorem (Barcelo, L., ’05) Over unranked trees,
full µ-calculus = MSO
For Boolean queries:
• MSO = alternation-free µ-calculus (all negations pushed to atomicformulae)
• Complexity of model-checking (Mateescu, ’02):
• O(‖ϕ‖2 · ‖T‖) for µ-calculus;
• O(‖ϕ‖ · ‖T‖) for alternation-free µ-calculus.
Remark: it is well known that over infinite binary trees µ-calculus andMSO are the same (Niwinski 1988).
Libkin 53 ICALP 2005
![Page 54: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/54.jpg)
First-Order based formalisms
• These are often studied in connection with XPath
• XPath – a W3C standard, essentially the navigation language forXML.
Libkin 54 ICALP 2005
![Page 55: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/55.jpg)
XPath – an informal introduction
• XPath has two kinds of formulae: node tests and path formulae.
• Node tests are closed under Boolean connectives and can check if apath satisfying a path formula can start in a given node.
• Path formulae can:
• test if a node test is true in the first node of a path;
• test if a path starts by going to a child, first child, next child,previous child, parent, descendant, ansector, etc;
• take union or composition of two paths.
Example: //book[/author[name="GW Bush"]]/title
gives titles of books coauthored by Bush.
Libkin 55 ICALP 2005
![Page 56: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/56.jpg)
CTL∗ vs XPath
• There is a well-known logic, CTL∗, that similarly combines node(called state) and path formulae.
• Syntax:
state formulae α := a | α ∨ α′ |¬α | Eβpath formulae β := LTL over state formulae
Example: all descendants of a given node (including self) are labeled a(with Σ = a, b):
¬E(
(a ∨ b) U b)
Libkin 56 ICALP 2005
![Page 57: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/57.jpg)
CTL∗ and FO over trees
Theorem With respect to Boolean queries:
• over binary trees, CTL∗ = FO(Hafer, Thomas, 1987).
• over unranked trees, CTL∗ = FO(Barcelo, L., 2005; closely related to Marx 2004)
• For unary queries, one adds reasoning about the past (temporaloperators Y – yesterday, and S – since).
• A technical issue: what is a path in an unranked tree? It could bea path that may change directions from siblings to children, or onecould use two different kinds of path formulae.
• It turns out that this decision does not affect expressiveness.
Libkin 57 ICALP 2005
![Page 58: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/58.jpg)
LOGICS FOR UNORDERED TREES
Libkin 58 ICALP 2005
![Page 59: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/59.jpg)
Easy punchline
• Order buys us counting.
• Without order, counting has to be introduced explicitly.
a b a b aa
• There is no way to say in a temporal logic that there are at least 2children labeled a.
Libkin 59 ICALP 2005
![Page 60: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/60.jpg)
MSO, order, and counting
• With MSO, ordering gives us even more powerful modulo counting.
• Example: parity in MSO
• The black set:
• contains the first element;
• contains every other element;
• does not contain the last element.
• But if we only have:
we cannot say it.
Libkin 60 ICALP 2005
![Page 61: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/61.jpg)
Automata with counting
• New transition: δ : States × Σ → Boolean function over(V )
• V = vkq | k ∈ N, q ∈ States.• A new notion of run:
q1 q2 ......... qn−1 qn
a q0
• For each q, set vkq to true if the number of children in state q is atleast k.
• If δ(q0, a) evaluates to true, then state q0 can be assigned.
Libkin 61 ICALP 2005
![Page 62: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/62.jpg)
Counting in temporal logics
Extend µ-calculus and CTL∗ to counting versions by changing X toXk, meaning the existence of at least k elements satisfying a formula.
Theorem For Boolean queries:
• MSO = counting µ-calculus(Walukiewicz et al, 2002)
• FO = counting CTL∗
(Moller, Rabinovich, 2003)
• For unary queries, one needs both counting and past(Schlingloff 1992, Barcelo, L, 2005)
Libkin 62 ICALP 2005
![Page 63: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/63.jpg)
Adding an arbitrary ordering
• Parity example: an order is needed, but it does not matter whichone!
• Such properties are called order-invariant.
• CMSO = Counting MSO: extension of MSO with
Modq(X) meaning |X| = 0 (mod q)
Theorem (Courcelle 1991) Over trees,
order-invariant MSO = CMSO.
Libkin 63 ICALP 2005
![Page 64: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/64.jpg)
Even more powerful counting
q1 q2 ......... qn−1 qn
a q0
• For each q, let vq be the number of nodes assigned state q.
• In a more powerful counting automata, transition δ(q0, a) could bea formula of Presburger Arithmetic (that is, 〈N,+〉) over vq’s.For example,
δ(q0, a) =(vq1 + vq2 = 2 · vq3
)∧ ∃x
(vq4 = x + x + x
)
• Such automata investigated by Seidl, Schwentick, Muscholl, ’03–04.
• Decidability results and fixed-point logic characterizations.
Libkin 64 ICALP 2005
![Page 65: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/65.jpg)
AUTOMATIC STRUCTURES
Libkin 65 ICALP 2005
![Page 66: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/66.jpg)
Strings, trees, and logic: a reminderStrings and trees are viewed as finite structures.Universe: 1, . . . , n or a prefix-closed subset of 1, 2∗Predicates: ≺ – prefix, Pa and Pb for positions labeled a and b
a
1
b
2
b
3
a
4
a
5
ε a
1 a
11 b 12 b
112 a
2 a
21 a
221 b
22 b
A string s or a tree T is a structure, Ms or MT , of vocabulary (≺, Pa, Pb).
If Φ is a sentence of a logic L, then
s |Ms |= Φ T |MT |= Φdefine string and tree languages.
Classical Results Regular languages = MSO-definable
Libkin 66 ICALP 2005
![Page 67: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/67.jpg)
A different approach: automatic structuresIf M = 〈Σ∗,Ω〉 is a first-order structure, then a formula ϕ(x) definesthe language
s ∈ Σ∗ | M |= ϕ(s)A structure is automatic if all such languages are regular.
Operations on strings:• x ≺ y: x is a prefix of y• fa(x) = x · a, a ∈ Σ• el(x, y) (equal length): |x| = |y|
S
def= 〈 Σ∗, ≺, (fa)a∈Σ, el 〉
Folklore Theorem S is the universal automatic structure: relationsdefinable by formulae ϕ(x1, . . . , xn) are precisely the regular relations.
Libkin 67 ICALP 2005
![Page 68: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/68.jpg)
Regular relationsThese are n-tuples of strings accepted by letter-to-letter automata.
s1 = a a b · · · a b cs2 = a b a · · · as3 = b b · · ·
· · · · · ·sn = a b b · · · a c
Libkin 68 ICALP 2005
![Page 69: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/69.jpg)
Regular relationsThese are n-tuples of strings accepted by letter-to-letter automata.
s1 = a a b · · · a b cs2 = a b a · · · a # #s3 = b b # · · · # # #
· · · · · ·sn = a b b · · · a c #
Libkin 69 ICALP 2005
![Page 70: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/70.jpg)
Regular relationsThese are n-tuples of strings accepted by letter-to-letter automata.
s1 = a a b · · · a b cs2 = a b a · · · a # #s3 = b b # · · · # # #
· · · · · ·sn = a b b · · · a c #
⇑
Libkin 70 ICALP 2005
![Page 71: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/71.jpg)
Regular relationsThese are n-tuples of strings accepted by letter-to-letter automata.
s1 = a a b · · · a b cs2 = a b a · · · a # #s3 = b b # · · · # # #
· · · · · ·sn = a b b · · · a c #
⇑
Libkin 71 ICALP 2005
![Page 72: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/72.jpg)
Regular relationsThese are n-tuples of strings accepted by letter-to-letter automata.
s1 = a a b · · · a b cs2 = a b a · · · a # #s3 = b b # · · · # # #
· · · · · ·sn = a b b · · · a c #
⇑
Libkin 72 ICALP 2005
![Page 73: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/73.jpg)
Regular relationsThese are n-tuples of strings accepted by letter-to-letter automata.
s1 = a a b · · · a b cs2 = a b a · · · a # #s3 = b b # · · · # # #
· · · · · ·sn = a b b · · · a c #
⇑
Libkin 73 ICALP 2005
![Page 74: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/74.jpg)
Regular relationsThese are n-tuples of strings accepted by letter-to-letter automata.
s1 = a a b · · · a b cs2 = a b a · · · a # #s3 = b b # · · · # # #
· · · · · ·sn = a b b · · · a c #
⇑
Libkin 74 ICALP 2005
![Page 75: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/75.jpg)
Regular relationsThese are n-tuples of strings accepted by letter-to-letter automata.
s1 = a a b · · · a b cs2 = a b a · · · a # #s3 = b b # · · · # # #
· · · · · ·sn = a b b · · · a c #
⇑
Libkin 75 ICALP 2005
![Page 76: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/76.jpg)
Regular relationsThese are n-tuples of strings accepted by letter-to-letter automata.
s1 = a a b · · · a b cs2 = a b a · · · a # #s3 = b b # · · · # # #
· · · · · ·sn = a b b · · · a c #
⇑
The alphabet of this automaton is (Σ ∪ #)n.
Libkin 76 ICALP 2005
![Page 77: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/77.jpg)
Regular relationsThese are n-tuples of strings accepted by letter-to-letter automata.
s1 = a a b · · · a b cs2 = a b a · · · a # #s3 = b b # · · · # # #
· · · · · ·sn = a b b · · · a c #
⇑
The alphabet of this automaton is (Σ ∪ #)n.
A reduct of S:
Sp
def= 〈 Σ∗, ≺, (fa)a∈Σ 〉
Theorem (Benedikt, L., Schwentick, Segoufin, 2001)
Languages definable over Sp are precisely the star-free languages.
Libkin 77 ICALP 2005
![Page 78: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/78.jpg)
Automatic structures on binary treesTrees(Σ) – the infinite set of all binary Σ-labeled trees.
Operations and predicates on trees:
T ′ extends T(or T is subsumed by T ′): T ≺ T ′
Ta
a
b b a
a
Libkin 78 ICALP 2005
![Page 79: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/79.jpg)
Automatic structures on binary treesTrees(Σ) – the infinite set of all binary Σ-labeled trees.
Operations and predicates on trees:
T ′ extends T(or T is subsumed by T ′): T ≺ T ′
T ′a
a
b b a
b a
a
a
a b
Libkin 79 ICALP 2005
![Page 80: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/80.jpg)
Operations on binary trees cont’dSuccessor operations: succa1, succb1, succa2, succb2.succa1 adds, to each leaf, a left child labeled a:
T
Libkin 80 ICALP 2005
![Page 81: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/81.jpg)
Operations on binary trees cont’dSuccessor operations: succa1, succb1, succa2, succb2.succa1 adds, to each leaf, a left child labeled a:
. . .
a a a a a a
succa1(T )
Libkin 81 ICALP 2005
![Page 82: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/82.jpg)
Operations on binary trees cont’dAnalog of equal length – domain equivalence:
T ≈dom T′ ⇔ domain(T ) = domain(T ′)
Libkin 82 ICALP 2005
![Page 83: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/83.jpg)
Operations on binary trees cont’dAnalog of equal length – domain equivalence:
T ≈dom T′ ⇔ domain(T ) = domain(T ′)
Ta
b
a a
b
b
a b
Libkin 83 ICALP 2005
![Page 84: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/84.jpg)
Operations on binary trees cont’dAnalog of equal length – domain equivalence:
T ≈dom T′ ⇔ domain(T ) = domain(T ′)
T ′a
a
b a
a
a
b a
Libkin 84 ICALP 2005
![Page 85: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/85.jpg)
Tree-Automatic Structures
T = 〈 Trees(Σ), ≺, succa,b1,2, ≈dom 〉
Libkin 85 ICALP 2005
![Page 86: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/86.jpg)
Tree-Automatic Structures
T = 〈 Trees(Σ), ≺, succa,b1,2, ≈dom 〉
Tp = 〈 Trees(Σ), ≺, succa,b1,2 〉
Libkin 86 ICALP 2005
![Page 87: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/87.jpg)
Tree-Automatic Structures
T = 〈 Trees(Σ), ≺, succa,b1,2, ≈dom 〉
Tp = 〈 Trees(Σ), ≺, succa,b1,2 〉
Theorem (Benedikt, L., 2002)
• For both Tp and T, the class of definable sets is precisely the classof regular tree languages.
• T is the universal tree-automatic structure: a relation on Trees(Σ)is T-definable iff it is regular.
• Tp is weaker than T.
Libkin 87 ICALP 2005
![Page 88: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/88.jpg)
Operations on unranked treesReusing the extension operation ≺ requires infinitely many successoroperations, which is undesirable. Hence, we split it into two: extensionright ≺→ and extension down ≺↓.
T ≺→ T ′
Libkin 88 ICALP 2005
![Page 89: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/89.jpg)
Operations on unranked treesReusing the extension operation ≺ requires infinitely many successoroperations, which is undesirable. Hence, we split it into two: extensionright ≺→ and extension down ≺↓.
T ≺→ T ′
Libkin 89 ICALP 2005
![Page 90: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/90.jpg)
Operations on unranked treesReusing the extension operation ≺ requires infinitely many successoroperations, which is undesirable. Hence, we split it into two: extensionright ≺→ and extension down ≺↓.
T ≺↓ T′
Libkin 90 ICALP 2005
![Page 91: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/91.jpg)
Operations on unranked treesReusing the extension operation ≺ requires infinitely many successoroperations, which is undesirable. Hence, we split it into two: extensionright ≺→ and extension down ≺↓.
T ≺↓ T′
Libkin 91 ICALP 2005
![Page 92: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/92.jpg)
Unranked Tree-Automatic Structures
Tu = 〈 UTrees(Σ), ≺→, ≺↓, (La)a∈Σ, ≈dom 〉
Here La(T ) is true if the rightmost node of T is labeled a.
Libkin 92 ICALP 2005
![Page 93: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/93.jpg)
Unranked Tree-Automatic Structures
Tu = 〈 UTrees(Σ), ≺→, ≺↓, (La)a∈Σ, ≈dom 〉
Here La(T ) is true if the rightmost node of T is labeled a.
Tu
p
= 〈 UTrees(Σ), ≺→, ≺↓, (La)a∈Σ 〉
Libkin 93 ICALP 2005
![Page 94: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/94.jpg)
Unranked Tree-Automatic Structures
Tu = 〈 UTrees(Σ), ≺→, ≺↓, (La)a∈Σ, ≈dom 〉
Here La(T ) is true if the rightmost node of T is labeled a.
Tu
p
= 〈 UTrees(Σ), ≺→, ≺↓, (La)a∈Σ 〉
Libkin 94 ICALP 2005
![Page 95: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/95.jpg)
Unranked Tree-Automatic Structures: basic resultsTheorem (L., Neven, 2003)
• Unranked tree languages definable in Tu and Tup
are precisely theregular unranked tree languages.
Libkin 95 ICALP 2005
![Page 96: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/96.jpg)
Unranked Tree-Automatic Structures: basic resultsTheorem (L., Neven, 2003)
• Unranked tree languages definable in Tu and Tup
are precisely theregular unranked tree languages.
• Tu is the universal unranked tree automatic structure: relations de-finable in Tu are precisely the regular unranked tree relations.
Libkin 96 ICALP 2005
![Page 97: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/97.jpg)
Unranked Tree-Automatic Structures: basic resultsTheorem (L., Neven, 2003)
• Unranked tree languages definable in Tu and Tup
are precisely theregular unranked tree languages.
• Tu is the universal unranked tree automatic structure: relations de-finable in Tu are precisely the regular unranked tree relations.
• The theory of Tu is decidable.
Libkin 97 ICALP 2005
![Page 98: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/98.jpg)
Unranked Tree-Automatic Structures: basic resultsTheorem (L., Neven, 2003)
• Unranked tree languages definable in Tu and Tup
are precisely theregular unranked tree languages.
• Tu is the universal unranked tree automatic structure: relations de-finable in Tu are precisely the regular unranked tree relations.
• The theory of Tu is decidable.
• Tup
is weaker than Tu.
Libkin 98 ICALP 2005
![Page 99: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/99.jpg)
Ranked an unranked branchesA tree T is a branch if
∀T ′, T ′′ T(
(T ′ T ′′) ∨ (T ′′ T ′))
Libkin 99 ICALP 2005
![Page 100: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/100.jpg)
Ranked an unranked branchesA tree T is a branch if
∀T ′, T ′′ T(
(T ′ T ′′) ∨ (T ′′ T ′))
Libkin 100 ICALP 2005
![Page 101: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/101.jpg)
Ranked an unranked branchesA tree T is a branch if
∀T ′, T ′′ T(
(T ′ T ′′) ∨ (T ′′ T ′))
•
Libkin 101 ICALP 2005
![Page 102: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/102.jpg)
Ranked an unranked branchesA tree T is a branch if
∀T ′, T ′′ T(
(T ′ T ′′) ∨ (T ′′ T ′))
•
Ranked branch
Libkin 102 ICALP 2005
![Page 103: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/103.jpg)
Ranked an unranked branchesA tree T is a branch if
∀T ′, T ′′ T(
(T ′ T ′′) ∨ (T ′′ T ′))
•
Unranked branch
Libkin 103 ICALP 2005
![Page 104: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/104.jpg)
Logics with branch quantificationWe write FOη to indicate that we quantify only over branches.
Then definable sets of trees have analog in the classical theory of logicaldefinability over trees, which uses logics such as FO, MSO, MSOpath
(only quantification over chains is allowed).
Libkin 104 ICALP 2005
![Page 105: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/105.jpg)
Logics with branch quantificationWe write FOη to indicate that we quantify only over branches.
Then definable sets of trees have analog in the classical theory of logicaldefinability over trees, which uses logics such as FO, MSO, MSOpath
(only quantification over chains is allowed).
Theorem Over ranked trees:FOη(Tp)-definable = FO-definableFOη(T)-definable = MSOpath-definable
Libkin 105 ICALP 2005
![Page 106: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/106.jpg)
Logics with branch quantificationWe write FOη to indicate that we quantify only over branches.
Then definable sets of trees have analogs in the classical theory oflogical definability over trees, which uses logics such as FO, MSO,MSOpath (only quantification over chains is allowed).
Theorem Over ranked trees:FOη(Tp)-definable = FO-definableFOη(T)-definable = MSOpath-definable
Over unranked trees:FOη(T
up
)-definable = FO-definableFOη(T
u)-definable = MSO↑→-definable
MSO↑→ is MSO with quantification restricted to vertical and horizontal
paths: an analog of MSOpath for unranked trees.
Libkin 106 ICALP 2005
![Page 107: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/107.jpg)
What else is in the survey?
• Edge-labeled trees.
• They occur in a variety of areas:
• computational linguisticts;
• ambient and spatial logics.
• Logics have quite a different flavor.
• Connections between them and logics considered here are being ex-plored.
Libkin 107 ICALP 2005
![Page 108: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/108.jpg)
Other directions
• We have seen plenty of declarative specification languages with goodassociated procedural formalisms in terms of model-checking prop-erties.
• What causes them to be good?
• One way to look at this: succinctness (Grohe/Schweikardt).How big are formulae for expressing certain properties?
Libkin 108 ICALP 2005
![Page 109: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/109.jpg)
Other directions: streaminga
b
c b
a
b ca
<a>
<b>
<a></a>
<c></c>
<b></b>
</b>
<a>
<b></b>
<c></c>
</a>
</a>
Streamed representation:
abaaccbbbabbccaa
Question: what properties of trees can we check by a finite automatonover the streamed representation?
Since the language of balanced parentheses is not regular, we mayassume the input is already a valid stream.
Libkin 109 ICALP 2005
![Page 110: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/110.jpg)
Other directions: streaming cont’d
• Example The following DTD is not stream-verifiable (Segoufin/Vianu2002):a → ab | ca | εb → εc → ε
• Originally an involved pumping-lemma argument, but logic gives amuch simpler proof:
• For every MSO sentence ϕ one can find two strings of the form
abbabb . . . abba . . . aacc . . . acca . . . a
that agree on ϕ; one of them corresponds to the above DTD, andthe other one to:a → a | ab | ca | εb → εc → ε
Libkin 110 ICALP 2005
![Page 111: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/111.jpg)
Other directions: streaming cont’d
• There is a characterization of a fragment of MSO over trees that definesprecisely the “streamable” properties (checked by string automata).
• However, decidability of that fragment remains open.
Libkin 111 ICALP 2005
![Page 112: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/112.jpg)
Other directions: data values
• So far we considered only labels on trees (e.g., book, author) but nodata values (e.g., ”WH Press”).
• Adding data values quickly leads to undecidability.
• Example: DTDs + key/foreign key constraints.
• Satisfiability problem: is a specification consistent?
• Some known results (Fan, L., 2001):
• It is NP-complete for unary constraints (e.g. title determines pub-lisher).
• It is undecidable even for binary constraints (e.g., title and authordetermine publisher).
Libkin 112 ICALP 2005
![Page 113: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/113.jpg)
Other directions: data values
• Proofs were not logic-based (mostly combinatorial plus integer linearprogramming).
• But it appears that logic can provide an explanation.
• Consider strings with data values attached to positions.
• Bojanczyk, Muscholl, Schwentick, Segoufin, 2005:
• FO2, first-order with two variables, is decidable.
• FO3, first-order with three variables, is undecidable.
• One needs two variables to talk about unary constraints, and more forbinary, etc., constraints.
Libkin 113 ICALP 2005
![Page 114: University of Toronto Leonid Libkin](https://reader030.vdocuments.us/reader030/viewer/2022012113/61dceb561733c5648e5519e3/html5/thumbnails/114.jpg)
Summing up
• XML application give theoreticians nice problems to work on.
• Combination of well developed tools:
• formal languages,
• logic,
• string and tree automata
• Not everything is a straightforward adaption of old and known results.
Libkin 114 ICALP 2005