first order knowledge compilation
play

First-Order Knowledge Compilation Guy Van den Broeck Dagstuhl - PowerPoint PPT Presentation

First-Order Knowledge Compilation Guy Van den Broeck Dagstuhl Sept 18, 2017 Overview 1. Propositional Refresher 2. Primer: A First-Order Tractable Language 3. Probabilistic Databases 4. Symmetric First-Order Model Counting 5. Lots of


  1. What we know 1. Any d-D FO Circuit Q admits efficient P(Q) in the size of weight function w(.) 2. Computing P(H 0 ) is #P -hard 3. Therefore H 0 has no d-D FO Circuit under standard complexity assumptions

  2. What we know 1. Any d-D FO Circuit Q admits efficient P(Q) in the size of weight function w(.) 2. Computing P(H 0 ) is #P -hard 3. Therefore H 0 has no d-D FO Circuit under standard complexity assumptions Next: This generalizes!

  3. Background: Hierarchical Queries at(x) = set of atoms containing the variable x Definition Q is hierarchical if for all variables x, y: at(x) ⊆ at(y) or at(x) ⊇ at(y) or at(x) ∩ at(y) = ∅

  4. Background: Hierarchical Queries at(x) = set of atoms containing the variable x Definition Q is hierarchical if for all variables x, y: at(x) ⊆ at(y) or at(x) ⊇ at(y) or at(x) ∩ at(y) = ∅ Hierarchical Q = ∀ x ∀ y ∀ z S(x,y) ∨ T(x,z) x y z S R

  5. Background: Hierarchical Queries at(x) = set of atoms containing the variable x Definition Q is hierarchical if for all variables x, y: at(x) ⊆ at(y) or at(x) ⊇ at(y) or at(x) ∩ at(y) = ∅ Non-hierarchical Hierarchical Q = ∀ x ∀ y ∀ z S(x,y) ∨ T(x,z) H 0 = ∀ x ∀ y S(x) ∨ F(x,y) ∨ J(y) x y J x S F y z S R

  6. The Small Dichotomy Theorem Theorem Let Q be one clause, with no repeated symbols • If Q is hierarchical, then P(Q) is in PTIME . • If Q is not hierarchical then P(Q) is #P -hard. [Dalvi&S.04]

  7. The Small Dichotomy Theorem Theorem Let Q be one clause, with no repeated symbols • If Q is hierarchical, then P(Q) is in PTIME . • If Q is not hierarchical then P(Q) is #P -hard. [Dalvi&S.04] Corollary Let Q be one clause, with no repeated symbols • If Q is hierarchical, then Q has a d-D FO Circuit • If Q is not hierarchical then Q has no d-D FO Circuit under standard complexity assumptions

  8. The Small Dichotomy Theorem Theorem Let Q be one clause, with no repeated symbols • If Q is hierarchical, then P(Q) is in PTIME . • If Q is not hierarchical then P(Q) is #P -hard. [Dalvi&S.04] Corollary Let Q be one clause, with no repeated symbols • If Q is hierarchical, then Q has a d-D FO Circuit • If Q is not hierarchical then Q has no d-D FO Circuit under standard complexity assumptions Checking “ Q is hierarchical” is in AC 0 (expression complexity) Compiling the d-D FO Circuit is in PTIME

  9. Proof Hierarchical  PTIME

  10. Proof Hierarchical  PTIME Case 1: x Q= ∀ x must be decomposable

  11. Proof Hierarchical  PTIME Case 1: Case 2: x v Q 2 Q= Q= Q 1 ∀ x must be decomposable v must be decomposable

  12. Proof Hierarchical  PTIME Case 1: Case 2: x v Q 2 Q= Q= Q 1 ∀ x must be decomposable v must be decomposable Non-hierarchical  #P -hard y Reduction from H 0 : x F J S Q = … S(x , … ) v F(x,y ,… ) v J(y ,…), …

  13. Overview 1. Propositional Refresher 2. Primer: A First-Order Tractable Language 3. Probabilistic Databases 4. Symmetric First-Order Model Counting 5. Lots of Pointers

  14. Probabilistic Databases • Tuple-independent probabilistic database Scientist Coauthor x y P x P Erdos Renyi Erdos 0.9 0.6 Einstein Einstein Pauli 0.7 0.8 Pauli Obama Erdos 0.6 0.1 • Learned from the web, large text corpora, ontologies, etc., using statistical machine learning. [Suciu‟11]

  15. Probabilistic Databases ∃ x Coauthor(Einstein,x) ∧ Coauthor(Erdos,x) • Conjunctive queries (CQ) ∃ + ∧

  16. Probabilistic Databases ∃ x Coauthor(Einstein,x) ∧ Coauthor(Erdos,x) • Conjunctive queries (CQ) ∃ + ∧ • Unions of conjunctive queries (UCQ) v of ∃ + ∧

  17. Probabilistic Databases ∃ x Coauthor(Einstein,x) ∧ Coauthor(Erdos,x) • Conjunctive queries (CQ) ∃ + ∧ • Unions of conjunctive queries (UCQ) v of ∃ + ∧ • Duality – Negation of CQ is monotone ∀ -clause – Negation of UCQ is monotone ∀ -CNF

  18. Tuple-Independent Probabilistic DB Coauthor x y P Probabilistic database D: A B p 1 A C p 2 B C p 3

  19. Tuple-Independent Probabilistic DB Coauthor x y P Probabilistic database D: A B p 1 A C p 2 B C p 3 Possible worlds semantics: x y A B A C p 1 p 2 p 3 B C

  20. Tuple-Independent Probabilistic DB Coauthor x y P Probabilistic database D: A B p 1 A C p 2 B C p 3 Possible worlds semantics: x y x y A B A C A C p 1 p 2 p 3 B C B C (1-p 1 )p 2 p 3

  21. Tuple-Independent Probabilistic DB Coauthor x y P Probabilistic database D: A B p 1 A C p 2 B C p 3 Possible worlds semantics: x y (1-p 1 )(1-p 2 )(1-p 3 ) x y x y A B x y A C A B x y A C A B x y p 1 p 2 p 3 B C A C A B x y B C B C x y A C (1-p 1 )p 2 p 3 B C

  22. Probabilistic Query Evaluation Q = ∃ x ∃ y Scientist(x) ∧ Coauthor(x,y) P( Q ) = Coauthor x y P A D q 1 Y 1 Scientist x P A E q 2 Y 2 A p 1 X 1 B F q 3 Y 3 B p 2 X 2 B G q 4 Y 4 C p 3 X 3 B H q 5 Y 5

  23. Probabilistic Query Evaluation Q = ∃ x ∃ y Scientist(x) ∧ Coauthor(x,y) P( Q ) = 1-(1-q 1 )*(1-q 2 ) Coauthor x y P A D q 1 Y 1 Scientist x P A E q 2 Y 2 A p 1 X 1 B F q 3 Y 3 B p 2 X 2 B G q 4 Y 4 C p 3 X 3 B H q 5 Y 5

  24. Probabilistic Query Evaluation Q = ∃ x ∃ y Scientist(x) ∧ Coauthor(x,y) P( Q ) = p 1 *[ ] 1-(1-q 1 )*(1-q 2 ) Coauthor x y P A D q 1 Y 1 Scientist x P A E q 2 Y 2 A p 1 X 1 B F q 3 Y 3 B p 2 X 2 B G q 4 Y 4 C p 3 X 3 B H q 5 Y 5

  25. Probabilistic Query Evaluation Q = ∃ x ∃ y Scientist(x) ∧ Coauthor(x,y) P( Q ) = p 1 *[ ] 1-(1-q 1 )*(1-q 2 ) 1-(1-q 3 )*(1-q 4 )*(1-q 5 ) Coauthor x y P A D q 1 Y 1 Scientist x P A E q 2 Y 2 A p 1 X 1 B F q 3 Y 3 B p 2 X 2 B G q 4 Y 4 C p 3 X 3 B H q 5 Y 5

  26. Probabilistic Query Evaluation Q = ∃ x ∃ y Scientist(x) ∧ Coauthor(x,y) P( Q ) = p 1 *[ ] 1-(1-q 1 )*(1-q 2 ) p 2 *[ ] 1-(1-q 3 )*(1-q 4 )*(1-q 5 ) Coauthor x y P A D q 1 Y 1 Scientist x P A E q 2 Y 2 A p 1 X 1 B F q 3 Y 3 B p 2 X 2 B G q 4 Y 4 C p 3 X 3 B H q 5 Y 5

  27. Probabilistic Query Evaluation Q = ∃ x ∃ y Scientist(x) ∧ Coauthor(x,y) P( Q ) = 1- {1- } * p 1 *[ ] 1-(1-q 1 )*(1-q 2 ) {1- } p 2 *[ ] 1-(1-q 3 )*(1-q 4 )*(1-q 5 ) Coauthor x y P A D q 1 Y 1 Scientist x P A E q 2 Y 2 A p 1 X 1 B F q 3 Y 3 B p 2 X 2 B G q 4 Y 4 C p 3 X 3 B H q 5 Y 5

  28. From Probabilities to WMC Friend x y P A B p 1 A C p 2 B C p 3 x y x y x y A B x y A C A B A C x y A B B C (1-p 1 )(1-p 2 )(1-p 3 ) A C B C p 1 p 2 p 3 x y A B B C x y A C x y (1-p 1 )p 2 p 3 B C

  29. From Probabilities to WMC Friend x y P A B p 1 A C p 2 B C p 3 x y x y x y A B x y A C A B A C x y A B B C (1-p 1 )(1-p 2 )(1-p 3 ) A C B C p 1 p 2 p 3 x y A B B C x y A C x y (1-p 1 )p 2 p 3 B C

  30. From Probabilities to WMC x y w(Friend(x,y)) w(¬Friend(x,y)) Friend  A B w 1 = p 1 w 1 = 1-p 1 x y P A C w 2 = p 2 w 2 = 1-p 2 A B p 1 B C w 3 = p 3 w 3 = 1-p 3 A C p 2 A A w 4 = 0 w 4 = 1 B C p 3 A C w 5 = 0 w 5 = 1 … … Also for x y missing x y tuples! x y A B w 1 w 2 w 3 x y A C A B A C x y A B B C (1-p 1 )(1-p 2 )(1-p 3 ) A C B C p 1 p 2 p 3 x y A B B C x y A C x y w 1 w 2 w 3 (1-p 1 )p 2 p 3 B C w 1 w 2 w 3

  31. Lifted Inference Rules Preprocess Q (omitted) *Suciu’11+

  32. Lifted Inference Rules Preprocess Q (omitted) Decomposability Determinism *Suciu’11+

  33. Lifted Inference Rules Preprocess Q (omitted) Decomposability Determinism P(Q1 ∧ Q2) = P(Q1) + P(Q2) - P(Q1 ∨ Q2) Inclusion/ P(Q1 ∨ Q2) = P(Q1) + P(Q2) - P(Q1 ∧ Q2) Exclusion *Suciu’11+

  34. Lifted Inference Rules Preprocess Q (omitted) Decomposability Determinism Why? P(Q1 ∧ Q2) = P(Q1) + P(Q2) - P(Q1 ∨ Q2) Inclusion/ P(Q1 ∨ Q2) = P(Q1) + P(Q2) - P(Q1 ∧ Q2) Exclusion *Suciu’11+

  35. Background: #P -hard Queries H k H 0 = R(x) ∨ S(x,y) ∨ T(y) Will drop ∀ to reduce clutter H 1 = [R(x 0 ) ∨ S(x 0 ,y 0 )] ∧ [S(x 1 ,y 1 ) ∨ T(y 1 )]

  36. Background: #P -hard Queries H k H 0 = R(x) ∨ S(x,y) ∨ T(y) Will drop ∀ to reduce clutter H 1 = [R(x 0 ) ∨ S(x 0 ,y 0 )] ∧ [S(x 1 ,y 1 ) ∨ T(y 1 )] H 2 = [R(x 0 ) ∨ S 1 (x 0 ,y 0 )] ∧ [S 1 (x 1 ,y 1 ) ∨ S 2 (x 1 ,y 1 )] ∨ [S 2 (x 2 ,y 2 ) ∨ T(y 2 )]

  37. Background: #P -hard Queries H k H 0 = R(x) ∨ S(x,y) ∨ T(y) Will drop ∀ to reduce clutter H 1 = [R(x 0 ) ∨ S(x 0 ,y 0 )] ∧ [S(x 1 ,y 1 ) ∨ T(y 1 )] H 2 = [R(x 0 ) ∨ S 1 (x 0 ,y 0 )] ∧ [S 1 (x 1 ,y 1 ) ∨ S 2 (x 1 ,y 1 )] ∨ [S 2 (x 2 ,y 2 ) ∨ T(y 2 )] H 3 = [R(x 0 ) ∨ S 1 (x 0 ,y 0 )] ∧ [S 1 (x 1 ,y 1 ) ∨ S 2 (x 1 ,y 1 )] ∧ [S 2 (x 2 ,y 2 ) ∨ S 3 (x 2 ,y 2 )] ∧ [S 3 (x 3 ,y 3 ) ∨ T(y 3 )] …

  38. Background: #P -hard Queries H k H 0 = R(x) ∨ S(x,y) ∨ T(y) Will drop ∀ to reduce clutter H 1 = [R(x 0 ) ∨ S(x 0 ,y 0 )] ∧ [S(x 1 ,y 1 ) ∨ T(y 1 )] H 2 = [R(x 0 ) ∨ S 1 (x 0 ,y 0 )] ∧ [S 1 (x 1 ,y 1 ) ∨ S 2 (x 1 ,y 1 )] ∨ [S 2 (x 2 ,y 2 ) ∨ T(y 2 )] H 3 = [R(x 0 ) ∨ S 1 (x 0 ,y 0 )] ∧ [S 1 (x 1 ,y 1 ) ∨ S 2 (x 1 ,y 1 )] ∧ [S 2 (x 2 ,y 2 ) ∨ S 3 (x 2 ,y 2 )] ∧ [S 3 (x 3 ,y 3 ) ∨ T(y 3 )] … Theorem. Every query H k is #P -hard [Dalvi&S‟12]

  39. I/E and Cancellations Q W = [(R(x 0 ) ∨ S 1 (x 0 ,y 0 )) ∧ (S 2 (x 2 ,y 2 ) ∨ S 3 (x 2 ,y 2 ))] Q 1 ∨ [(R(x 0 ) ∨ S 1 (x 0 ,y 0 )) ∧ (S 3 (x 3 ,y 3 ) ∨ T(y 3 ))] Q 2 ∨ [(S 1 (x 1 ,y 1 ) ∨ S 2 (x 1 ,y 1 )) ∧ (S 3 (x 3 ,y 3 ) ∨ T(y 3 ))] Q 3 [Suciu‟11]

  40. I/E and Cancellations Q W = [(R(x 0 ) ∨ S 1 (x 0 ,y 0 )) ∧ (S 2 (x 2 ,y 2 ) ∨ S 3 (x 2 ,y 2 ))] Q 1 ∨ [(R(x 0 ) ∨ S 1 (x 0 ,y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 Q 2 ∧ Q 3 ) = H 3 ( #P -hard !) Also = H 3 [Suciu‟11]

  43. I/E and Cancellations Q W = [(R(x 0 ) ∨ S 1 (x 0 ,y 0 )) ∧ (S 2 (x 2 ,y 2 ) ∨ S 3 (x 2 ,y 2 ))] Q 1 ∨ [(R(x 0 ) ∨ S 1 (x 0 ,y 0 )) ∧ (S 3 (x 3 ,y 3 ) ∨ T(y 3 ))] Q 2 ∨ [(S 1 (x 1 ,y 1 ) ∨ S 2 (x 1 ,y 1 )) ∧ (S 3 (x 3 ,y 3 ) ∨ T(y 3 ))] Q 3 P(Q W ) = P(Q 1 ) + P(Q 2 ) + P(Q 3 ) + - P(Q 1 ∧ Q 2 ) - P(Q 2 ∧ Q 3 ) – P(Q 1 ∧ Q 3 ) + P(Q 1 ∧ Q 2 ∧ Q 3 ) = H 3 ( #P -hard !) Also = H 3 Need to cancel terms to compute the query in PTIME Using Mobius‟ function on the implication lattice of Q W [Suciu‟11]

  44. The Big Dichotomy Theorem Call Q liftable if the rules don‟t get stuck. Dichotomy Theorem Fix a UCQ query Q. 1. If Q is liftable , then P(Q) is in PTIME 2. If Q is not liftable , then P(Q) is #P -complete [Dalvi‟12]

  45. The Big Dichotomy Theorem Call Q liftable if the rules don‟t get stuck. Dichotomy Theorem Fix a UCQ query Q. 1. If Q is liftable , then P(Q) is in PTIME 2. If Q is not liftable , then P(Q) is #P -complete [Dalvi‟12] Lifted inference rules are complete for UCQ!

  46. Open Problem • For CQs w/o repeated symbols, PTIME Q = FO circuit language • We need inclusion/exclusion to capture PTIME UCQs • I/E is arithmetic operation P(Q1) + P(Q2) - P(Q1 ∨ Q2)

  47. Open Problem • For CQs w/o repeated symbols, PTIME Q = FO circuit language • We need inclusion/exclusion to capture PTIME UCQs • I/E is arithmetic operation P(Q1) + P(Q2) - P(Q1 ∨ Q2) What is the logical equivalent of inclusion-exclusion? What is the circuit language capturing PTIME UCQs?

  48. Open Problem • For CQs w/o repeated symbols, PTIME Q = FO circuit language • We need inclusion/exclusion to capture PTIME UCQs • I/E is arithmetic operation P(Q1) + P(Q2) - P(Q1 ∨ Q2) What is the logical equivalent of inclusion-exclusion? What is the circuit language capturing PTIME UCQs? • It is not decision-DNNF! (see Beame)

  49. Linear Data Complexity Q = ∃ x ∃ y Scientist(x) ∧ Coauthor(x,y) P(Q) = 1 - Π A ∈ Domain (1 - P(Scientist(A) ∧ ∃ y Coauthor(A,y)) = 1 - (1 - P(Scientist(A) ∧ ∃ y Coauthor(A,y)) x (1 - P(Scientist(B) ∧ ∃ y Coauthor(B,y)) x (1 - P(Scientist(C) ∧ ∃ y Coauthor(C,y)) x (1 - P(Scientist(D) ∧ ∃ y Coauthor(D,y)) x (1 - P(Scientist(E) ∧ ∃ y Coauthor(E,y)) x (1 - P(Scientist(F) ∧ ∃ y Coauthor(F,y)) … [Ceylan‟16]

  50. Linear Data Complexity Q = ∃ x ∃ y Scientist(x) ∧ Coauthor(x,y) P(Q) = 1 - Π A ∈ Domain (1 - P(Scientist(A) ∧ ∃ y Coauthor(A,y)) = 1 - (1 - P(Scientist(A) ∧ ∃ y Coauthor(A,y)) x (1 - P(Scientist(B) ∧ ∃ y Coauthor(B,y)) x (1 - P(Scientist(C) ∧ ∃ y Coauthor(C,y)) x (1 - P(Scientist(D) ∧ ∃ y Coauthor(D,y)) No supporting facts x (1 - P(Scientist(E) ∧ ∃ y Coauthor(E,y)) in database! x (1 - P(Scientist(F) ∧ ∃ y Coauthor(F,y)) … [Ceylan‟16]

  51. Linear Data Complexity Q = ∃ x ∃ y Scientist(x) ∧ Coauthor(x,y) P(Q) = 1 - Π A ∈ Domain (1 - P(Scientist(A) ∧ ∃ y Coauthor(A,y)) = 1 - (1 - P(Scientist(A) ∧ ∃ y Coauthor(A,y)) x (1 - P(Scientist(B) ∧ ∃ y Coauthor(B,y)) x (1 - P(Scientist(C) ∧ ∃ y Coauthor(C,y)) x (1 - P(Scientist(D) ∧ ∃ y Coauthor(D,y)) No supporting facts x (1 - P(Scientist(E) ∧ ∃ y Coauthor(E,y)) in database! x (1 - P(Scientist(F) ∧ ∃ y Coauthor(F,y)) … Probability 0 [Ceylan‟16]

  52. Linear Data Complexity Q = ∃ x ∃ y Scientist(x) ∧ Coauthor(x,y) P(Q) = 1 - Π A ∈ Domain (1 - P(Scientist(A) ∧ ∃ y Coauthor(A,y)) = 1 - (1 - P(Scientist(A) ∧ ∃ y Coauthor(A,y)) x (1 - P(Scientist(B) ∧ ∃ y Coauthor(B,y)) x (1 - P(Scientist(C) ∧ ∃ y Coauthor(C,y)) x (1 - P(Scientist(D) ∧ ∃ y Coauthor(D,y)) No supporting facts x (1 - P(Scientist(E) ∧ ∃ y Coauthor(E,y)) in database! x (1 - P(Scientist(F) ∧ ∃ y Coauthor(F,y)) … Probability 0 Ignore these sub-queries! [Ceylan‟16]

  53. Linear Data Complexity Q = ∃ x ∃ y Scientist(x) ∧ Coauthor(x,y) P(Q) = 1 - Π A ∈ Domain (1 - P(Scientist(A) ∧ ∃ y Coauthor(A,y)) = 1 - (1 - P(Scientist(A) ∧ ∃ y Coauthor(A,y)) x (1 - P(Scientist(B) ∧ ∃ y Coauthor(B,y)) x (1 - P(Scientist(C) ∧ ∃ y Coauthor(C,y)) x (1 - P(Scientist(D) ∧ ∃ y Coauthor(D,y)) No supporting facts x (1 - P(Scientist(E) ∧ ∃ y Coauthor(E,y)) in database! x (1 - P(Scientist(F) ∧ ∃ y Coauthor(F,y)) … Probability 0 Ignore these sub-queries! Complexity linear time in database size! [Ceylan‟16]

  54. Commercial Break • Survey book (2017) • Survey book (2011) • IJCAI 2016 tutorial http://web.cs.ucla.edu/~guyvdb/talks/IJCAI16-tutorial/

Recommend


More recommend