1 Constraint Problems in Program Analysis from the sublime to the ridiculous Alex Aiken Stanford University.

Slides:



Advertisements
Similar presentations
2005conjunctive-ii1 Query languages II: equivalence & containment (Motivation: rewriting queries using views)  conjunctive queries – CQ’s  Extensions.
Advertisements

Pointer Analysis – Part I Mayur Naik Intel Research, Berkeley CS294 Lecture March 17, 2009.
Flow-Insensitive Points-to Analysis with Term and Set Constraints Presentation by Kaleem Travis Patrick.
Timed Automata.
© Anvesh Komuravelli Quantified Invariants in Rich Domains using Model Checking and Abstract Interpretation Anvesh Komuravelli, CMU Joint work with Ken.
Panel on Decision Procedures Panel on Decision Procedures Randal E. Bryant Lintao Zhang Nils Klarlund Harald Ruess Sergey Berezin Rajeev Joshi.
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Plan for today Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Nikolaj Bjørner Microsoft Research Lecture 3. DayTopicsLab 1Overview of SMT and applications. SAT solving, Z3 Encoding combinatorial problems with Z3.
1 Satisfiability Modulo Theories Sinan Hanay. 2 Boolean Satisfiability (SAT) Is there an assignment to the p 1, p 2, …, p n variables such that  evaluates.
Solving Partial Order Constraints for LPO termination.
Math443/543 Mathematical Modeling and Optimization
Constrained Maximization
Analysis of Algorithms CS 477/677
Penn ESE535 Spring DeHon 1 ESE535: Electronic Design Automation Day 5: February 2, 2009 Architecture Synthesis (Provisioning, Allocation)
Decision Procedures Mooly Sagiv. Bibliography Nelson & Oppen Fast Decision Procedures Based on Congruence Closure JACM 1979 Stump, Dill, Barrett, Levitt.
Nikolaj Bjørner Leonardo de Moura Nikolai Tillmann Microsoft Research August 11’th 2008.
1 A propositional world Ofer Strichman School of Computer Science, Carnegie Mellon University.
Triple Patterning Aware Detailed Placement With Constrained Pattern Assignment Haitong Tian, Yuelin Du, Hongbo Zhang, Zigang Xiao, Martin D.F. Wong.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
Penn ESE535 Spring DeHon 1 ESE535: Electronic Design Automation Day 5: February 2, 2009 Architecture Synthesis (Provisioning, Allocation)
Linear Equations with Different Kinds of Solutions
Operations Research I Lecture 1-3 Chapter 1
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding ILPs with Branch & Bound ILP References: ‘Integer Programming’
Linear Programming Models: Graphical and Computer Methods
Memory Allocation CS Introduction to Operating Systems.
1.1 Chapter 1: Introduction What is the course all about? Problems, instances and algorithms Running time v.s. computational complexity General description.
Linear programming Lecture (4) and lecture (5). Recall An optimization problem is a decision problem in which we are choosing among several decisions.
Operations Research Models
Decision Procedures An Algorithmic Point of View
Substitution. There are 3 different ways to solve linear equations: 1. Substitution 2. Elimination 3. Graphing We will focus on a new one each day. Today.
CSNB143 – Discrete Structure
Fixed Parameter Complexity Algorithms and Networks.
CMPS 3223 Theory of Computation Automata, Computability, & Complexity by Elaine Rich ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slides provided.
Boolean Satisfiability and SAT Solvers
Chapter 4.1 Solving Systems of Linear Equations in two variables.
Type Systems CS Definitions Program analysis Discovering facts about programs. Dynamic analysis Program analysis by using program executions.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
Big Ideas Differentiation Frames with Icons. 1. Number Uses, Classification, and Representation- Numbers can be used for different purposes, and numbers.
Complexity Non-determinism. NP complete problems. Does P=NP? Origami. Homework: continue on postings.
P, NP, and Exponential Problems Should have had all this in CS 252 – Quick review Many problems have an exponential number of possibilities and we can.
Penn ESE535 Spring DeHon 1 ESE535: Electronic Design Automation Day 10: February 18, 2015 Architecture Synthesis (Provisioning, Allocation)
Unit 6 We are reviewing proportional relationships using graphs and tables. We are reviewing how to compare rates in different representations of proportional.
Conformant Probabilistic Planning via CSPs ICAPS-2003 Nathanael Hyafil & Fahiem Bacchus University of Toronto.
1 Chapter 3 Complexity of Classical Planning. 2 Review: Classical Representation Function-free first-order language L Statement of a classical planning.
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
Random Interpretation Sumit Gulwani UC-Berkeley. 1 Program Analysis Applications in all aspects of software development, e.g. Program correctness Compiler.
Accelerating Random Walks Wei Wei and Bart Selman.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
CPS Computational problems, algorithms, runtime, hardness (a ridiculously brief introduction to theoretical computer science) Vincent Conitzer.
Solving the Logic Satisfiability problem Solving the Logic Satisfiability problem Jesus De Loera.
NPC.
NP Completeness Piyush Kumar. Today Reductions Proving Lower Bounds revisited Decision and Optimization Problems SAT and 3-SAT P Vs NP Dealing with NP-Complete.
A Introduction to Computing II Lecture 5: Complexity of Algorithms Fall Session 2000.
Young CS 331 D&A of Algo. NP-Completeness1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and.
Selected Decision Procedures and Techniques for SMT More on combination – theories sharing sets – convex theory Un-interpreted function symbols (quantifier-free.
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
2009/6/30 CAV Quantifier Elimination via Functional Composition Jie-Hong Roland Jiang Dept. of Electrical Eng. / Grad. Inst. of Electronics Eng.
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
Linear programming Lecture (4) and lecture (5). Recall An optimization problem is a decision problem in which we are choosing among several decisions.
On the Relation Between Simulation-based and SAT-based Diagnosis CMPE 58Q Giray Kömürcü Boğaziçi University.
Satisfiability Modulo Theories and DPLL(T) Andrew Reynolds March 18, 2015.
Lesson 9.6 Topic/ Objective: To solve non linear systems of equations. EQ: How do you find the point of intersection between two equations when one is.
Solve a system of linear equation in two variables
Integer Programming (정수계획법)
Improving the Precision of INCA by Preventing Spurious Cycles
Integer Programming (정수계획법)
Lecture 10, Computer Networks (198:552)
Presentation transcript:

1 Constraint Problems in Program Analysis from the sublime to the ridiculous Alex Aiken Stanford University

Focus Techniques used by –Type and program analysis communities –Other than SAT Warning: Personal biases ahead... 2

Topics Different notions of solving Algorithmics and engineering Solving vs. entailment Open problems 3

What’s Different NP-Hard problems: SOLVE(F) = one solution PTIME problems: SOLVE(F) = all solutions 4

Example: Unification 5  int  ! !!  ° ! ! ! ¯ ¯ Represents all solutions. =

Comments A single representation for all solutions A great deal of sharing among the solutions Characteristic of PTIME techniques –Intuitively, this must be the case –Exponential number of incomparable solutions requires more than PTIME But see uses of BDD’s... 6

Why is This Useful? F(a) { … return b } 7  ¯ constraints C Conclude: F:  ! ¯ where C

Why is This Useful? F(a) { … return b } G(x) { … F(i) … } H(y) { … F(j) … } I(z) { … F(k) … } 8 F:  ! ¯ where C If all solutions of C have a compact representation, solve C once, reuse at each call site If solutions are not compactly representable, better to reanalyze F in each calling context

Two Styles of Analysis Whole program –Entire program needed for analysis of any piece Compositional –Can analyze partial or “open” programs (libraries) Intimately connected to solving complexity –Leads to very different engineering issues –This is poorly understood today 9

Algorithms and Engineering Algorithms: PTIME is good enough Engineering: linear space is essential –Must also be close to linear time –These algorithms are applied at large scales –Linux kernel 6.2MLOC 10

11 Set Constraints (a fragment) Set expressions: E ::= X | c(E 1,...,E n ) Set constraints: Æ E j1 µ E j2 j

Applications Pointer analysis Subtyping systems Soft typing Context-free reachability Multiple reachability properties –A context free and any regular properties … 12

13 Constraints as Graphs abUV cc XY Constraints: Graph: c(a,b)X c(U,V) Y µ XY µ µ Rewrite rules: E 1 µ X µ E 2 ) E 1 µ E 2 c(E 1,...,E n ) µ c(E 1 ’,...E n ’) ) Æ E i µ E i ’

