Program synthesis automatically constructs a simple program by searching through candidate code until one satisfies a specification, often expressed as input-output pairs. It resembles machine learning because both infer a mapping from examples, but synthesis generates source code through discrete search rather than fitting parameters in a fixed neural network. section 19.4.4
From examples to executable code
Provide a specification as several input-output pairs and a set of available building blocks. A search process assembles those blocks into candidate programs, tests each candidate against the specification, and stops when it finds a valid match. Genetic search is one possible search strategy. Unlike gradient-based learning, the result is a graph of programming-language operators that can express program-centric abstractions. section 19.4.4
Use these distinctions when choosing an approach:
- Use deep learning for value-centric abstraction such as pattern recognition and intuition; use synthesis for program-centric abstraction such as discrete reasoning, planning, and causal understanding. section 19.4.5 section 20.3
- Treat synthesis as a complement to deep learning, either by combining learned and algorithmic modules or by using learned intuition to guide the program search. section 19.4.5 section 20.3
- Expect discrete search to remain the practical bottleneck because the space of possible programs is vast and combinatorial. section 20.3
Figure 19.14 A schematic view of program synthesis: given a program specification and a set of building blocks, a search process assembles the building blocks into candidate programs, which are then tested against the specification. The search continues until a valid program is found.
Trace the synthesis loop from a specification and building blocks through candidate construction and verification. section 19.4.4

