• Aucun résultat trouvé

Enumeration on Trees under Relabelings

N/A
N/A
Protected

Academic year: 2022

Partager "Enumeration on Trees under Relabelings"

Copied!
120
0
0

Texte intégral

(1)Enumeration on Trees under Relabelings. Antoine Amarilli1 , Pierre Bourhis2 , Stefan Mengel3 March 27th, 2018 1 Télécom. ParisTech. 2 CNRS. CRIStAL. 3 CNRS. CRIL 1/19.

(2) Problem statement.

(3) Problem: Query evaluation on trees. • Tree on a fixed alphabet • Boolean query to test a property of the tree. 2/19.

(4) Problem: Query evaluation on trees. • Tree on a fixed alphabet • Boolean query to test a property of the tree Example tree <body> <div>. <section> <p>. <h2> <img>. <img>. 2/19.

(5) Problem: Query evaluation on trees. • Tree on a fixed alphabet • Boolean query to test a property of the tree Example query. Example tree <body> <div>. Is there an h2 header and an image that are in the same section?. <section> <p>. <h2> <img>. <img>. 2/19.

(6) Problem: Query evaluation on trees. • Tree on a fixed alphabet • Boolean query to test a property of the tree Example query. Example tree <body> <div>. Is there an h2 header and an image that are in the same section?. <section>. Example answer. <p>. <h2>. →YES <img>. <img>. 2/19.

(7) Problem: Query evaluation on trees. • Tree on a fixed alphabet • Boolean query to test a property of the tree Example query. Example tree <body> <div>. Is there an h2 header and an image that are in the same section?. <section>. Example answer. <p>. <h2>. →YES <img>. <img>. → Theorem: For monadic second-order (MSO) queries, we can check if the query is true or not in linear time in the input tree. 2/19.

(8) Problem: Non-Boolean query evaluation on trees. • Tree on a fixed alphabet • Non-Boolean query to find tuples of nodes satisfying a property. 2/19.

(9) Problem: Non-Boolean query evaluation on trees. • Tree on a fixed alphabet • Non-Boolean query to find tuples of nodes satisfying a property Example tree <body>1 <div>2. <section>3 <h2>4. <p>5 <img>6. <img>7. 2/19.

(10) Problem: Non-Boolean query evaluation on trees. • Tree on a fixed alphabet • Non-Boolean query to find tuples of nodes satisfying a property Example query. Example tree <body>1 <div>2. Find all pairs of an h2 header and an image in the same section. <section>3 <h2>4. <p>5 <img>6. <img>7. 2/19.

(11) Problem: Non-Boolean query evaluation on trees. • Tree on a fixed alphabet • Non-Boolean query to find tuples of nodes satisfying a property Example query. Example tree <body>1 <div>2. Find all pairs of an h2 header and an image in the same section. <section>3 <h2>4. <p>5 <img>6. Example answer  → h4, 6i, h4, 7i. <img>7. 2/19.

(12) Problem: Non-Boolean query evaluation on trees. • Tree on a fixed alphabet • Non-Boolean query to find tuples of nodes satisfying a property Example query. Example tree <body>1 <div>2. Find all pairs of an h2 header and an image in the same section. <section>3 <h2>4. <p>5 <img>6. Example answer  → h4, 6i, h4, 7i. <img>7. → Corollary: For each possible tuple, we can check in linear time if it is an answer to the query. 2/19.

(13) Enumerating all answers → There can be lots of answers! • “Find all pairs of ...”: output size can be O(|T|2 ). 3/19.

(14) Enumerating all answers → There can be lots of answers! • “Find all pairs of ...”: output size can be O(|T|2 ). 3/19.

(15) Enumerating all answers → There can be lots of answers! • “Find all pairs of ...”: output size can be O(|T|2 ). 3/19.

(16) Enumerating all answers → There can be lots of answers! • “Find all pairs of ...”: output size can be O(|T|2 ). 3/19.

(17) Enumerating all answers → There can be lots of answers! • “Find all pairs of ...”: output size can be O(|T|2 ). 3/19.

(18) Enumerating all answers → There can be lots of answers! • “Find all pairs of ...”: output size can be O(|T|2 ). → Solution: Enumerate answers one after the other 3/19.

(19) Enumeration. Tree ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y) Query. 4/19.

(20) Enumeration. Phase 1: Preprocessing Tree ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y) Query. 4/19.

(21) Enumeration. Phase 1: Preprocessing Tree. Indexed tree. ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y) Query. 4/19.

(22) Enumeration. Phase 1: Preprocessing Tree ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y) Query. Indexed tree. Phase 2: Enumeration. 4/19.

