Ruzica Piskac Max Planck Institute for Software Systems, Germany.

Slides:



Advertisements
Similar presentations
Logical Abstract Interpretation Sumit Gulwani Microsoft Research, Redmond.
Advertisements

Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Lesson 1.3 Unit 1, Lesson 3. Set:A collection of distinct objects Elements:All of the objects that make up a set.
Automated Verification with HIP and SLEEK Asankhaya Sharma.
A System to Generate Test Data and Symbolically Execute Programs Lori A. Clarke September 1976.
Addressing the Challenges of Current Software. Questions to Address Why? What? Where? How?
1 LP Duality Lecture 13: Feb Min-Max Theorems In bipartite graph, Maximum matching = Minimum Vertex Cover In every graph, Maximum Flow = Minimum.
Satisfiability Modulo Theories (An introduction)
SMT Solvers (an extension of SAT) Kenneth Roe. Slide thanks to C. Barrett & S. A. Seshia, ICCAD 2009 Tutorial 2 Boolean Satisfiability (SAT) ⋁ ⋀ ¬ ⋁ ⋀
Analysis of Algorithms CS Data Structures Section 2.6.
Software Engineering & Automated Deduction Willem Visser Stellenbosch University With Nikolaj Bjorner (Microsoft Research, Redmond) Natarajan Shankar (SRI.
Algorithms Recurrences. Definition – a recurrence is an equation or inequality that describes a function in terms of its value on smaller inputs Example.
Nikolaj Bjørner Microsoft Research Lecture 3. DayTopicsLab 1Overview of SMT and applications. SAT solving, Z3 Encoding combinatorial problems with Z3.
CSC 2300 Data Structures & Algorithms March 27, 2007 Chapter 7. Sorting.
CSE 326: Data Structures Lecture #3 Analysis of Recursive Algorithms Alon Halevy Fall Quarter 2000.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Lec 5 Feb 10 Goals: analysis of algorithms (continued) O notation summation formulas maximum subsequence sum problem (Chapter 2) three algorithms image.
Software Verification Bertrand Meyer Chair of Software Engineering Lecture 2: Axiomatic semantics.
CS4723 Software Validation and Quality Assurance Lecture 02 Overview of Software Testing.
MCA –Software Engineering Kantipur City College. Topics include  Formal Methods Concept  Formal Specification Language Test plan creation Test-case.
Software Testing and QA Theory and Practice (Chapter 4: Control Flow Testing) © Naik & Tripathy 1 Software Testing and Quality Assurance Theory and Practice.
Introduction SWE 619. Why Is Building Good Software Hard? Large software systems enormously complex  Millions of “moving parts” People expect software.
Chapter 6 Algorithm Analysis Bernard Chen Spring 2006.
HOW TO SOLVE IT? Algorithms. An Algorithm An algorithm is any well-defined (computational) procedure that takes some value, or set of values, as input.
CIS Computer Programming Logic
CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a lgorithms.
Discrete Structures Lecture 11: Algorithms Miss, Yanyan,Ji United International College Thanks to Professor Michael Hvidsten.
Chapter 11 Creating Formulas that Count and Sum Microsoft Excel 2003.
1 A Combination Method for Generating Interpolants Greta Yorsh Madan Musuvathi Tel Aviv University, Israel Microsoft Research, Redmond, US CAV’05.
Chapter 3 Sec 3.3 With Question/Answer Animations 1.
1 COMP3040 Tutorial 1 Analysis of algorithms. 2 Outline Motivation Analysis of algorithms Examples Practice questions.
Order Statistics. Order statistics Given an input of n values and an integer i, we wish to find the i’th largest value. There are i-1 elements smaller.
L. Grewe.  An array ◦ stores several elements of the same type ◦ can be thought of as a list of elements: int a[8]
Synthesis using Variable Elimination Viktor Kuncak EPF Lausanne
Synthesis, Analysis, and Verification Lecture 01c Lectures: Viktor Kuncak Exercises and Labs: Eva Darulová Giuliano Losa About Synthesis General Background.
30S Applied Math Mr. Knight – Killarney School Slide 1 Unit: Solving Systems Algebraically Lesson: SLE-L3 Using Spreadsheet Analysis to Solve Linear Systems.
Integrating high-level constructs into programming languages Language extensions to make programming more productive Underspecified programs –give assertions,
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Lab 3 Solver Add-In In Excel ► Lab 2 Review ► Solver Add-in Introduction ► Practice Solver following Instructor » Saferly Inc.
Algorithm Analysis Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Examples and Sets. Synthesize each of These choose((x,y) =>10 x + 14 y == a) choose((x,y) =>10 x + 14 y == a&& x < y) choose((x,y) =>10 x + 14 y == a.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
CES 592 Theory of Software Systems B. Ravikumar (Ravi) Office: 124 Darwin Hall.
23 February Recursion and Logarithms CSE 2011 Winter 2011.
The Selection Algorithm : Design & Analysis [10].
8-6: Geometric Sequences Objectives: 1.To form geometric sequences 2.To use formulas when describing geometric sequences.
Interface specifications At the core of each Larch interface language is a model of the state manipulated by the associated programming language. Each.
Decision Support Systems
CS1010 Programming Methodology
Control Flow Testing Handouts
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
1-1 Logic and Syntax A computer program is a solution to a problem.
CS5123 Software Validation and Quality Assurance
Synthesis using Variable Elimination
Outline of the Chapter Basic Idea Outline of Control Flow Testing
Implicit Programming Viktor Kuncak PhD MIT, 2007
Intro. to Spreadsheets Using Microsoft Excel
Programming Right from the Start with Visual Basic .NET 1/e
Programming Languages 2nd edition Tucker and Noonan
Back to “Serious” Topics…
Mathematical Reasoning
Complete Program Synthesis for Linear Arithmetics
CSC-682 Advanced Computer Security
Sub-system interfaces
CSE 1020:Software Development
Assignment Operators Topics Increment and Decrement Operators
Key Questions What are the basic arithmetic expressions and how do you use them in Excel?
Programming Languages 2nd edition Tucker and Noonan
Follow-up of MoU objectives
Sets CS3240, L. grewe.
Presentation transcript:

Ruzica Piskac Max Planck Institute for Software Systems, Germany

Program = a sequence of commands describing what needs to be done val bigSet =.... val (setA, setB) = choose((a: Set, b: Set) ) => ( a.size == b.size && a union b == bigSet && a intersect b == empty)) val bigSet =.... val (setA, setB) = choose((a: Set, b: Set) ) => ( a.size == b.size && a union b == bigSet && a intersect b == empty)) Code val n = bigSet.size/2 val setA = take(n, bigSet) val setB = bigSet −− setA Code val n = bigSet.size/2 val setA = take(n, bigSet) val setB = bigSet −− setA

