32
CS703: PROJECT GUIDELINES 1

CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Embed Size (px)

Citation preview

Page 1: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

CS703: PROJECT GUIDELINES

1

Page 2: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

2

Logistics: Project• Most important part of the course

• Teams of 1 or 2 people• Expectations commensurate with size of team

• Deliverables• Oct 2: Email me a list of 3 project ideas• Oct 16: Project proposal• Nov 4: Description of progress 1• Nov 19: Description of progress 2• Dec 7-14: Presentation to the class• Dec 15: Final write-up

Page 3: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

3

How do I choose my project?• I really want you to work on something you like!

• Ideally something that intersects with your research interests• Talk to your advisor and explain what the class is about• Ask for suggestions: “Is there a verification or synthesis problem related to

our research?”

• If you need suggestions on papers to read based on a topic ask me

• … if you really cannot find anything I can help you and guide you towards some projects

Page 4: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

4

Verification projects• You’ll have a portfolio of program verification techniques • plenty of open-source and freely available verification tools (NuSMV, Z3,

Boogie, Uppaal)

• If you also took CS704, you can combine all you have learned

• Possible domains • Networks, GPU code, hardware binary, XML queries, CSS, GUIs, … • Think outside the box…• Example1: automatically detect whether an Android app can ever render 2 images

on top of each-other.• Example2: is CSS file 1 equivalent to CSS file 2. Which one is faster?

• It doesn’t have to use what we used in class verbatim

Page 5: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

5

Theory projects• Least recommended (might be hard to get deliverables)

• We are seeing many models, logics, and techniques in this course• Many have open-problems, some of which are (might be) approachable

• Example: an algorithm for learning symbolic automata over the theory of BDDs• Example: prove complexity lower-bound for some problem related to automata/verification (if you want to work on this type of problem, come and talk to me)• Example: analyze complexity of synthesis questions• Example: combine models together and analyze algorithms (e.g. symbolic MSO)

Page 6: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

AN OVERVIEW OF PROGRAM SYNTHESISEnough info so that you can think about a project

6

Page 7: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

7

What is program synthesis?

User intent

Domain knowledge

Program can only use:Length(x), if(x)then y else z, x[i],…

Synthesizer

Input Output

Program1 -> 0

340 -> 300568 -> 500