(23) Enumeration. Phase 1: Preprocessing Indexed tree. Tree ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y) Query. Phase 2: Enumeration. . h4, 6i, Results 4/19.

(24) Enumeration. Phase 1: Preprocessing Indexed tree. Tree ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y) Query. 0011 State. Phase 2: Enumeration. . h4, 6i, Results 4/19.

(25) Enumeration. Phase 1: Preprocessing Indexed tree. Tree ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y) Query. 0011 State. Phase 2: Enumeration. . h4, 6i, Results 4/19.

(26) Enumeration. Phase 1: Preprocessing Indexed tree. Tree ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y) Query. ⊥ State. Phase 2: Enumeration. . h4, 6i, h4, 7i Results 4/19.

(27) Enumeration. Phase 1: Preprocessing Indexed tree. Tree ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y) Query. ⊥ State. Theorem (Bagan’06; Kazana & Segoufin’13) We can enumerate the answers of any MSO query with preprocessing linear in the input tree and constant delay between each answer. Phase 2: Enumeration. . h4, 6i, h4, 7i Results 4/19.

(28) Handling updates. Phase 1: Preprocessing Tree T. Indexed tree. • Trees are often updated, even after we have preprocessed them. 5/19.

(29) Handling updates. Phase 1: Preprocessing Tree T. Indexed tree. • Trees are often updated, even after we have preprocessed them. 5/19.

(30) Handling updates. Phase 1: Preprocessing Tree T. Indexed tree. • Trees are often updated, even after we have preprocessed them. 5/19.

(31) Handling updates. Phase 1: Preprocessing Indexed tree. Tree T. • Trees are often updated, even after we have preprocessed them Work. Data. Delay. Updates. [Bagan, 2006],. trees. O(1). O(T) (from scratch). [Kazana and Segoufin, 2013]. 5/19.

(32) Handling updates. Phase 1: Preprocessing Indexed tree. Tree T. • Trees are often updated, even after we have preprocessed them Work. Data. Delay. Updates. [Bagan, 2006],. trees. O(1). O(T) (from scratch). trees. O(log2 T) O(log2 T). [Kazana and Segoufin, 2013] [Losemann and Martens, 2014]. 5/19.

(33) Handling updates. Phase 1: Preprocessing Indexed tree. Tree T. • Trees are often updated, even after we have preprocessed them Work. Data. Delay. Updates. [Bagan, 2006],. trees. O(1). O(T) (from scratch). [Kazana and Segoufin, 2013] [Losemann and Martens, 2014] [Losemann and Martens, 2014]. trees O(log2 T) O(log2 T) words O(log T) O(log T) 5/19.

(34) Handling updates. Phase 1: Preprocessing Indexed tree. Tree T. • Trees are often updated, even after we have preprocessed them Work. Data. Delay. Updates. [Bagan, 2006],. trees. O(1). O(T) (from scratch). [Kazana and Segoufin, 2013] [Losemann and Martens, 2014] [Losemann and Martens, 2014] [Niewerth and Segoufin, 2018]. trees O(log2 T) O(log2 T) words O(log T) O(log T) words O(1) O(log T) 5/19.

(35) Relabelings. • We focus on relabeling updates: change the label of a node. 6/19.

(36) Relabelings. • We focus on relabeling updates: change the label of a node. • Example: relabel node 7 to <video>. 6/19.

(37) Relabelings. • We focus on relabeling updates: change the label of a node. • Example: relabel node 7 to <video>. 6/19.

(38) Relabelings. • We focus on relabeling updates: change the label of a node. • Example: relabel node 7 to <video> • The tree’s structure never changes. 6/19.

(39) What are relabelings good for?. • Parameterized queries:. • Example: “Find all images in a user-selected section”. <body>1 <div>2. <section>3 <h2>4. <p>5 <img>6 <img>7. 7/19.

(40) What are relabelings good for?. • Parameterized queries:. • Example: “Find all images in a user-selected section” → Write down the user parameters as labels on the tree. <body>1 <div>2. <section>3 <h2>4. <p>5 <img>6 <img>7. 7/19.

(41) What are relabelings good for?. • Parameterized queries:. • Example: “Find all images in a user-selected section” → Write down the user parameters as labels on the tree → Relabel when they change. <body>1 <div>2. <section>3 <h2>4. <p>5 <img>6 <img>7. 7/19.

(42) What are relabelings good for?. • Parameterized queries:. • Example: “Find all images in a user-selected section” → Write down the user parameters as labels on the tree → Relabel when they change. • Group-by with aggregation:. • Example: “For each section, what is the total size of images”. <body>1 <div>2. <section>3 <h2>4. <p>5 <img>6 <img>7. 7/19.

