Speeding Up Program Synthesis Using Specification Discovery