Relational decomposition for program synthesis