(43) What are relabelings good for?. • Parameterized queries:. • Example: “Find all images in a user-selected section” → Write down the user parameters as labels on the tree → Relabel when they change. • Group-by with aggregation:. • Example: “For each section, what is the total size of images” → Enumerate the groups and write down each group. <body>1 <div>2. <section>3 <h2>4. <p>5 <img>6 <img>7. 7/19.

(44) What are relabelings good for?. • Parameterized queries:. • Example: “Find all images in a user-selected section” → Write down the user parameters as labels on the tree → Relabel when they change. • Group-by with aggregation:. • Example: “For each section, what is the total size of images” → Enumerate the groups and write down each group → Relabel when switching groups. <body>1 <div>2. <section>3 <h2>4. <p>5 <img>6 <img>7. 7/19.

(45) Main result Theorem (Main result) We can enumerate the answers of any MSO query with preprocessing linear in the input tree T and constant delay between each answer and we can relabel any node and update the index in time O(log T). 8/19.

(46) Main result Theorem (Main result) We can enumerate the answers of any MSO query with preprocessing linear in the input tree T and constant delay between each answer and we can relabel any node and update the index in time O(log T) Work. Data. Delay. Updates. [Bagan, 2006],. trees. O(1). N/A. [Kazana and Segoufin, 2013] [Losemann and Martens, 2014] [Losemann and Martens, 2014] [Niewerth and Segoufin, 2018]. trees O(log2 T) O(log2 T) words O(log T) O(log T) words O(1) O(log T). 8/19.

(47) Main result Theorem (Main result) We can enumerate the answers of any MSO query with preprocessing linear in the input tree T and constant delay between each answer and we can relabel any node and update the index in time O(log T) Work. Data. Delay. Updates. [Bagan, 2006],. trees. O(1). N/A. trees words words trees. O(log2 T) O(log T) O(1) O(1). O(log2 T) O(log T) O(log T) O(log T) (relabelings). [Kazana and Segoufin, 2013] [Losemann and Martens, 2014] [Losemann and Martens, 2014] [Niewerth and Segoufin, 2018] [This work]. 8/19.

(48) Main result Theorem (Main result) We can enumerate the answers of any MSO query with preprocessing linear in the input tree T and constant delay between each answer and we can relabel any node and update the index in time O(log T) Work. Data. Delay. Updates. [Bagan, 2006],. trees. O(1). N/A. trees words words trees. O(log2 T) O(log T) O(1) O(1). O(log2 T) O(log T) O(log T) O(log T) (relabelings). [Kazana and Segoufin, 2013] [Losemann and Martens, 2014] [Losemann and Martens, 2014] [Niewerth and Segoufin, 2018] [This work]. → Consequences for group-by, aggregation, parameterized queries. 8/19.

(49) Proof techniques.

(50) Knowledge compilation To make the proof modular, we follow knowledge compilation:. Tree. Phase 1: Preprocessing Indexed tree. Phase 2: Enumeration.  hx : 4, y : 6i, hx : 4, y : 7i. Results. ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y). Query. 9/19.

(51) Knowledge compilation To make the proof modular, we follow knowledge compilation:. • Preprocessing: Compute a circuit representation of the answers • Enumeration: Apply a generic algorithm on the circuit ×. Phase 1: Preprocessing Tree. x:4. ∪ y:6. y:7. Circuit. Phase 2: Enumeration.  hx : 4, y : 6i, hx : 4, y : 7i. Results. ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y). Query. 9/19.

(52) Knowledge compilation To make the proof modular, we follow knowledge compilation:. • Preprocessing: Compute a circuit representation of the answers • Enumeration: Apply a generic algorithm on the circuit ×. Phase 1: Preprocessing Tree. x:4. ∪ y:6. y:7. Circuit. Phase 2: Enumeration.  hx : 4, y : 6i, hx : 4, y : 7i. Results. ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y). Query First present approach without relabelings (as in our ICALP’17 paper) then extend the approach to support relabelings 9/19.

(53) Set circuits A set circuit represents a set of answers to a query Q(x, y). 10/19.

(54) Set circuits A set circuit represents a set of answers to a query Q(x, y). • Singleton x : 6 → “the free variable x is mapped to node 6”. 10/19.

(55) Set circuits A set circuit represents a set of answers to a query Q(x, y). • Singleton x : 6 → “the free variable x is mapped to node 6” • Tuple hx : 4, y : 6i: tuple of singletons. 10/19.

(56) Set circuits A set circuit represents a set of answers to a query Q(x, y). • Singleton x : 6 → “the free variable x is mapped to node 6” • Tuple hx : 4, y : 6i: tuple of singletons  • The circuit captures a set of tuples, e.g., hx : 4, y : 6i, hx : 4, y : 7i. 10/19.

