Modelling Program Spaces in Program Synthesis with Constraints