Program = a sequence of commands describing what needs to be done val bigSet =.... val (setA, setB) = choose((a: Set, b: Set) ) => ( a.size == b.size && a union b == bigSet && a intersect b == empty)) val bigSet =.... val (setA, setB) = choose((a: Set, b: Set) ) => ( a.size == b.size && a union b == bigSet && a intersect b == empty)) Code assert (bigSet.size is an even number) val n = bigSet.size/2 val setA = take(n, bigSet) val setB = bigSet −− setA Code assert (bigSet.size is an even number) val n = bigSet.size/2 val setA = take(n, bigSet) val setB = bigSet −− setA

Why should we sort data? Practical exercise: –Form a line, where you are sorted by your first name, from Aaron to Zoe

Data structure: A[0] = 23, A[1]=4, A[2]=6, A[3]=15, A[4]=5, A[5]=7

Array a 2 is a sorted version of array a 1 Define the counting function and

decision procedure answers whether the input formula is satisfiable or not  formula is satisfiable for x=0, y=1  formula is unsatisfiable 7 formula in some logic theorem prover based on DECISION PROCEDURES satisfiable(model) unsatisfiable (proof)

choose((h: Int, m: Int, s: Int) ⇒ ( h * m * 60 + s == totalSeconds && h ≥ 0 && m ≥ 0 && m < 60 && s ≥ 0 && s < 60 )) choose((h: Int, m: Int, s: Int) ⇒ ( h * m * 60 + s == totalSeconds && h ≥ 0 && m ≥ 0 && m < 60 && s ≥ 0 && s < 60 )) Returned code: assert (totalSeconds ≥ 0) val h = totalSeconds div 3600 val temp = totalSeconds + (-3600) * h val m = min(temp div 60, 59) val s = totalSeconds + (-3600) * h + (-60) * m

9 Code: val h = lambda val m = mu val val s = totalSeconds + (-3600) * lambda + (-60) * mu h * m * 60 + s == totalSeconds