(57) Set circuits A set circuit represents a set of answers to a query Q(x, y). • Singleton x : 6 → “the free variable x is mapped to node 6” • Tuple hx : 4, y : 6i: tuple of singletons  • The circuit captures a set of tuples, e.g., hx : 4, y : 6i, hx : 4, y : 7i Three kinds of set-valued gates: ×. x:4. ∪. y:6. y:7 10/19.

(58) Set circuits A set circuit represents a set of answers to a query Q(x, y). • Singleton x : 6 → “the free variable x is mapped to node 6” • Tuple hx : 4, y : 6i: tuple of singletons  • The circuit captures a set of tuples, e.g., hx : 4, y : 6i, hx : 4, y : 7i Three kinds of set-valued gates:. • Variable gate. ×. x:4. :.  → captures hx : 4i. x:4. ∪. y:6. y:7 10/19.

(59) Set circuits A set circuit represents a set of answers to a query Q(x, y). • Singleton x : 6 → “the free variable x is mapped to node 6” • Tuple hx : 4, y : 6i: tuple of singletons  • The circuit captures a set of tuples, e.g., hx : 4, y : 6i, hx : 4, y : 7i Three kinds of set-valued gates:. • Variable gate. ×. x:4. :.  → captures hx : 4i. x:4. • Union gate. ∪. ∪. :. → union of sets of tuples. y:6. y:7 10/19.

(60) Set circuits A set circuit represents a set of answers to a query Q(x, y). • Singleton x : 6 → “the free variable x is mapped to node 6” • Tuple hx : 4, y : 6i: tuple of singletons  • The circuit captures a set of tuples, e.g., hx : 4, y : 6i, hx : 4, y : 7i Three kinds of set-valued gates:. • Variable gate. ×. :. x:4.  → captures hx : 4i. x:4. • Union gate. ∪. :. ∪. → union of sets of tuples. y:6. y:7. • Product gate. ×. :. → relational product 10/19.

(61) Set circuits A set circuit represents a set of answers to a query Q(x, y). • Singleton x : 6 → “the free variable x is mapped to node 6” • Tuple hx : 4, y : 6i: tuple of singletons  • The circuit captures a set of tuples, e.g., hx : 4, y : 6i, hx : 4, y : 7i Three kinds of set-valued gates:. • Variable gate. ×. :. x:4.  → captures hx : 4i. x:4. • Union gate. ∪. → union of sets of tuples.  hy : 6i y:6. :. ∪. y:7. • Product gate. ×. :. → relational product 10/19.

(62) Set circuits A set circuit represents a set of answers to a query Q(x, y). • Singleton x : 6 → “the free variable x is mapped to node 6” • Tuple hx : 4, y : 6i: tuple of singletons  • The circuit captures a set of tuples, e.g., hx : 4, y : 6i, hx : 4, y : 7i Three kinds of set-valued gates:. • Variable gate. ×. :. x:4.  → captures hx : 4i. x:4. • Union gate. ∪.  hy : 6i y:6. . hy : 7i. y:7. :. ∪. → union of sets of tuples. • Product gate. ×. :. → relational product 10/19.

(63) Set circuits A set circuit represents a set of answers to a query Q(x, y). • Singleton x : 6 → “the free variable x is mapped to node 6” • Tuple hx : 4, y : 6i: tuple of singletons  • The circuit captures a set of tuples, e.g., hx : 4, y : 6i, hx : 4, y : 7i Three kinds of set-valued gates: ×  x:4. hy : 6i, hy : 7i. y:6. . hy : 7i. y:7. :. x:4.  → captures hx : 4i. • Union gate. ∪.  hy : 6i. • Variable gate. :. ∪. → union of sets of tuples. • Product gate. ×. :. → relational product 10/19.

(64) Set circuits A set circuit represents a set of answers to a query Q(x, y). • Singleton x : 6 → “the free variable x is mapped to node 6” • Tuple hx : 4, y : 6i: tuple of singletons  • The circuit captures a set of tuples, e.g., hx : 4, y : 6i, hx : 4, y : 7i Three kinds of set-valued gates: × . . hx : 4i x:4. hy : 6i, hy : 7i. y:6. . hy : 7i. y:7. :. x:4.  → captures hx : 4i. • Union gate. ∪.  hy : 6i. • Variable gate. :. ∪. → union of sets of tuples. • Product gate. ×. :. → relational product 10/19.

