Logic-based Program Synthesis And Transformation