10 h * m * 60 + s == totalSeconds 10 Resulting formula (new specifications): 0 ≤ λ, 0 ≤ μ, μ ≤ 59, 0 ≤ totalSeconds – 3600λ - 60μ, totalSeconds – 3600λ - 60μ ≤ 59 0 ≤ λ, 0 ≤ μ, μ ≤ 59, 0 ≤ totalSeconds – 3600λ - 60μ, totalSeconds – 3600λ - 60μ ≤ 59

expressing constraints as bounds on μ 0 ≤ λ, 0 ≤ μ, μ ≤ 59, 0 ≤ totalSeconds – 3600λ - 60μ, totalSeconds – 3600λ - 60μ ≤ 59 0 ≤ λ, 0 ≤ μ, μ ≤ 59, 0 ≤ totalSeconds – 3600λ - 60μ, totalSeconds – 3600λ - 60μ ≤ 59 0 ≤ λ, 0 ≤ μ, μ ≤ 59, μ ≤ ⌊ (totalSeconds – 3600λ)/60 ⌋, ⌈ (totalSeconds – 3600λ – 59)/60 ⌉ ≤ μ 0 ≤ λ, 0 ≤ μ, μ ≤ 59, μ ≤ ⌊ (totalSeconds – 3600λ)/60 ⌋, ⌈ (totalSeconds – 3600λ – 59)/60 ⌉ ≤ μ Code: val mu = min(59, (totalSeconds -3600* lambda) div 60) 11

combine each lower and upper bound basic simplifications Code: val lambda = totalSeconds div 3600 Preconditions: 0 ≤ totalSeconds 0 ≤ λ, 0 ≤ μ, μ ≤ 59, μ ≤ ⌊ (totalSeconds – 3600λ)/60 ⌋, ⌈ (totalSeconds – 3600λ – 59)/60 ⌉ ≤ μ 0 ≤ λ, 0 ≤ μ, μ ≤ 59, μ ≤ ⌊ (totalSeconds – 3600λ)/60 ⌋, ⌈ (totalSeconds – 3600λ – 59)/60 ⌉ ≤ μ 0 ≤ λ, 0 ≤ 59, 0 ≤ ⌊ (totalSeconds – 3600λ)/60 ⌋, ⌈ (totalSeconds – 3600λ – 59)/60 ⌉ ≤ ⌊ (totalSeconds – 3600λ)/60 ⌋, ⌈ (totalSeconds – 3600λ – 59)/60 ⌉ ≤ 59 0 ≤ λ, 0 ≤ 59, 0 ≤ ⌊ (totalSeconds – 3600λ)/60 ⌋, ⌈ (totalSeconds – 3600λ – 59)/60 ⌉ ≤ ⌊ (totalSeconds – 3600λ)/60 ⌋, ⌈ (totalSeconds – 3600λ – 59)/60 ⌉ ≤ 59 0 ≤ λ, 60λ ≤ ⌊ totalSeconds /60 ⌋, ⌈ (totalSeconds –59)/60 ⌉ – 59 ≤ 60λ 0 ≤ λ, 60λ ≤ ⌊ totalSeconds /60 ⌋, ⌈ (totalSeconds –59)/60 ⌉ – 59 ≤ 60λ 12

Observation: –Reasoning about collections reduces to reasoning about linear integer arithmetic! 13 a.size == b.size && a union b == bigSet && a intersect b == empty a b bigSet

Observation: –Reasoning about collections reduces to reasoning about linear integer arithmetic! a.size == b.size && a union b == bigSet && a intersect b == empty a b bigSet

Observation: –Reasoning about collections reduces to reasoning about linear integer arithmetic! 15 a.size == b.size && a union b == bigSet && a intersect b == empty a b bigSet

Observation: –Reasoning about collections reduces to reasoning about linear integer arithmetic! 16 a.size == b.size && a union b == bigSet && a intersect b == empty a b bigSet New specification: kA = kB New specification: kA = kB

Observation: –Reasoning about collections reduces to reasoning about linear integer arithmetic! 17 a.size == b.size && a union b == bigSet && a intersect b == empty a b bigSet New specification: kA = kB && kA +kB = |bigSet| New specification: kA = kB && kA +kB = |bigSet|

Automatic code completion Flash Fill feature in the new Microsoft Excell (video!) –Available at: us/um/people/sumitg/flashfillextensions.wmvhttp://research.microsoft.com/en- us/um/people/sumitg/flashfillextensions.wmv

InSynth – a tool for synthesis of code fragments (snippets) –interactive getting results in a short amount of time multiple solutions – a user needs to select –component based assemble program from given components (local values, API) –partial specification hard constraints – type constraints soft constraints - use of components “most likely” to be useful