(65) Set circuits A set circuit represents a set of answers to a query Q(x, y). • Singleton x : 6 → “the free variable x is mapped to node 6” • Tuple hx : 4, y : 6i: tuple of singletons  • The circuit captures a set of tuples, e.g., hx : 4, y : 6i, hx : 4, y : 7i  × . . hx : 4i x:4. Three kinds of set-valued gates:. hx : 4, y : 6i hx : 4, y : 7i hy : 6i, hy : 7i. y:6. . hy : 7i. y:7. :. x:4.  → captures hx : 4i. • Union gate. ∪.  hy : 6i. • Variable gate. :. ∪. → union of sets of tuples. • Product gate. ×. :. → relational product 10/19.

(66) Preprocessing: Set circuit construction ×. Phase 1: Preprocessing Tree. x:4. ∪ y:6. y:7. Circuit. Phase 2: Enumeration. . hx : 4, y : 6i, hx : 4, y : 7i. Results. ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y). Query Theorem For any MSO query Q(x1 , . . . , xk ), given a tree T, we can build in O(T) a set circuit capturing exactly the set of answers of Q on T: {hx1 : n1 , . . . , xk : nk i | (n1 , . . . , nk ) ∈ T k }. 11/19.

(67) Preprocessing: Set circuit construction ×. Phase 1: Preprocessing Tree. x:4. ∪ y:6. y:7. Circuit. Phase 2: Enumeration. . hx : 4, y : 6i, hx : 4, y : 7i. Results. ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y). Query Theorem For any MSO query Q(x1 , . . . , xk ), given a tree T, we can build in O(T) a set circuit capturing exactly the set of answers of Q on T: {hx1 : n1 , . . . , xk : nk i | (n1 , . . . , nk ) ∈ T k }. • Proof idea: Translate query to bottom-up tree automaton. and build a provenance circuit following the structure of the tree 11/19.

(68) Enumeration on set circuits ×. Phase 1: Preprocessing Tree. x:4. ∪ y:6. y:7. Circuit. Phase 2: Enumeration. . hx : 4, y : 6i, hx : 4, y : 7i. Results. ∃s section(s)∧ s x∧s y∧ h2(x) ∧ img(y). Query. Theorem Given a set circuit satisfying some conditions, we can enumerate all tuples that it captures with linear preprocessing and constant delay  E.g., for hx : 4, y : 6i, hx : 4, y : 7i : enumerate hx : 4, y : 6i, then hx : 4, y : 7i 12/19.

(69) General enumeration approach → Enumerate the set T(g) captured by each gate g → Do it by top-down induction on the circuit. 13/19.

(70) General enumeration approach → Enumerate the set T(g) captured by each gate g → Do it by top-down induction on the circuit Base case: variable. x:n. :. 13/19.

(71) General enumeration approach → Enumerate the set T(g) captured by each gate g → Do it by top-down induction on the circuit Base case: variable. x:n. : enumerate hx : ni and stop. 13/19.

(72) General enumeration approach → Enumerate the set T(g) captured by each gate g → Do it by top-down induction on the circuit Base case: variable. x:n. : enumerate hx : ni and stop. ∪-gate ∪ g1. g2. Concatenation: enumerate T(g1 ) and then enumerate T(g2 ). 13/19.

(73) General enumeration approach → Enumerate the set T(g) captured by each gate g → Do it by top-down induction on the circuit Base case: variable. g1. x:n. : enumerate hx : ni and stop. ∪-gate. ×-gate. ∪. × g2. Concatenation: enumerate T(g1 ) and then enumerate T(g2 ). g1. g2. Lexicographic product: for every t1 in T(g1 ): for every t2 in T(g2 ): output t1 + t2 13/19.

(74) Circuit conditions Enumeration relies on some conditions on the input circuit (d-DNNF):. ×. x:4. ∪. y:6. y:7. 14/19.

(75) Circuit conditions Enumeration relies on some conditions on the input circuit (d-DNNF):. •. ∪. are all deterministic:. For any two inputs g1 and g2 of a ∪-gate, the captured sets T(g1 ) and T(g2 ) are disjoint (they have no tuple in common) → Avoids duplicate tuples. ×. x:4. ∪. y:6. y:7. 14/19.

(76) Circuit conditions Enumeration relies on some conditions on the input circuit (d-DNNF):. •. ∪. are all deterministic:. For any two inputs g1 and g2 of a ∪-gate, the captured sets T(g1 ) and T(g2 ) are disjoint (they have no tuple in common) → Avoids duplicate tuples. •. ×. ×. x:4. ∪. are all decomposable:. For any two inputs g1 and g2 of a ×-gate, no variable has a path to both g1 and g2. y:6. y:7. → Avoids duplicate singletons 14/19.

