Speeding up program synthesis using specification discovery