Synthesizing Sub-Range Queries on Tree Structures Shubhang Kulkarni - - PowerPoint PPT Presentation

synthesizing sub range queries on tree structures
SMART_READER_LITE
LIVE PREVIEW

Synthesizing Sub-Range Queries on Tree Structures Shubhang Kulkarni - - PowerPoint PPT Presentation

Synthesizing Sub-Range Queries on Tree Structures Shubhang Kulkarni & Pranav Annapindi Sup Context Dont know? Pre- image f L user Input Output (ex : File structure manipulations) Chill. We got you for trees Output = f


slide-1
SLIDE 1

Synthesizing Sub-Range Queries on Tree Structures

Shubhang Kulkarni & Pranav Annapindi

Sup

slide-2
SLIDE 2

Context

  • Chill. We got you for trees

(Us) Input Output Pre- image

f

Output = f (Pre-image) Don’t know? Lé user (ex : File structure manipulations)

slide-3
SLIDE 3

Grades 51 63 74 82 90 95

A A A

Input Output

f1(x)=A f2(x)=B

A Sub-Range

B B B

A Sub-Range

Motivating Example

slide-4
SLIDE 4

Observations

There are two sub-ranges: (0, 3) & (3, 6) Each sub-range has a function that is applied element-wise to it. The “user’s intent” corresponds to a applying a function to contiguous subsets of nodes at some level This could be really useful if the tree on which the example is performed, actually represented a larger system

slide-5
SLIDE 5

We Saw a Gap…

Data Structure Manipulations using PBE PBE Range Manipulations Exist Cannot perform queries on sub-ranges of a level. Must be performed on entire tree/level Cool Ideas. Works for linear structure like strings

Good Ol’ Flashfill!!

Combine ideas for queries on subranges of tree levels!

slide-6
SLIDE 6

A Few Formalizations

Tree T := (N, E, R) NodeTree n := node ∈ N | T (N’, E’, node) s.t. N’ ⊆ N, E’ ⊆ E, node ∈ N A SubRange on a Subtree is a contiguous ordered subset of NodeTrees in the intersection of that subtree and a Level. The aforementioned subtree has the the LCA of the desired range as root. Two NodeTrees are defined to be at the same Level if they are at equal distances from the root node.

Basically a Subtree Restrictive User Pruning! Used interchangeably with Range

slide-7
SLIDE 7

High level idea of Approach

We use all the given examples at once We look at all possible ranges We construct new input-output examples using all the nodes in a range over all examples an use a slightly modified version of the enumerative search algorithm in [1] We return the functions synthesized, the ranges and the range transformation applied

However, a range in one list might not be the same in another. Hence, we look at all equivalent ranges in the various Examples given. This gives us a lot of examples and would make the synthesis un-ambiguous almost always.

With intelligent pruning for feasibility

slide-8
SLIDE 8

Range Transformation

Each index of a list can be viewed in 3 ways:

Number of Elements before it in the list Number of elements after it in the list Fraction of elements before it in the list.

Hence, an index has 3 ‘equivalent’ indices in a new list A range has 2 indices and so generalizes to 9 equivalent ranges

Generalization of indices

slide-9
SLIDE 9

The Input-Output Example Format

Two parts T : The Tree on which the operation is performed. 𝜁 : A list of lists the following form:

[Example 1, Example 2 … Example n] Each Example i is of the form: [SRangeF 1, SRangeF 2 … SRangeF n] Some sub-range in T is mapped to a SRangeF I via application of a function. We want to learn that function and which range.

slide-10
SLIDE 10

Assumption

User orders ranges for each input-output example in the same way

Wordy explanation: Output 1 of example 1 and output 2 of example 2 correspond to equivalent ranges in their corresponding trees. A reasonable assumption

Not too many! We define them in this manner

All the sub-ranges exist on a particular level

slide-11
SLIDE 11

The Procedure

proc(T, 𝜁) SR = { length(e) | e ϵ 𝜁0 } for sRs in SR do for all sub-ranges (p,q) of size sRs do r <- (p,q) progs = {} for {e | e ϵ 𝜁0 and e is of size sRs with index j} do 1: for t in rangeTransformations do for i in range(len(𝜁 )) r’ = t(r, Ti) if len(r’) ≠ len(𝜁i,j) then break exams = exams U (Ti(r), 𝜁i,j) prog <- synthesize(exams) if prog ≠ {⊥} progs = progs U {prog, r, t} break 1

T – Set of all input examples in the form of List of nodes of the level 𝜁 – List of all output examples Level order traversal

Pruning technique: Look at ranges whose size equals the size of an output example All the various sizes of sub-ranges we need to consider All the sub-ranges of a given size for each output example of the same size. There might be many. There are the 9 possible range transformations. For all the other output examples Transform our range to the one pertaining to that example’s input tree If the Sub-range in the other tree could not map to the corresponding output example, we prune!

O(ns) O(ns) O(𝜁) in total! O(1)

𝑃 𝑜&

'𝜁

O(𝜁)

𝑃 𝜁

We assume that the first example has the least number of nodes = ns All the new examples we feed to our sub-synthesizer If we found a valid program, we don’t need to check any more transformations!

Most Probably a small number!

slide-12
SLIDE 12

Summary: Key Contributions

The Synthesis Infer user intended sub-ranges from input-output example Synthesize different programs that are applied to the inferred sub-ranges

  • f a tree.

Generalize the sub-range sizes, if the input-output examples were given

  • n a smaller representative tree

And of course synthesize corresponding program

slide-13
SLIDE 13

Future Work

Build the software Want to see if its practical, and gives our expected performance If Gulwani did it, then so can we! Generalize Multiple Levels, Subset Queries, DAG structures instead of trees Ranking Function Need the software to check which features work better

Better generalization of file system Can only guess relative importance at the moment

slide-14
SLIDE 14

References

[1] FCD15: John K. Feser, Swarat Chaudhuri, Isil Dillig Synthesizing Data Structure Transformations from Input-Output Examples. PLDI 2015. [2] FlashFill (Microsoft Excel 2013 Feature) http://research.microsoft.com/users/sumitg/flashfill.html