(77) Circuit conditions Enumeration relies on some conditions on the input circuit (d-DNNF):. •. ∪. are all deterministic:. For any two inputs g1 and g2 of a ∪-gate, the captured sets T(g1 ) and T(g2 ) are disjoint (they have no tuple in common) → Avoids duplicate tuples. •. ×. ×. x:4. ∪. are all decomposable:. For any two inputs g1 and g2 of a ×-gate, no variable has a path to both g1 and g2. y:6. y:7. → Avoids duplicate singletons. • Also an additional upwards-determinism condition. 14/19.

(78) Enumeration subtleties. ∪ y:6. × x:4. ∪. • We must not waste time in gates capturing ∅. 15/19.

(79) Enumeration subtleties. ∪ y:6. × x:4. ∪. • We must not waste time in gates capturing ∅ → Label them during the preprocessing. 15/19.

(80) Enumeration subtleties × ×. ∪ y:6. × x:4. ∪. × ×. × ×. x:4. • We must not waste time in gates capturing ∅ → Label them during the preprocessing. • We must not waste time because of gates capturing. . hi. 15/19.

(81) Enumeration subtleties × ×. ∪ y:6. × x:4. ∪. × ×. × ×. x:4. • We must not waste time in gates capturing ∅ → Label them during the preprocessing. • We must not waste time because of gates capturing. . hi. → Homogenization to set them aside. 15/19.

(82) Enumeration subtleties × ×. ∪ y:6. × x:4. ∪. ∪ ×. ×. ∪ ×. ×. ··· x:4. ∪ ∪. ···. ∪ ··· ···. • We must not waste time in gates capturing ∅ → Label them during the preprocessing. • We must not waste time because of gates capturing. . hi. → Homogenization to set them aside. • We must not waste time in hierarchies of ∪-gates 15/19.

(83) Enumeration subtleties × ×. ∪ y:6. × x:4. ∪. ∪ ×. ×. ∪ ×. ×. ··· x:4. ∪ ∪. ···. ∪ ··· ···. • We must not waste time in gates capturing ∅ → Label them during the preprocessing. • We must not waste time because of gates capturing. . hi. → Homogenization to set them aside. • We must not waste time in hierarchies of ∪-gates. → Precompute a reachability index (uses upwards-determinism) 15/19.

(84) Hybrid circuits to support relabelings To support relabelings, we use hybrid circuits that have:. • •. Boolean gates that depend only on the labeling Set gates that capture a set of tuples for each labeling.  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i. img : 7. hy : 7i 16/19.

(85) Hybrid circuits to support relabelings To support relabelings, we use hybrid circuits that have:. • •. Boolean gates that depend only on the labeling Set gates that capture a set of tuples for each labeling Four kinds of Boolean gates:  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i. img : 7. hy : 7i 16/19.

(86) Hybrid circuits to support relabelings To support relabelings, we use hybrid circuits that have:. • •. Boolean gates that depend only on the labeling Set gates that capture a set of tuples for each labeling Four kinds of Boolean gates:. • Variable gate. . → true iff node 4 is labeled h2. ×. h2 : 4. hx : 4i. ∪  img : 6. h2 : 4 :.  hy : 6i. img : 7. hy : 7i 16/19.

(87) Hybrid circuits to support relabelings To support relabelings, we use hybrid circuits that have:. • •. Boolean gates that depend only on the labeling Set gates that capture a set of tuples for each labeling Four kinds of Boolean gates: . h2 : 4 :. • AND, OR, NOT. ∧. → true iff node 4 is labeled h2. ×. h2 : 4. ∨. ¬. :. → usual semantics. hx : 4i. ∪  img : 6. • Variable gate.  hy : 6i. img : 7. hy : 7i 16/19.

(88) Hybrid circuits to support relabelings To support relabelings, we use hybrid circuits that have:. • •. Boolean gates that depend only on the labeling Set gates that capture a set of tuples for each labeling Four kinds of Boolean gates:  ×. • AND, OR, NOT. ∧. ∨. :. ¬. → usual semantics. hx : 4i One new set-valued gate:. ∪ . •.  hy : 6i. h2 : 4 :. → true iff node 4 is labeled h2. h2 : 4. img : 6. • Variable gate. img : 7. hy : 7i. . : Test gate. → ∅ if Boolean input is false → like the set input otherwise 16/19.

(89) Hybrid circuit semantics. • For every labeling, the hybrid circuit captures a set of tuples.  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i. img : 7. hy : 7i 17/19.

(90) Hybrid circuit semantics labeling, the hybrid circuit captures a set of tuples • For→ every  Here, the captured set is hx : 4, y : 6i, hx : 4, y : 7i.  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i. img : 7. hy : 7i 17/19.

(91) Hybrid circuit semantics labeling, the hybrid circuit captures a set of tuples • For→ every  Here, the captured set is hx : 4, y : 6i, hx : 4, y : 7i.  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i hy : 6i.  img : 7. hy : 7i 17/19.

