First Task

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

 
x,y,i,j.  0f(x,y)2    
f(x,y)=0 x=y
f(x,y)=01i,j2 |x-y|(x-y)(j-i)f(x+i,y+j)=0
f(x,y)0 f(x+f(x,y),y+f(x,y))0|x-y|>0

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 x=y x,y. (x=yh(x,y)=true) (xyh(x,y)=false) then 0 x,y. x=yh(x,y){0} else 1 x,y. xyh(x,y){1,2}


Question 1

Consider the following sub-expression in the implementation :
f(x,y)= if x=y then 0 else 1
Say we change the sub-expression from 1 to 2 :
f'(x,y)= if x=y then 0 else 2
Will this new implementation still satisfy the specification?

Question 2

Consider the same sub-expression as before :
f(x,y)= if x=y then 0 else 1
Say we change the sub-expression from 1 to 0 instead :
f'(x,y)= if x=y then 0 else 0
Will this new implementation satisfy the original specification?

Question 3

Consider the following sub-expression in the implementation :
f(x,y)= if x=y then 0 else 1
Say we change the sub-expression from 0 to 1 :
f'(x,y)= if x=y then 1 else 1
Will this new implementation still satisfy the specification?

Question 4

Consider the same sub-expression as before :
f(x,y)= if x=y then 0 else 1
Say we change the sub-expression from 0 to 2 instead :
f'(x,y)= if x=y then 2 else 1
Will this new implementation satisfy the original specification?