A deductive approach to program synthesis