(92) Hybrid circuit semantics labeling, the hybrid circuit captures a set of tuples • For→ every  Here, the captured set is hx : 4, y : 6i, hx : 4, y : 7i.  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i hy : 6i.  img : 7.  hy : 7i hy : 7i 17/19.

(93) Hybrid circuit semantics labeling, the hybrid circuit captures a set of tuples • For→ every  Here, the captured set is hx : 4, y : 6i, hx : 4, y : 7i.  ×. h2 : 4 . hy : 6i, hy : 7i . img : 6. hx : 4i. ∪.  hy : 6i hy : 6i.  img : 7.  hy : 7i hy : 7i 17/19.

(94) Hybrid circuit semantics labeling, the hybrid circuit captures a set of tuples • For→ every  Here, the captured set is hx : 4, y : 6i, hx : 4, y : 7i.  . ×. h2 : 4 . hy : 6i, hy : 7i . img : 6. hx : 4, y : 6i, hx : 4, y : 7i. hx : 4i. ∪.  hy : 6i hy : 6i.  img : 7.  hy : 7i hy : 7i 17/19.

(95) Hybrid circuit semantics labeling, the hybrid circuit captures a set of tuples • For→ every  Here, the captured set is hx : 4, y : 6i, hx : 4, y : 7i • When the tree is relabeled, change the Boolean variables.  . ×. h2 : 4 . hy : 6i, hy : 7i . img : 6. hx : 4, y : 6i, hx : 4, y : 7i. hx : 4i. ∪.  hy : 6i hy : 6i.  img : 7.  hy : 7i hy : 7i 17/19.

(96) Hybrid circuit semantics labeling, the hybrid circuit captures a set of tuples • For→ every  Here, the captured set is hx : 4, y : 6i, hx : 4, y : 7i • When the tree is relabeled, change the Boolean variables.  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i. img : 7. hy : 7i 17/19.

(97) Hybrid circuit semantics labeling, the hybrid circuit captures a set of tuples • For→ every  Here, the captured set is hx : 4, y : 6i, hx : 4, y : 7i • When the tree is relabeled, change the Boolean variables.  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i hy : 6i.  img : 7. hy : 7i 17/19.

(98) Hybrid circuit semantics labeling, the hybrid circuit captures a set of tuples • For→ every  Here, the captured set is hx : 4, y : 6i, hx : 4, y : 7i • When the tree is relabeled, change the Boolean variables.  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i hy : 6i.  img : 7. ∅ hy : 7i 17/19.

(99) Hybrid circuit semantics labeling, the hybrid circuit captures a set of tuples • For→ every  Here, the captured set is hx : 4, y : 6i, hx : 4, y : 7i • When the tree is relabeled, change the Boolean variables.  ×. h2 : 4 . hy : 6i . img : 6. hx : 4i. ∪  hy : 6i. hy : 6i.  img : 7. ∅ hy : 7i 17/19.

(100) Hybrid circuit semantics labeling, the hybrid circuit captures a set of tuples • For→ every  Here, the captured set is hx : 4, y : 6i, hx : 4, y : 7i the tree is relabeled, change the Boolean variables • When  → New captured set: hx : 4, y : 6i. . . ×. h2 : 4 . hy : 6i . img : 6. hx : 4, y : 6i. hx : 4i. ∪  hy : 6i. hy : 6i.  img : 7. ∅ hy : 7i 17/19.

(101) Complexity of relabelings. • When a label changes, update the circuit bottom-up.  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i. img : 7. hy : 7i 18/19.

(102) Complexity of relabelings. • When a label changes, update the circuit bottom-up.  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i. img : 7. hy : 7i 18/19.

(103) Complexity of relabelings. • When a label changes, update the circuit bottom-up.  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i. img : 7. hy : 7i 18/19.

(104) Complexity of relabelings. • When a label changes, update the circuit bottom-up • The circuit follows the structure of the input tree T so updates are in O(height(T)).  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i. img : 7. hy : 7i 18/19.

(105) Complexity of relabelings. • When a label changes, update the circuit bottom-up • The circuit follows the structure of the input tree T. so updates are in O(height(T)) → Balancing lemma: Rewrite the input tree to make it balanced.  ×. h2 : 4. hx : 4i. ∪  img : 6.  hy : 6i. img : 7. hy : 7i 18/19.

(106) Conclusion.

(107) Summary and future work Summary:. • Problem: enumerate the answers of an MSO query on a tree with efficient support for relabeling updates on the tree. 19/19.

(108) Summary and future work Summary:. • Problem: enumerate the answers of an MSO query on a tree with efficient support for relabeling updates on the tree. • Main result: we can do this with linear preprocessing,. constant delay between each answer, and log update time. 19/19.

