Advanced Compilation and Automatic Programming ∃𝑐∀𝑖𝑛 𝑄(𝑐,𝑖𝑛) Advanced Compilation and Automatic Programming 𝜑 𝑝 𝑆𝑘[𝑐](𝑖𝑛)
Lecture 1 Course Overview Xiaokang Qiu
Who are we? Xiaokang Qiu xkqiu@purdue.edu Assistant Professor of ECE Research interests: programming languages, formal methods, and software engineering, making programming easier, more reliable and more productive How about you?
What is this course about? The goal of the course is to introduce compile-time software analysis and synthesis techniques You’ll get familiar with useful tools for analyze/verify/synthesize your programs – First 1/3 course: Core techniques – Second 1/3 course: Presentations on techniques by everyone – Third 1/3 course: Projects, and project presentations – No final exam
Logistics: When & Where Lecture: MWF 10:30-11:20 (EE 224) But you already knew that Office Hours Answer questions, discuss your project In my office (EE 334C) After Monday’s class? Course Website Website: https://engineering.purdue.edu/~ece663/ Piazza: https://piazza.com/class/jbx4hdhnva05u0
Logistics: Grading 10% — Problem sets 20% — Paper presentation 70% — Project 3% — Team formed by deadline 10% — 1-page project proposal 7% — Proposal presentation 20% — Final presentation 30% — Final report
Logistics: PSets 3-4 PSets covering core techniques (first 1/3 course) Submission details Posted on course website Submitted through email?
Logistics: Paper Presentation Ideally, each person is expected to learn all core techniques, learn one particular technique in detail, and use it in a concrete project, giving a theoretical or practical contribution. How it works: A list of papers will be posted on the course website Pick a paper from the list, hopefully related to your project Present the paper as a full lecture You may suggest a paper out of the list (you need to justify your choice)
Logistics: Project Teams of 1 or 2 people (3%) Expectations commensurate with size of team 1-page project proposal (10%) Proposal presentation (7%) Tell us what you plan to do and give some evidence that you’ve started to work on it Final presentation (20%) Project report (30%) Hopefully be at the level of a conference publication. Will be judged in terms of quality of execution originality scope
Techniques: Verification C.A.R. Hoare
Over 40 years of work on Floyd-Hoare style reasoning Infrastructure: Verifiers: Success Stories: Coq Robert W. Floyd C.A.R. Hoare Verve OS
Techniques: Synthesis
What is software synthesis? Zohar Manna Richard Waldinger
The synthesis conundrum I don’t want to program The machine should program for me But I need to tell the machine what I want I need a notation to describe what I want with great precision with little room for ambiguity So instead of “programming” I will write detailed step by step descriptions of system behavior In a notation that requires great mathematical sophistication That I have never used before (unlike my favorite programming language which I started using in grade school)
What is software synthesis? When someone says "I want a programming language in which I need only say what I wish done," give him a lollipop. -Allan Perlis 1982
FlashFill: a feature of Excel 2013 (Sumit Gulwani et al.)
FlashFill: a feature of Excel 2013 (Sumit Gulwani et al.) Result of the program generated from the first row applied to the remaining rows.
Verification as A Synthesis Problem Logic L Space of proofs x=1; y=1; while (*) { x=x+y; y=x+y; } theorem proof Q: is y>=1 always true? Program Correct?
Reactive Synthesis Environment System while(true){ read inputs; make decisions; update state; write outputs; } System Inputs Outputs Finite programs with infinite execution Very nice theory developed since 1950s
What is this course about? Logical Reasoning Synthesis Verification Machine Learning
Techniques: Logic • Logic: the Calculus of Computation the study of the principles of valid inference and demonstration. the study of the structure of arguments. the study of formal inference. • Syntax + Semantics + Inference (form) (meaning) (reasoning) • “Contrariwise,” ... “if it was so, it might be; and if it were so, it would be; but as it isn’t, it ain’t. That’s logic.” ‐ Tweedledum and Tweedledee, Lewis Carroll ∀𝑥,𝑦, 𝑥 ′ : 𝑥>𝑦∧ 𝑥 ′ =𝑥+1 → 𝑥 ′ >𝑦
Some successful tools SMT solver Software verifier Z3, CVC4, … Software verifier Dafny Inductive synthesizer Sketch Static analyzer CPAChecker Second-order tree solver MONA