Program synthesis is the systematic, usually automatic construction of correct and efficient executable code from declarative statements. Program synthesis is routinely used in industry to generate GUIs and for database support. I contend that program synthesis can be applied as a rapid prototyping method to the data mining phase of knowledge discovery. Rapid prototyping of statistical data analysis algorithms would allow experienced analysts to experiment with different statistical models before choosing one, but without requiring prohibitively expensive programming efforts. It would also smooth the steep learning curve often faced by novice users of data mining tools and libraries. Finally, it would accelerate dissemination of essential research results. For the synthesis task, development on such a system has used a specification language that generalizes Bayesian networks, a dependency model on variables. With decomposition methods and algorithm templates, the system transforms the network through several levels of representation into pseudo-code which can be translated into the implementation language of choice. The system applies computational logic to make learning work. In this talk, I will present the AutoBayes system developed through a long program of research and development primarily by Bernd Fischer, Johann Schumann and others [1,2] at NASA Ames Research Center, starting from a program of research by Wray Buntine  and Mike Lowry. I will explain the framework on a mixture of Gaussians model used in some commercial clustering tools, and present some more realistic examples.