(109) Summary and future work Summary:. • Problem: enumerate the answers of an MSO query on a tree with efficient support for relabeling updates on the tree. • Main result: we can do this with linear preprocessing,. constant delay between each answer, and log update time. • Consequences: group-by, parameterized queries, aggregation. 19/19.

(110) Summary and future work Summary:. • Problem: enumerate the answers of an MSO query on a tree with efficient support for relabeling updates on the tree. • Main result: we can do this with linear preprocessing,. constant delay between each answer, and log update time. • Consequences: group-by, parameterized queries, aggregation Future work:. • Practice: implement the technique with automata • Applications: text extraction? e.g., document spanners (ongoing) • Updates: support insertions/deletions? (ongoing) 19/19.

(111) Summary and future work Summary:. • Problem: enumerate the answers of an MSO query on a tree with efficient support for relabeling updates on the tree. • Main result: we can do this with linear preprocessing,. constant delay between each answer, and log update time. • Consequences: group-by, parameterized queries, aggregation Future work:. • Practice: implement the technique with automata • Applications: text extraction? e.g., document spanners (ongoing) • Updates: support insertions/deletions? (ongoing) Thanks for your attention! 19/19.

(112) References i. Bagan, G. (2006). MSO queries on tree decomposable structures are computable with linear delay. In CSL. Kazana, W. and Segoufin, L. (2013). Enumeration of monadic second-order queries on trees. TOCL, 14(4). Losemann, K. and Martens, W. (2014). MSO queries on trees: enumerating answers under updates. In CSL-LICS..

(113) References ii. Niewerth, M. and Segoufin, L. (2018). Enumeration of MSO queries on strings with constant delay and logarithmic updates. In PODS. To appear..

(114) Set circuit construction. • Automaton: “Select all node pairs (x, y)”. • States: {∅, x, y, xy}.

(115) Set circuit construction. • Automaton: “Select all node pairs (x, y)” n. • States: {∅, x, y, xy}.

(116) Set circuit construction. • Automaton: “Select all node pairs (x, y)”. • States: {∅, x, y, xy}. n. x:n.

(117) Set circuit construction. • Automaton: “Select all node pairs (x, y)” n. • States: {∅, x, y, xy}. ∅. x. y. xy. ∪. ∪. ∪. ∪. x:n ∅. x. y. xy. ∅. x. y. xy. ∪. ∪. ∪. ∪. ∪. ∪. ∪. ∪.

(118) Set circuit construction. • Automaton: “Select all node pairs (x, y)” n. • States: {∅, x, y, xy}. ∅. x. y. xy. ∪. ∪. ∪. ∪. ×. x:n. ∅. x. y. xy. ∅. x. y. xy. ∪. ∪. ∪. ∪. ∪. ∪. ∪. ∪.

(119) Set circuit construction. • Automaton: “Select all node pairs (x, y)” n. • States: {∅, x, y, xy}. ∅. x. y. xy. ∪. ∪. ∪. ∪. ×. x:n. ∅. x. y. xy. ∅. x. y. xy. ∪. ∪. ∪. ∪. ∪. ∪. ∪. ∪.

(120) Set circuit construction. • Automaton: “Select all node pairs (x, y)” n. • States: {∅, x, y, xy}. ∅. x. y. xy. ∪. ∪. ∪. ∪ ×. ×. x:n. ∅. x. y. xy. ∅. x. y. xy. ∪. ∪. ∪. ∪. ∪. ∪. ∪. ∪.

(121)

Références

Documents relatifs

The lotus flower and animals may also disappear from the Bagan murals, being replaced by further floral motifs of Chinese inspiration (see below) whereas the

On strings, unary MSO queries can be enumerated using linear preprocessing time, constant delay and logarithmic time for updates that relabel, insert, or remove a single position..

With a regular expression that “scores” each solution, we can enumerate in score order with linear preprocessing and logarithmic delay..

Our approach is grounded on the linking of two recently proposed infinite-dimensional techniques: a Complete-Type Lyapunov functional, which enables state delay systems

We propose a novel way to analyze the stability of sampled-data systems with discrete-time constant input delay by, first, reformulating the system into an aperiodic discrete-

Removal of the vertex 0 in trees enumerated by Theorem 1.1 gives enu- merative results for planted forests with µ 0 +1 connected components (induc- ing an error of 1 in the degree

Multisample delays: large delays and packet dropouts In this subsection, we extend the robustness problem for- mulation for a different class of dynamical systems, that is to

To establish the spectrum determined growth condition, we show that system (1.4) is a Riesz system in that sense that: the multiplicities of all eigenvalues are uniformly bounded