Synthesizing Number Transformations from Input-Output Examples
description
Transcript of Synthesizing Number Transformations from Input-Output Examples
![Page 1: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/1.jpg)
Synthesizing Number Transformations from
Input-Output Examples Rishabh Singh and Sumit Gulwani
![Page 2: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/2.jpg)
Number• One of the most commonly used data
type
• Number Formatting– Every language has its own format #.00? (C#, Excel), 05.2f (Python, C)– End-users
![Page 3: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/3.jpg)
Help-forums
![Page 4: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/4.jpg)
Help-forums
![Page 5: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/5.jpg)
Excel Help-forums
![Page 6: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/6.jpg)
Excel Help-forums
upper 45 or 95
![Page 7: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/7.jpg)
Observations from Help-forums
• Input-Output Examples – Specification mechanism
• Additional inputs for removing ambiguity
Excel add-in with same interface
![Page 8: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/8.jpg)
Talk Outline1. Number Transformation Language
2. Synthesis Algorithm
3. String & Number Language Combination
4. Synthesis Algorithm for Combination
5. Experiments
![Page 9: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/9.jpg)
Generic Framework• Expression Language L
– Expressive and succinct
• Efficient Data structures for set of expressions– Version-space algebra
• GenerateStr – All sets of expressions from I-O example
• Intersect– Intersect two sets of expressions
![Page 10: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/10.jpg)
Number Transformations
![Page 11: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/11.jpg)
Number Transformation Language
![Page 12: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/12.jpg)
Number Transformation Language
![Page 13: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/13.jpg)
Number Transformation Language
![Page 14: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/14.jpg)
Format String
• : minimum number of significant digits
• : maximum number of significant digits
• : number of whitespaces at end
![Page 15: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/15.jpg)
Number Format
123.4567
123.46
123.4 123.40
(𝛼=2 , 𝛽=2,𝛾=0).NET :
Exactly 2 decimal places
![Page 16: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/16.jpg)
Semantics
(𝛼=2 , 𝛽=2,𝛾=0)Exactly 2 decimal places
24.589 24.59
24.2 24.20
![Page 17: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/17.jpg)
GenerateStr• Interval domains for
123.4567
123.46
(~𝛼=[0,2] ,~𝛽=[2,2] ,~𝛾=[0,2])
123.4 123.40
(~𝛼=[2,2] ,~𝛽=[2 ,∞ ] ,~𝛾=[0,0])
invariant
![Page 18: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/18.jpg)
Intersect
(~𝛼=[0,2] ,~𝛽=[2,2] ,~𝛾=[0,2])
(~𝛼=[2,2] ,~𝛽=[2 ,∞ ] ,~𝛾=[0,0])
∧
(~𝛼=[2,2] ,~𝛽=[2,2 ] ,~𝛾=[0,0])
![Page 19: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/19.jpg)
Extension to Integer parts12.4567 012.46
123.4 123.40
Dec(u) ( Int(u), Frac(u))
GenerateStr(Frac(u1), Frac(u2))
GenerateStr(Int(u1)R, Int(u2)R)
![Page 20: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/20.jpg)
Rounding Numbers
• zero of interval
• size of interval
• nearest, upper, lower
𝛿
𝑥
![Page 21: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/21.jpg)
Round Format
11 45
46 95
(𝑧=45 ,𝛿=50 ,𝑚=↑)=Min(Roundup(A1/45, 0)*45, Roundup(A1/95,0)*95)
Round off to upper 45
![Page 22: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/22.jpg)
GenerateStr
Not enough info. to learn precise
![Page 23: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/23.jpg)
Intersect• Intersect((n1,n’1),(n2,n’2))
![Page 24: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/24.jpg)
Intersect• Intersect((31,45),(86,95))
![Page 25: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/25.jpg)
Intersect• Intersect((31,45),(86,95))
![Page 26: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/26.jpg)
Intersect• Intersect((31,45),(86,95))
![Page 27: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/27.jpg)
Intersect• Intersect((31,45),(86,95))
![Page 28: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/28.jpg)
Intersect• Intersect((31,45),(86,95))
![Page 29: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/29.jpg)
Intersect• Intersect((31,45),(86,95))
![Page 30: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/30.jpg)
GenerateStr
𝛿∈𝐷𝑖𝑣𝑖𝑠𝑜𝑟𝑠 (1,000 ,000 )
Only need to maintain greatest value
![Page 31: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/31.jpg)
Intersect𝛿1∈𝐷𝑖𝑣𝑖𝑠𝑜𝑟𝑠 (𝑘1 )
𝛿2∈𝐷𝑖𝑣𝑖𝑠𝑜𝑟𝑠 (𝑘2)∧
𝛿∈𝐷𝑖𝑣𝑖𝑠𝑜𝑟𝑠¿
![Page 32: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/32.jpg)
Combining String and Number Transformations
![Page 33: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/33.jpg)
String Language [GulwaniPOPL11]
![Page 34: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/34.jpg)
Combined Language
![Page 35: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/35.jpg)
Combination Examples
![Page 36: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/36.jpg)
Synthesis Algorithm
2004.07.08
7/8/2004
1)(-5, -4)2)(-5, dot -1)3)(-5, dot 2)4)(-5, 7)5)(6, -4)6)….
Program P1 to extract 7 in input (P1, 7 ->
7)
![Page 37: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/37.jpg)
Synthesis Algorithm
2004.07.08
7/8/2004
(P1, 7 -> 7)
Program P2 to extract 07 in input1)(dot 1, dot 2)
2)(dot 1, dot -1)3)(-6, -4)4)(-6, dot -1)5)(-6, dot 2)6)….
(P2, 07 -> 7)
![Page 38: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/38.jpg)
GenerateStr
2004.07.08
7/8/2004(P1, 7 -> 7)(P2, 07 -> 7)
![Page 39: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/39.jpg)
GenerateStr
2004.07.08
7/8/2004(P3, 8 -> 8)(P4, 08 -> 8)
![Page 40: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/40.jpg)
Constructing the DAG
071/283/425060748
0 1 2 3 4
567
(P1, 7 -> 7)
(P2, 07 -> 7)
8
![Page 41: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/41.jpg)
Intersection• DAG intersection
• Edge-wise program intersection
![Page 42: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/42.jpg)
Experiments
![Page 43: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/43.jpg)
Benchmarks• 50 benchmark problems– Help forums– Excel product team
![Page 44: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/44.jpg)
Number of I/O examples
1 2 30
5
10
15
20
25
30
35
Number of Input-Output Ex-amples
Num
ber
of B
ench
mar
ks
![Page 45: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/45.jpg)
Performance
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 490
0.5
1
1.5
2
2.5
3
3.5
Benchmarks
Run
ning
Tim
e (i
n se
cond
s)
![Page 46: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/46.jpg)
Related work• String Transformations [Gulwani
POPL11]
• Table Transformations [Singh,Gulwani VLDB12]
• Spreadsheet Data Manipulation using Examples[Gulwani, Harris, Singh CACM 2012]
![Page 47: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/47.jpg)
Conclusion• Number Transformation Language– Synthesis algorithm
• String + Number Transformations– Combined Synthesis algorithm
![Page 48: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/48.jpg)
Thanks!
End-Users
Algorithm Designers
Software Developers
CAV
Large potential
![Page 49: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/49.jpg)
Questions & Comments
![Page 50: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/50.jpg)
Backup slides
![Page 51: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/51.jpg)
Number Format
123.4567
123.46
123.4 123.4
(𝛼=0 , 𝛽=2 ,𝛾=0).NET :
![Page 52: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/52.jpg)
Number Format
123.4567
123.46
123.4 123.4_
(𝛼=0 , 𝛽=2 ,𝛾=2).NET :
![Page 53: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/53.jpg)
a bc de f
g hi jk l
![Page 54: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/54.jpg)
Help-forums
![Page 55: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/55.jpg)
Number Format
123.4567
123.46
123.4 123.4
(𝛼=0 , 𝛽=2 ,𝛾=0).NET :
At most 2 decimal places
![Page 56: Synthesizing Number Transformations from Input-Output Examples](https://reader035.fdocuments.us/reader035/viewer/2022062410/56815bda550346895dc9ca2f/html5/thumbnails/56.jpg)
Number Format
123.4567
123.46
123.4 123.4_
(𝛼=0 , 𝛽=2 ,𝛾=2).NET :
Exactly 2 decimal places with space