Solutions Solution size is potentially O(n 2 ) –May be the complete graph Solution time is O(n 3 ) –Each of O(n 2 ) edges may be added in O(n) ways A major engineering issue –1996: analyze 5 KLOC –2002: analyze 6MLOC now in production compilers 14

15 Optimization: Cycle Elimination Variables in a cycle are all equivalent X 1 µ X 2 … µ X n µ X 1 Optimization: collapse them into one variable … SS SS S

Discussion Good techniques for cycle-elimination known –Does not change worst-case complexity –But makes 100X time difference Specific algorithmic/implementation techniques are critical to the success of decision procedures –Even “cheap” ones –Support for such research is important 16

Entailment Often want to know: Does C imply some constraint(s) C’? Is every solution of C a solution of C’? –Entailment –Validity (does C imply true?) Important for –Queries (can I perform this optimization?) –Presentation (simplification of constraints) 17

Is there an Issue? Consider SAT solving Satisfiability: NP-complete Validity: CoNP-complete But we use the same implementation for both –Just need to know if there are 0 or > 0 solutions 18

The Issue For low complexity techniques entailment often very different from satisfiability Example: Conditional equality constraints ¿ 1 · ¿ 2, ¿ 1 = ? Ç ¿ 1 = ¿ 2 19

Conditional Equality Constraints Solving –Near linear time Entailment –Quadratic Completely different algorithms –And different engineering –Big difference between linear and super-linear... –... see previous discussion 20

Open Problems (Theory) The “cubic-time” set constraint fragment –Entailment is in NEXPTIME –Entailment is PSPACE-Hard Non-structural subtype entailment –Entailment is PSPACE-Hard –Decidability is open –First-order fragment is undecidable With 3 quantifier alternations 21

An Open Problem? (Engineering) Integer programming –NP-complete –Huge topic in analysis of software Parallelization, resource allocation, understanding arrays … Consider Minimize x subject to 3x+3y=4 What do ILP solvers do? –Answer: LP-based solvers diverge. Why? 22

Combining Theories Many applications use multiple kinds of constraints –And there are many such constraint theories Need good ways of combining theories –More than Nelson-Oppen 23

Topics Different notions of solving Algorithmics and engineering Solving vs. entailment Open problems 24