Second Task

Our second task will be in the context of programming-by-example, a popular application of program synthesis. For this task, you have access to sub-specifications. Please feel free to use them.

Say the user wishes to synthesize a function f which accepts two integer-valued arguments as input and produces an integer as output. They specify the function f as follows :

Specification


f(11, 45)=1f(1, 26)=3f(39, 29)=1f(1, 36)=3f(15, 12)=1
f(37, 1)=3f(40, 29)=1f(1, 33)=3f(34, 39)=1f(10, 1)=3
f(5, 7)=1f(1, 4)=3f(7, 21)=1f(26, 1)=3f(50, 33)=1
f(50, 1)=3f(13, 10)=1f(1, 39)=3f(46, 18)=1f(7, 1)=3

In response, the synthesizer produces the following implementation :

Implementation and Sub-specifications

Please hover over different parts of the implementation to see the corresponding sub-specifications.


f(x,y)= if x1 h(11, 45)=false h(1, 26)=true     h(39, 29)=false h(1, 36)=true     h(15, 12)=false
h(37, 1)=false   h(40, 29)=false h(1, 33)=true     h(34, 39)=false h(10, 1)=false
h(5, 7)=false     h(1, 4)=true       h(7, 21)=false   h(26, 1)=false   h(50, 33)=false
h(50, 1)=false   h(13, 10)=false h(1, 39)=true     h(46, 18)=false h(7, 1)=false
then 3x h(1, 26)=3
h(1, 36)=3
h(1, 33)=3
h(1, 4)=3
h(1, 39)=3
elif y1 h(11, 45)=false h(39, 29)=false h(15, 12)=false h(37, 1)=true     h(40, 29)=false
h(34, 39)=false h(10, 1)=true     h(5, 7)=false     h(7, 21)=false   h(26, 1)=true
h(50, 33)=false h(50, 1)=true     h(13, 10)=false h(46, 18)=false h(7, 1)=true
then 3y h(37, 1)=3
h(10, 1)=3
h(26, 1)=3
h(50, 1)=3
h(7, 1)=3
else 1 h(11, 45)=1
h(39, 29)=1
h(15, 12)=1
h(40, 29)=1
h(34, 39)=1
h(5, 7)=1
h(7, 21)=1
h(50, 33)=1
h(13, 10)=1
h(46, 18)=1


Question 1

Consider the following sub-expression in the implementation :
f(x,y)= if x1 then 3x elif y1 then 3y else 1
Which input-output examples are relevant to the sub-expression?

Question 2

Consider the following sub-expression in the implementation :
f(x,y)= if x1 then 3x elif y1 then 3y else 1
Which input-output examples are relevant to the sub-expression?

Question 3

Consider the following sub-expression in the implementation :
f(x,y)= if x1 then 3x elif y1 then 3y else 1
Which input-output examples are relevant to the sub-expression?