Function f(x){If(length(x)<3)

return 0Else

return x[0]+`00’

}

Page 8: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

For every synthesis problem…• How do you tell the system what you want?• What is the specification formalism• What is the interaction model• What happens when there is ambiguity

• How do you represent domain knowledge?• How do you guide the system towards relevant programs• How can you take advantage of the structure of the

space of programs you care about• How does the system find the program you actually want?• And how does it know it is the program you want

Page 9: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Different types of synthesis• Inductive Synthesis

• Functional Synthesis

• Reactive Synthesis

• Quantitative Synthesis

Page 10: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Traditional Machine Learning

Learn a function from a set of examples

Scalability is very important, algorithms must scale to millions of data points

Data is assumed to be noisy; need to avoid overfitting

Space of possible functions is highly stylized

Background knowledge incorporated as preprocessing and feature selection

Inductive Synthesis

Learn a function from a set of examples Scalability is not so important, usually we

are dealing with small numbers of examples

Data is assumed to be clean It’s annoying when user says f(x)=y and the

system assumes the user is wrong and decides that f(x)=z

Space of possible functions can be arbitrary

Background knowledge encoded in the description of the space and in the search itself

Inductive SynthesisSynthesize a program whose behavior satisfies a set of examples

Page 11: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Programming by Example: Motivation

• Two major criticisms of synthesis:• It’s too hard to make it work• Even if it works, it ends up being too hard to use

Students and Teachers

Algorithm Designers

Software Developers

End-UsersMost Useful Target

(logics, automata, etc.)

(Examples!)

Page 12: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

FlashFill: a feature of Excel 2013 (Sumit Gulwani et al.)

Page 13: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Different types of synthesis• Inductive Synthesis

• Functional Synthesis

• Reactive Synthesis

Page 14: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Functional Synthesis

• Goal: Synthesize a function that satisfies a specification• How do we know the specification has been satisfied? Isn’t verification itself

already quite hard?• What is the relevant space of functions?• How do we explore this space efficiently?

Page 15: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Example:Least Significant Zero Bit

• 0010 0101 0000 0010

• Trick: • Adding 1 to a string of ones turns the next zero to a 1• i.e. 000111 + 1 = 001000

int W = 32;

bit[W] isolate0 (bit[W] x) { // W: word sizebit[W] ret = 0;for (int i = 0; i < W; i++)

if (!x[i]) { ret[i] = 1; return ret; } }

Page 16: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Space of possible implementations/** * Generate the set of all bit-vector expressions * involving +, &, xor and bitwise negation (~). * the bnd param limits the size of the generated expression. */

generator bit[W] gen(bit[W] x, int bnd){ assert bnd > 0; if(??) return x; if(??) return ??; if(??) return ~gen(x, bnd-1); if(??){ return {| gen(x, bnd-1) (+ | & | ^) gen(x, bnd-1) |}; }}

Page 17: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Example: Least Significant Zero Bit

generator bit[W] gen(bit[W] x, int bnd){ assert bnd > 0; if(??) return x; if(??) return ??; if(??) return ~gen(x, bnd-1); if(??){ return {| gen(x, bnd-1) (+ | & | ^) gen(x, bnd-1) |}; }}

bit[W] isolate0sk (bit[W] x) implements isolate0 { return gen(x, 3);}

Page 18: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Different types of synthesis• Inductive Synthesis

• Functional Synthesis

• Reactive Synthesis

Page 19: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

while(true){ read inputs; make decisions; update state; write outputs;}

Reactive Synthesis

Environment System

Inputs

Outputs

Page 20: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Reactive Synthesis• Challenge• How do we specify correct behavior? • We now have to relate infinite sequences of inputs to infinite sequences of outputs.

• What if there is feedback between the system and environment• Often the goal of the system is to control the environment

• Very nice theory around finite state systems

Page 21: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Game based formalisms for Reactive Synthesis

• For every move of the adversary (ever action of the environment) the synthesized program must make a counter-move that keeps the system working correctly.• The game can be modeled with an automaton

Page 22: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Different types of synthesis• Inductive Synthesis

• Functional Synthesis

• Reactive Synthesis

• Quantitative Synthesis

Page 23: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

Quantitative Synthesis

• Boolean specifications are often insufficient• They can be too hard to write• Fail to capture important properties of the problem

• What do we want to optimize?• A quantity that is inherent to the program• e.g. lines of code

• A quantity that depends on the input• e.g. running time of the program• In the worst case? The best case?• On average? On expected value? For what distribution?

Page 24: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

24

WHAT DO THEY ALL HAVE IN COMMON

Page 25: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

For every synthesis problem…• How do you tell the system what you want?• What is the specification formalism• What is the interaction model• What happens when there is ambiguity

• How do you represent domain knowledge?• How do you guide the system towards relevant programs• How can you take advantage of the structure of the

space of programs you care about• How does the system find the program you actually want?• And how does it know it is the program you want

Page 26: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

26

How do you tell the system what you want?

• (Input, output) examples• Sketched program• LTL formula for reactive system• One of the above + optimization criteria

Page 27: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

27

How do you represent domain knowledge?

• A grammar of possible operations (you can only use substring, …)• Generator: A program that can generate programs (see Sketch)• Every reactive controller will be a game automaton

Page 28: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

28

How does the system find the program you actually want?• Enumeration-based search• Requires quick way to discard wrong solutions• Requires pruning techniques (don’t enumerate redundant functions)

• Constraint-based search• Encode the search problem into a constraint in a logic• Solve the constraint• For example Sketch encodes everything in a constraint over the integers

• Stochastic search• Randomly pick next program to search based on heuristic • Requires good heuristics

• Nice algorithms for the automata case in reactive synthesis

Page 29: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

29

EXAMPLE APPLICATIONS

Page 30: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

30

Inductive synthesis• Spreadsheet transformations in excel• They are typically small programs but tricky to write

• Parsers• Very natural way to provide examples (highlight part of text you want to

parse with some nonterminal)• A lot of domain knowledge to exploit

• Small recursive functional programs• Examples guide the search (each suffix is an example itself)

Page 31: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

31

Functional synthesis• Superoptimizers (via Sketch)• They are small programs• Operate over (large) finite domains

• Query extractions (via Sketch)• Extract SQL query from Java code• Very specific theory for relations

• Program repair and automatic grading• Small edit should turn the program into a correct one• Wrong program provides a hopefully close to correct solution

Page 32: CS703: PROJECT GUIDELINES 1. Logistics: Project Most important part of the course Teams of 1 or 2 people Expectations commensurate with size of team Deliverables

32

Reactive synthesis• A theory by itself…• Can only be used by domain experts• But result is guaranteed to be correct

• BUS controllers in hardware