CS294: Program Synthesis for Everyone

Ras Bodik and Emina Torlak

Fall 2012, 310 Soda Hall, TT 11-12:30

Office hours (Ras): Wed 1-2pm, Fri 4-5pm, 565 Soda Hall (in Par Lab)

This course extends the invited tutorial that we gave at CAV 2012. Tutorial slides: (ppt, pdf, screencast).

Lectures

mailing list: cs294-synthesis google group

1 What is program synthesis?

Topics: What is program synthesis? How to perform synthesis with constraint solvers? Constraint solver as a program evaluator and program execution inverter. Why synthesis now? Synthesis vs. compilation. Example of real-world synthesizers. What artifacts might be synthesizable? Introduction to course format and overview of course project. Slides: pptx pdf screencast Files: FlashFill demo Date: August 23, 2012 Homework: HW1

2 Constraint solvers can help you write programs.

Topics: Four programming problems solvable when a program is translated into a logical constraint: verification, fault-localization, synthesis, and angelic programming. Constructing the formulas for these problems given an encoding of a program. Example of a simple SMT program encoding. Demonstrating the four problems on the Z3 solver. Slides: pptx pdf Files: Z3 encodings Date: August 28, 2012

3 From programs to formulas.

4 Introduction to Satisfiability Solvers with Practical Applications.

Topics: Guest lecture by Niklas Een, co-designer of MiniSAT. Algorithms of modern (CDCL) SAT solvers: implication view of CNF, decision heuristics, propagation techniques, conflict analysis. Encoding problems in CNF: Slither Link, incremental encoding. MiniSAT API. Bounded model checking. Slides: pptx pdf Date: September 04, 2012

5 Encoding programs in relational logic.

Topics: Relational logic. Encoding loops. Modeling the heap, including updates to object fields. Static assignment for the heap. Partial models. Verification, bug localization, and synthesis with relational formulas. Tutorial on the Kodkod solver. Slides: pdf screencast Date: September 06, 2012

6 Why are small languages useful.

Topics: Increase the level of programming abstraction. Language properties desired in general and for synthesis in particular. Examples of small languages (geometry construction, relational data structures, automata protocols). Slides: pptx pdf Date: September 11, 2012 Assigned reading (due next lecture): Implementing languages in Racket. Danny Yoo, Fudging up a Racket.

7 Project, Part 1: The problem statement (what we want to synthesize).

Topics: Students present their project proposals. Problem statement. What is the specification. Files: Student presentations Date: September 13, 2012

8 Language implementation (I).

Topics: Implementing languages in Racket. Syntactic abstraction with macros. Date: September 18, 2012 Read before the lecture (optional): Creating Languages in Racket (Sometimes you just have to make a better mousetrap), by Matthew Flatt.

9 Language implementation (II).

Topics: Slides: screencast Date: September 20, 2012

10 Language implementation (III).

Topics: Date: September 25, 2012

11 Project, Part 2: The design of your language.

Topics: You will synthesize programs in this language. Slides: pptx pdf Files: student presentations Date: September 27, 2012

12 Compiling programs to formulas.

Topics: Lifting built-in operators to the symbolic domain. Partial evaluation. Bounded unwinding. Discussion of challenges translating assertions, in the context of assertions for guarding bounded unwinding. Slides: screencast Date: October 02, 2012

13 End-User Programming and Intelligent Tutoring Systems

Topics: Guest Lecture by Sumit Gulwani. Slides: pptx Files: Sumit's home page Date: October 03, 2012

14 Formula Compilers for your language.

Topics: Translation of recursive programs. Discussion of translating imperative programs guided by the translation of the brainfudge interpreter to formulas. Slides: screencast Files: Sim-syn, a simple synthesizer in Racket Date: October 09, 2012

15 Project, Part 3: Partial Programs in Your Language.

Topics: You will study programs in your domain and define holes. In your presentation, you will show sketches in your language and show a demo of running programs (this demo does not include hols). Slides: pptx pdf Files: student presentations Date: October 11, 2012

16 Miscellaneous logic modeling issues.

Topics: Solving synthesis problems with sim-syn. Overflow in bitvector encodings. Sketching expressions. Bottom-up versus top-down construction of path conditions. Making vector operations symbolic. Translating side-effect functions to logic. Slides: screencast Date: October 16, 2012

17 Synthesis with Version Space Algebra

Topics: Date: October 18, 2012 Read before the lecture (optional): Learning Programs from Traces using Version Space Algebra

18 Encoding concurrency (scheduling, non-determinism).

Topics: Date: October 23, 2012

19 Project, Part 4: Compile your programs to formulas.