Introduction Bool[X]-provenance N[X]-provenance Conclusion
Provenance Circuits for Trees and Treelike Instances
Antoine Amarilli1, Pierre Bourhis2, Pierre Senellart1,3
1Télécom ParisTech
2CNRS-LIFL
3National University of Singapore
July 10th, 2015
Introduction Bool[X]-provenance N[X]-provenance Conclusion
General idea
We consider a query and arelational instance
Often it is notsufficient to merelyevaluate the query:
→ We needquantitative information
→ We need the link from theoutputto theinput data
→ Computequery provenance!
Introduction Bool[X]-provenance N[X]-provenance Conclusion
General idea
We consider a query and arelational instance
Often it is notsufficient to merelyevaluate the query:
→ We needquantitative information
→ We need the link from theoutputto theinput data
→ Computequery provenance!
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 1: security for a conjunctive query
Consider theconjunctive query: ∃xyz R(x,y)∧R(y,z) Consider therelational instance below:
R a b b c d e e d f f
Result: true
Add security annotations: Public, Confidential, Secret, Top secret, Never available
What is the minimal security clearancerequired?
→ Result: Confidential
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 1: security for a conjunctive query
Consider theconjunctive query: ∃xyz R(x,y)∧R(y,z) Consider therelational instance below:
R a b b c d e e d f f
Result: true
Add security annotations: Public, Confidential, Secret, Top secret, Never available
What is the minimal security clearancerequired?
→ Result: Confidential
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 1: security for a conjunctive query
Consider theconjunctive query: ∃xyz R(x,y)∧R(y,z) Consider therelational instance below:
R a b Public b c Secret d e Confidential e d Confidential f f Top secret
Result: true
Add security annotations: Public, Confidential, Secret, Top secret, Never available
What is the minimal security clearancerequired?
→ Result: Confidential
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 1: security for a conjunctive query
Consider theconjunctive query: ∃xyz R(x,y)∧R(y,z) Consider therelational instance below:
R a b Public b c Secret d e Confidential e d Confidential f f Top secret
Result: true
Add security annotations: Public, Confidential, Secret, Top secret, Never available
What is the minimal security clearancerequired?
→ Result: Confidential
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 1: security for a conjunctive query
Consider theconjunctive query: ∃xyz R(x,y)∧R(y,z) Consider therelational instance below:
R a b Public b c Secret d e Confidential e d Confidential f f Top secret
Result: true
Add security annotations: Public, Confidential, Secret, Top secret, Never available
What is the minimal security clearancerequired?
→ Result: Confidential
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 1: security for a conjunctive query
Consider theconjunctive query: ∃xyz R(x,y)∧R(y,z) Consider therelational instance below:
R a b Public b c Secret d e Confidential e d Confidential f f Top secret
Result: true
Add security annotations: Public, Confidential, Secret, Top secret, Never available
What is the minimal security clearancerequired?
→ Result: Confidential
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 1: security for a conjunctive query
Consider theconjunctive query: ∃xyz R(x,y)∧R(y,z) Consider therelational instance below:
R a b Public b c Secret d e Confidential e d Confidential f f Top secret Result: true
Add security annotations: Public, Confidential, Secret, Top secret, Never available
What is the minimal security clearancerequired?
→ Result: Confidential
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 1: security for a conjunctive query
Consider theconjunctive query: ∃xyz R(x,y)∧R(y,z) Consider therelational instance below:
R a b Public b c Secret d e Confidential e d Confidential f f Top secret
Result: true
Add security annotations: Public, Confidential, Secret, Top secret, Never available
What is the minimal security clearancerequired?
→ Result: Confidential
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 2: bag queries
Consider again: ∃xyz R(x,y)∧R(y,z).
R
a b
b c
d e
e d
f f
Result: true
Add multiplicity annotations How many query matches?
→ Result: 1 + 1 + 1 + 1 = 4
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 2: bag queries
Consider again: ∃xyz R(x,y)∧R(y,z).
R
a b
b c
d e
e d
f f
Result: true
Add multiplicity annotations How many query matches?
→ Result: 1 + 1 + 1 + 1 = 4
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 2: bag queries
Consider again: ∃xyz R(x,y)∧R(y,z).
R
a b 1
b c 1
d e 1
e d 1
f f 1
Result: true
Add multiplicity annotations
How many query matches?
→ Result: 1 + 1 + 1 + 1 = 4
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 2: bag queries
Consider again: ∃xyz R(x,y)∧R(y,z).
R
a b 1
b c 1
d e 1
e d 1
f f 1
Result: true
Add multiplicity annotations How manyquery matches?
→ Result: 1 + 1 + 1 + 1 = 4
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 2: bag queries
Consider again: ∃xyz R(x,y)∧R(y,z).
R
a b 1
b c 1
d e 1
e d 1
f f 1
Result: true
Add multiplicity annotations How manyquery matches?
→ Result: 1
+ 1 + 1 + 1 = 4
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 2: bag queries
Consider again: ∃xyz R(x,y)∧R(y,z).
R
a b 1
b c 1
d e 1
e d 1
f f 1
Result: true
Add multiplicity annotations How manyquery matches?
→ Result: 1 +1
+ 1 + 1 = 4
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 2: bag queries
Consider again: ∃xyz R(x,y)∧R(y,z).
R
a b 1
b c 1
d e 1
e d 1
f f 1
Result: true
Add multiplicity annotations How manyquery matches?
→ Result: 1 + 1 +1
+ 1 = 4
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 2: bag queries
Consider again: ∃xyz R(x,y)∧R(y,z).
R
a b 1
b c 1
d e 1
e d 1
f f 1
Result: true
Add multiplicity annotations How manyquery matches?
→ Result: 1 + 1 + 1 +1
= 4
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 2: bag queries
Consider again: ∃xyz R(x,y)∧R(y,z).
R
a b 1
b c 1
d e 1
e d 1
f f 1
Result: true
Add multiplicity annotations How manyquery matches?
→ Result: 1 + 1 + 1 + 1 = 4
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 3: uncertain facts
Consider again: ∃xyz R(x,y)∧R(y,z).
R
a b
b c
d e
e d
f f
Result: true
Assume facts areuncertain, give thematomic annotations For which subinstancesdoes the query hold?
→ Result: (f1∧f2)∨(f3∧f4)∨f5
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 3: uncertain facts
Consider again: ∃xyz R(x,y)∧R(y,z).
R
a b
b c
d e
e d
f f
Result: true
Assume facts areuncertain, give thematomic annotations For which subinstancesdoes the query hold?
→ Result: (f1∧f2)∨(f3∧f4)∨f5
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 3: uncertain facts
Consider again: ∃xyz R(x,y)∧R(y,z).
R a b f1 b c f2 d e f3 e d f4 f f f5
Result: true
Assume facts areuncertain, give thematomic annotations
For which subinstancesdoes the query hold?
→ Result: (f1∧f2)∨(f3∧f4)∨f5
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 3: uncertain facts
Consider again: ∃xyz R(x,y)∧R(y,z).
R a b f1 b c f2 d e f3 e d f4 f f f5
Result: true
Assume facts areuncertain, give thematomic annotations For which subinstancesdoes the query hold?
→ Result: (f1∧f2)∨(f3∧f4)∨f5
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 3: uncertain facts
Consider again: ∃xyz R(x,y)∧R(y,z).
R
a b f1
b c f2
d e f3 e d f4 f f f5
Result: true
Assume facts areuncertain, give thematomic annotations For which subinstancesdoes the query hold?
→ Result: (f1∧f2)
∨(f3∧f4)∨f5
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 3: uncertain facts
Consider again: ∃xyz R(x,y)∧R(y,z).
R a b f1 b c f2
d e f3
e d f4
f f f5
Result: true
Assume facts areuncertain, give thematomic annotations For which subinstancesdoes the query hold?
→ Result: (f1∧f2)∨(f3∧f4)
∨f5
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 3: uncertain facts
Consider again: ∃xyz R(x,y)∧R(y,z).
R a b f1 b c f2
d e f3
e d f4
f f f5
Result: true
Assume facts areuncertain, give thematomic annotations For which subinstancesdoes the query hold?
→ Result: (f1∧f2)∨(f3∧f4)
∨f5
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 3: uncertain facts
Consider again: ∃xyz R(x,y)∧R(y,z).
R a b f1 b c f2 d e f3 e d f4
f f f5
Result: true
Assume facts areuncertain, give thematomic annotations For which subinstancesdoes the query hold?
→ Result: (f1∧f2)∨(f3∧f4)∨f5
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 3: uncertain facts
Consider again: ∃xyz R(x,y)∧R(y,z).
R a b f1 b c f2 d e f3 e d f4 f f f5
Result: true
Assume facts areuncertain, give thematomic annotations For which subinstancesdoes the query hold?
→ Result: (f1∧f2)∨(f3∧f4)∨f5
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 4: the universal semiring N [X]
Consider again: ∃xyz R(x,y)∧R(y,z).
Annotate input factswith atomic annotationsX=f1, . . . ,fn Most general semiring: N[X]of polynomials onX
R a b f1 b c f2 d e f3 e d f4 f f f5
→ Result: (f1⊗f2)⊕(f3⊗f4)⊕(f4⊗f3)⊕(f5⊗f5)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 4: the universal semiring N [X]
Consider again: ∃xyz R(x,y)∧R(y,z).
Annotate input factswith atomic annotationsX=f1, . . . ,fn Most general semiring: N[X]of polynomials onX
R a b f1 b c f2 d e f3 e d f4 f f f5
→ Result:
(f1⊗f2)⊕(f3⊗f4)⊕(f4⊗f3)⊕(f5⊗f5)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 4: the universal semiring N [X]
Consider again: ∃xyzR(x,y)∧R(y,z).
Annotate input factswith atomic annotationsX=f1, . . . ,fn Most general semiring: N[X]of polynomials onX
R
a b f1
b c f2 d e f3 e d f4 f f f5
→ Result:
(f1⊗f2)⊕(f3⊗f4)⊕(f4⊗f3)⊕(f5⊗f5)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 4: the universal semiring N [X]
Consider again: ∃xyzR(x,y)∧R(y,z).
Annotate input factswith atomic annotationsX=f1, . . . ,fn Most general semiring: N[X]of polynomials onX
R
a b f1
b c f2 d e f3 e d f4 f f f5
→ Result: (f1⊗f2)
⊕(f3⊗f4)⊕(f4⊗f3)⊕(f5⊗f5)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 4: the universal semiring N [X]
Consider again: ∃xyzR(x,y)∧R(y,z).
Annotate input factswith atomic annotationsX=f1, . . . ,fn Most general semiring: N[X]of polynomials onX
R a b f1 b c f2
d e f3
e d f4 f f f5
→ Result: (f1⊗f2)
⊕(f3⊗f4)⊕(f4⊗f3)⊕(f5⊗f5)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 4: the universal semiring N [X]
Consider again: ∃xyzR(x,y)∧R(y,z).
Annotate input factswith atomic annotationsX=f1, . . . ,fn Most general semiring: N[X]of polynomials onX
R a b f1 b c f2
d e f3
e d f4 f f f5
→ Result: (f1⊗f2)⊕(f3⊗f4)
⊕(f4⊗f3)⊕(f5⊗f5)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 4: the universal semiring N [X]
Consider again: ∃xyzR(x,y)∧R(y,z).
Annotate input factswith atomic annotationsX=f1, . . . ,fn Most general semiring: N[X]of polynomials onX
R a b f1 b c f2 d e f3
e d f4
f f f5
→ Result: (f1⊗f2)⊕(f3⊗f4)
⊕(f4⊗f3)⊕(f5⊗f5)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 4: the universal semiring N [X]
Consider again: ∃xyzR(x,y)∧R(y,z).
Annotate input factswith atomic annotationsX=f1, . . . ,fn Most general semiring: N[X]of polynomials onX
R a b f1 b c f2 d e f3
e d f4
f f f5
→ Result: (f1⊗f2)⊕(f3⊗f4)⊕(f4⊗f3)
⊕(f5⊗f5)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 4: the universal semiring N [X]
Consider again: ∃xyzR(x,y)∧R(y,z).
Annotate input factswith atomic annotationsX=f1, . . . ,fn Most general semiring: N[X]of polynomials onX
R a b f1 b c f2 d e f3 e d f4
f f f5
→ Result: (f1⊗f2)⊕(f3⊗f4)⊕(f4⊗f3)
⊕(f5⊗f5)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 4: the universal semiring N [X]
Consider again: ∃xyzR(x,y)∧R(y,z).
Annotate input factswith atomic annotationsX=f1, . . . ,fn Most general semiring: N[X]of polynomials onX
R a b f1 b c f2 d e f3 e d f4
f f f5
→ Result: (f1⊗f2)⊕(f3⊗f4)⊕(f4⊗f3)⊕(f5⊗f5)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example 4: the universal semiring N [X]
Consider again: ∃xyz R(x,y)∧R(y,z).
Annotate input factswith atomic annotationsX=f1, . . . ,fn Most general semiring: N[X]of polynomials onX
R a b f1 b c f2 d e f3 e d f4 f f f5
→ Result: (f1⊗f2)⊕(f3⊗f4)⊕(f4⊗f3)⊕(f5⊗f5)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Specialization and homomorphisms
These examples are captured by commutative semirings:
securitysemiring(K,min,max,Public,Never available) bagsemiring(N,+,×,0,1)
Booleansemiring(PosBool[X],∨,∧,f,t) universalsemiring(N[X],+,×,0,1)
N[X]is theuniversal semiring:
The provenance forN[X] can bespecializedto anyK[X] Bycommutation with homomorphisms, atomic annotations inXcan be replaced by their value in K
→ Computing N[X]provenancesubsumes all tasks
→ It can be done inPTIME data complexity for CQs
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Specialization and homomorphisms
These examples are captured by commutative semirings:
securitysemiring(K,min,max,Public,Never available) bagsemiring(N,+,×,0,1)
Booleansemiring(PosBool[X],∨,∧,f,t) universalsemiring(N[X],+,×,0,1) N[X]is theuniversal semiring:
The provenance forN[X] can bespecializedto anyK[X]
Bycommutation with homomorphisms, atomic annotations inXcan be replaced by their value in K
→ Computing N[X]provenancesubsumes all tasks
→ It can be done inPTIME data complexity for CQs
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Specialization and homomorphisms
These examples are captured by commutative semirings:
securitysemiring(K,min,max,Public,Never available) bagsemiring(N,+,×,0,1)
Booleansemiring(PosBool[X],∨,∧,f,t) universalsemiring(N[X],+,×,0,1) N[X]is theuniversal semiring:
The provenance forN[X] can bespecializedto anyK[X]
Bycommutation with homomorphisms, atomic annotations inXcan be replaced by their value in K
→ Computing N[X]provenancesubsumes all tasks
→ It can be done inPTIME data complexity for CQs
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Provenance and probability
Probabilistic query evaluation:
FixedCQq, and inputTID instance:
R a b 0.6 b c 0.9
→ Computing theprobabilityof thePosBool[X]-provenance
→ #P-hard in data complexity
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Provenance and probability
Probabilistic query evaluation:
FixedCQq, and inputTID instance:
R a b 0.6 b c 0.9
→ Computing theprobabilityof thePosBool[X]-provenance
→ #P-hard in data complexity
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Provenance and probability
Probabilistic query evaluation:
FixedCQq, and inputTID instance:
R a b 0.6 b c 0.9
→ Computing theprobabilityof thePosBool[X]-provenance
→ #P-hard in data complexity
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Trees and treelike instances
Idea: restrict the instances to trees andtreelike instances Tree decompositionof an instance: cover all facts
Treewidth: minimal width (bag size) of a decomposition Treeshave treewidth1
Cycleshave treewidth2
k-cliquesandk-gridshave treewidthk−1 Treelike: thetreewidthis bounded by aconstant
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Trees and treelike instances
Idea: restrict the instances to trees andtreelike instances Tree decompositionof an instance: cover all facts Treewidth: minimal width (bag size) of a decomposition
Treeshave treewidth1 Cycleshave treewidth2
k-cliquesandk-gridshave treewidthk−1 Treelike: thetreewidthis bounded by aconstant
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Trees and treelike instances
Idea: restrict the instances to trees andtreelike instances Tree decompositionof an instance: cover all facts Treewidth: minimal width (bag size) of a decomposition
Treeshave treewidth1 Cycleshave treewidth2
k-cliquesandk-gridshave treewidthk−1
Treelike: thetreewidthis bounded by aconstant
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Trees and treelike instances
Idea: restrict the instances to trees andtreelike instances Tree decompositionof an instance: cover all facts Treewidth: minimal width (bag size) of a decomposition
Treeshave treewidth1 Cycleshave treewidth2
k-cliquesandk-gridshave treewidthk−1 Treelike: thetreewidth is bounded by aconstant
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Problem statement
Many tasks have tractable data complexity ontreelike instances:
MSO query evaluationislinear[Courcelle, 1990]
MSO result countingislinear [Arnborg et al., 1991]
Probability evaluationislinearfortrees[Cohen et al., 2009]
(MSOcovers relational algebra, UCQs, monadic Datalog...)
→ Can we define provenance in this setting?
→ Can we computeit efficiently?
→ Can we generalizethe above results?
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Problem statement
Many tasks have tractable data complexity ontreelike instances:
MSO query evaluationislinear[Courcelle, 1990]
MSO result countingislinear [Arnborg et al., 1991]
Probability evaluationislinearfortrees[Cohen et al., 2009]
(MSOcovers relational algebra, UCQs, monadic Datalog...)
→ Can we define provenance in this setting?
→ Can we computeit efficiently?
→ Can we generalizethe above results?
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Problem statement
Many tasks have tractable data complexity ontreelike instances:
MSO query evaluationislinear[Courcelle, 1990]
MSO result countingislinear [Arnborg et al., 1991]
Probability evaluationislinearfortrees[Cohen et al., 2009]
(MSOcovers relational algebra, UCQs, monadic Datalog...)
→ Can we define provenance in this setting?
→ Can we computeit efficiently?
→ Can we generalizethe above results?
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Problem statement
Many tasks have tractable data complexity ontreelike instances:
MSO query evaluationislinear[Courcelle, 1990]
MSO result countingislinear [Arnborg et al., 1991]
Probability evaluationislinearfortrees[Cohen et al., 2009]
(MSOcovers relational algebra, UCQs, monadic Datalog...)
→ Can we define provenance in this setting?
→ Can we computeit efficiently?
→ Can we generalizethe above results?
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Table of contents
1 Introduction
2 Bool[X]-provenance
3 N[X]-provenance
4 Conclusion
Introduction Bool[X]-provenance N[X]-provenance Conclusion
General idea
Bool[X]-provenance on treesand treelike instances The world of trees:
Query: MSO on trees The world of treelike instances:
Query: MSO on the instance
→ Reduces to trees[Courcelle, 1990]
→ Start with Bool[X]-provenance for queries ontrees
Introduction Bool[X]-provenance N[X]-provenance Conclusion
General idea
Bool[X]-provenance on treesand treelike instances The world of trees:
Query: MSO on trees The world of treelike instances:
Query: MSO on the instance
→ Reduces to trees[Courcelle, 1990]
→ Start with Bool[X]-provenance for queries ontrees
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Uncertain trees
1
5
7 6
2
4 3
A valuationof a tree decides whether to keepor discard node labels.
Example query:
“Is there both a red and a green node?”
Valuation: {1,2,3,4,5,6,7} The query is true
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Uncertain trees
1
5
7 6
2
4 3
A valuationof a tree decides whether to keepor discard node labels.
Example query:
“Is there both a red and a green node?”
Valuation: {1,2,5,6} The query is false
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Uncertain trees
1
5
7 6
2
4 3
A valuationof a tree decides whether to keepor discard node labels.
Example query:
“Is there both a red and a green node?”
Valuation: {2,7} The query is true
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Provenance formulae and circuits
1
5
7 6
2
4 3
Whichvaluations satisfy the query?
→ Provenance formula of a query q on an uncertain treeT:
Boolean formulaϕ onvariablesx1. . .x7
→ ν(T)satisfiesqiffν(ϕ)istrue Provenance circuit ofq onT [Deutch et al., 2014]
Boolean circuitC withinput gatesg1. . .g7
→ ν(T)satisfiesqiffν(C)is true
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Provenance formulae and circuits
1
5
7 6
2
4 3
Whichvaluations satisfy the query?
→ Provenance formula of a query q on an uncertain treeT:
Boolean formulaϕ onvariablesx1. . .x7
→ ν(T)satisfiesqiffν(ϕ)istrue
Provenance circuit ofq onT [Deutch et al., 2014]
Boolean circuitC withinput gatesg1. . .g7
→ ν(T)satisfiesqiffν(C)is true
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Provenance formulae and circuits
1
5
7 6
2
4 3
Whichvaluations satisfy the query?
→ Provenance formula of a query q on an uncertain treeT:
Boolean formulaϕ onvariablesx1. . .x7
→ ν(T)satisfiesqiffν(ϕ)istrue Provenance circuit ofq onT [Deutch et al., 2014]
Boolean circuitC withinput gatesg1. . .g7
→ ν(T)satisfiesqiffν(C)is true
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example
1
5
7 6
2
4 3
Is there both a red and agreennode?
Provenance formula: (x2∨x3)∧x7 Provenance circuit:
∧
∨ g7
g2 g3
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example
1
5
7 6
2
4 3
Is there both a red and agreennode?
Provenance formula: (x2∨x3)∧x7
Provenance circuit:
∧
∨ g7
g2 g3
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Example
1
5
7 6
2
4 3
Is there both a red and agreennode?
Provenance formula: (x2∨x3)∧x7 Provenance circuit:
∧
∨ g7
g2 g3
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Our main result on trees
Theorem
For any fixedMSO query q (first order + quantify on sets), for any inputtree T,
we can build aBool[X]provenance circuitof q on T inlinear time in T.
→ Key ideas:
Compile q to a tree automaton[Thatcher and Wright, 1968] Write thepossible transitions of the automaton onT
Corollary
If tree nodes have a probabilityof being independently kept, we can compute thequery probability in linear time.
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Our main result on trees
Theorem
For any fixedMSO query q (first order + quantify on sets), for any inputtree T,
we can build aBool[X]provenance circuitof q on T inlinear time in T.
→ Key ideas:
Compile q to a tree automaton[Thatcher and Wright, 1968]
Write thepossible transitions of the automaton onT
Corollary
If tree nodes have a probabilityof being independently kept, we can compute thequery probability in linear time.
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Our main result on trees
Theorem
For any fixedMSO query q (first order + quantify on sets), for any inputtree T,
we can build aBool[X]provenance circuitof q on T inlinear time in T.
→ Key ideas:
Compile q to a tree automaton[Thatcher and Wright, 1968]
Write thepossible transitions of the automaton onT Corollary
If tree nodes have aprobability of being independently kept, we can compute thequery probability in linear time.
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Treelike instances
Tree encodings: represent treelike instances as trees
MSO queryon an instance→MSO query on the tree encoding
Uncertain instance: each fact can be present or absent
→ Possible subinstancesare possible valuationsof the encoding R
a b b c b d
R(a1,a2)
R(a2,a3) R(a2,a3)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Treelike instances
Tree encodings: represent treelike instances as trees
MSO queryon an instance→MSO query on the tree encoding Uncertain instance: each fact can be present or absent
→ Possible subinstancesare possible valuationsof the encoding R
a b b c b d
R(a1,a2)
R(a2,a3) R(a2,a3)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Treelike instances
Tree encodings: represent treelike instances as trees
MSO queryon an instance→MSO query on the tree encoding Uncertain instance: each fact can be present or absent
→ Possible subinstancesare possible valuationsof the encoding R
a b b c b d
R(a1,a2)
R(a2,a3) R(a2,a3)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Treelike instances
Tree encodings: represent treelike instances as trees
MSO queryon an instance→MSO query on the tree encoding Uncertain instance: each fact can be present or absent
→ Possible subinstancesare possible valuationsof the encoding R
a b b c b d
R(a1,a2)
R(a2,a3) R(a2,a3)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Treelike instances
Tree encodings: represent treelike instances as trees
MSO queryon an instance→MSO query on the tree encoding Uncertain instance: each fact can be present or absent
→ Possible subinstancesare possible valuationsof the encoding R
a b b c b d
R(a1,a2)
R(a2,a3) R(a2,a3)
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Our result and consequences
Theorem
For any fixedMSO query q and k∈N, for any inputinstance I of treewidth≤k,
we can build inlinear time aBool[X]provenance circuit of q on I.
Corollary
MSO queries havelineardata complexity on treelike TID instances.
Corollary
MSO counting haslinear timecomplexity (already known).
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Our result and consequences
Theorem
For any fixedMSO query q and k∈N, for any inputinstance I of treewidth≤k,
we can build inlinear time aBool[X]provenance circuit of q on I.
Corollary
MSO queries havelineardata complexity on treelike TID instances.
Corollary
MSO counting haslinear timecomplexity (already known).
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Our result and consequences
Theorem
For any fixedMSO query q and k∈N, for any inputinstance I of treewidth≤k,
we can build inlinear time aBool[X]provenance circuit of q on I.
Corollary
MSO queries havelineardata complexity on treelike TID instances.
Corollary
MSO counting haslinear timecomplexity (already known).
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Table of contents
1 Introduction
2 Bool[X]-provenance
3 N[X]-provenance
4 Conclusion
Introduction Bool[X]-provenance N[X]-provenance Conclusion
First problem: non-monotone queries
We want to movefrom Bool[X]toN[X]
Semirings and negationdon’t mix [Amsterdamer et al., 2011]
Our previous construction builds circuits with NOT-gates
→ q monotoneif I|=q impliesI′ |=q for all I′ ⊇I
→ Provenance circuits for monotone queries can bemonotone
Introduction Bool[X]-provenance N[X]-provenance Conclusion
First problem: non-monotone queries
We want to movefrom Bool[X]toN[X]
Semirings and negationdon’t mix [Amsterdamer et al., 2011]
Our previous construction builds circuits with NOT-gates
→ q monotoneif I|=q impliesI′ |=q for all I′ ⊇I
→ Provenance circuits for monotone queries can bemonotone
Introduction Bool[X]-provenance N[X]-provenance Conclusion
First problem: non-monotone queries
We want to movefrom Bool[X]toN[X]
Semirings and negationdon’t mix [Amsterdamer et al., 2011]
Our previous construction builds circuits with NOT-gates
→ q monotoneif I|=q impliesI′ |=q for all I′ ⊇I
→ Provenance circuits for monotone queries can bemonotone
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Second problem: intrinsic definition
Boolean provenance has an intrinsic definition:
“Characterize which subinstances satisfy the query”
→ Independent from how the query iswritten
→ Independent from itsencodingon trees N[X]-provenance was definedoperationally
→ Depends on how the query iswritten
→ We restrict to (Boolean) UCQs from now on
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Second problem: intrinsic definition
Boolean provenance has an intrinsic definition:
“Characterize which subinstances satisfy the query”
→ Independent from how the query iswritten
→ Independent from itsencodingon trees N[X]-provenance was definedoperationally
→ Depends on how the query iswritten
→ We restrict to (Boolean) UCQs from now on
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Provenance of a Boolean CQ
R a a x1 b c x2 c b x3
Query: q:∃xy R(x,y)∧R(y,x)
Provenance:
(x1⊗x1)⊕(x2⊗x3)⊕(x3⊗x2) akax21+ 2x2x3
Definition:
Sumover query matches Multiplyover matched facts How isN[X]more expressive thanPosBool[X]?
→ Coefficients: counting multiple derivations
→ Exponents: using facts multiple times
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Provenance of a Boolean CQ
R a a x1 b c x2 c b x3
Query: q:∃xyR(x,y)∧R(y,x) Provenance:
(x1⊗x1)⊕(x2⊗x3)⊕(x3⊗x2) akax21+ 2x2x3
Definition:
Sumover query matches Multiplyover matched facts How isN[X]more expressive thanPosBool[X]?
→ Coefficients: counting multiple derivations
→ Exponents: using facts multiple times
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Provenance of a Boolean CQ
R a a x1 b c x2 c b x3
Query: q:∃xyR(x,y)∧R(y,x) Provenance:
(x1⊗x1)
⊕(x2⊗x3)⊕(x3⊗x2) akax21+ 2x2x3
Definition:
Sumover query matches Multiplyover matched facts How isN[X]more expressive thanPosBool[X]?
→ Coefficients: counting multiple derivations
→ Exponents: using facts multiple times
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Provenance of a Boolean CQ
R a a x1 b c x2 c b x3
Query: q:∃xyR(x,y)∧R(y,x) Provenance:
(x1⊗x1)
⊕(x2⊗x3)⊕(x3⊗x2) akax21+ 2x2x3
Definition:
Sumover query matches Multiplyover matched facts How isN[X]more expressive thanPosBool[X]?
→ Coefficients: counting multiple derivations
→ Exponents: using facts multiple times
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Provenance of a Boolean CQ
R a a x1 b c x2 c b x3
Query: q:∃xyR(x,y)∧R(y,x) Provenance:
(x1⊗x1)⊕(x2⊗x3)
⊕(x3⊗x2) akax21+ 2x2x3
Definition:
Sumover query matches Multiplyover matched facts How isN[X]more expressive thanPosBool[X]?
→ Coefficients: counting multiple derivations
→ Exponents: using facts multiple times
Introduction Bool[X]-provenance N[X]-provenance Conclusion
Provenance of a Boolean CQ
R a a x1 b c x2 c b x3
Query: q:∃xyR(x,y)∧R(y,x) Provenance:
(x1⊗x1)⊕(x2⊗x3)
⊕(x3⊗x2) akax21+ 2x2x3
Definition:
Sumover query matches Multiplyover matched facts How isN[X]more expressive thanPosBool[X]?
→ Coefficients: counting multiple derivations
→ Exponents: using facts multiple times