Precise Program Analysis through (Linear) Algebra

Size: px
Start display at page:

Download "Precise Program Analysis through (Linear) Algebra"

Transcription

1 Precise Program Analysis through (Linear) Algebra Markus Müller-Olm FernUniversität Hagen (on leave from Universität Dortmund) Joint work with Helmut Seidl (TU München) CP+CV 4, Barcelona, March 8, 4 Overview Title, motivation and results Karr s algorithm Interprocedural analysis / linear algebra Intraprocedural analysis / algebra Conclusion CP+CV 4, Barcelona, March 6, 4

2 through (Linear) Algebra Linear Algebra vectors vector spaces, sub-spaces, bases linear maps, matrices vector spaces of matrices Gaussian elimination Algebra rings ideals polynomial rings ideals of polynomial rings Buchberger s Algorithm CP+CV 4, Barcelona, March 6, 4...(Interprocedural) Program Analysis x -x -x -x x -= Main: P: x :=x x :=x + x := x :=x +x + x -x -x = P() P() x -x -x = x :=x -x -x x :=x -x 4 x = 4

3 Some Questions of Interest What is the value of variable x at program exit? Where is x =x? What is the relationship between x,x, and x at program point? affine relations 5x+7y-4= a + a i x i = a i F polynomial relations 5xy +7z -4= p(x,,x k ) = p F[x,,x n ] CP+CV 4, Barcelona, March 6, 4 5 Exact Approximate Analysis Original Problem Abstraction Abstracted Problem approximate Approximate Analysis Algorithm exact CP+CV 4, Barcelona, March 6, 4 6

4 Abstractions of Interest Affine programs (first part): affine assignments: x := x -x +7 unknown assignments: x i :=? abstract too complex statements! non-deterministic instead of guarded branching Polynomial programs (second part): polynomial assignments: x := x x -5x negated polynomial guards: (x -y = ) the rest as for affine programs! CP+CV 4, Barcelona, March 6, 4 7 The Challenge (Precise ) Given an affine program with (recursive) procedures, local variables, parameters, return values, determine all valid affine relations: a + a i x i = a i F determine all valid polynomial relations: p(x,,x k ) = p F[x,,x n ] and all this in polynomial time Weaker goal: determine all polynomial relations of degree d CP+CV 4, Barcelona, March 6, 4 8

5 Infinity Dimensions push-down arithmetic CP+CV 4, Barcelona, March 6, 4 9 Applications Interprocedural analysis: definite equalities: x = y constant propagation: x = 4 discovery of symbolic constants: x = 5yz+7 complex common subexpressions: xy+4 = y +5 loop induction variables Program verification strongest affine or polynomial assertions (cf. Petri Net invariants) CP+CV 4, Barcelona, March 6, 4

6 Intraprocedural Algorithm of Karr = x:= x:= x = x = y = y:= 4 y:= x = x = y = 4 y 4 5 x+y=5 x + y = 5 x x = x:=x+y x = 5 Use a Standard Approach for Interprocedural Generalization of Karr? Functional approach [Sharir/Pnueli, 98], [Knoop/Steffen, 99] Idea: summarize each procedure by function on data flow facts Problem: not applicable Call-string approach [Sharir/Pnueli, 98] Idea: take just a finite piece of run-time stack into account Problem: not exact Relational analysis [Cousot, 977] Idea: summarize each procedure by approximation of I/O relation Problem: not exact (next slide) CP+CV 4, Barcelona, March 6, 4 4

7 Relational Analysis is Not Strong Enough True relational semantics of P: Main: x:= x post P() x= x pre x:=x P: x:= x 4 x:=x- 5 Best affine approximation: x post x pre Overview Title and results Karr s algorithm Interprocedural analysis / linear algebra Intraprocedural analysis / algebra Conclusion CP+CV 4, Barcelona, March 6, 4 6

8 Concrete Semantics of an Execution Path Every execution path π induces an affine transformation of the program state: x: = x+ x + ; x : = x + ( v) x : x ( x: x x ( v) ) = = + = + + v = x : = x + v + v v = v + v

9 Affine Relations An affine relation can be represented by a vector: corresponds to 5 + x x x = a = CP+CV 4, Barcelona, March 6, 4 9 Weakest Precondition of Affine Relations Every execution path π induces a linear transformation of affine post-conditions into their weakest pre-condition: T = + + = + T x : x x ; x : x ( a) T ( ) = x : = x + x + x : = x + ( a) a T a = x: = x+ x + a a a a = a a CP+CV 4, Barcelona, March 6, 4

10 WP of Affine Relations Therefore: = { x x = } x : = x + x + ; x : = x + { x x x = } weakest precondition! CP+CV 4, Barcelona, March 6, 4 Observation Onlythezerorelationisvalid at program start: : +x + +x k = Thus, relation a +a x + +a k x k = is valid at program point v iff M a = for all M {«π T π reaches v}. CP+CV 4, Barcelona, March 6, 4

11 Observation The following statements are equivalent for a: M a = for all M R M a = for all M Span(R) M a = for all M in a basis of Span(R) CP+CV 4, Barcelona, March 6, 4 Observation The set of all affine relations valid at program point v equals th set of solutions of the linear equation system: = Ma, M B where B is a basis of V = Span{«π T π reaches v} (+) it suffices to compute a basis of V! CP+CV 4, Barcelona, March 6, 4 4

12 Observation 4 The set of subspaces of F k k is a complete lattice: Ordering: v = Least element: {} Least upper bound: B tb = Span(B B ) Height: k abstract interpretation techniques apply! α(r) = Span{ «π T π R } R(v) = { π π reaches v } CP+CV 4, Barcelona, March 6, 4 5 Constraint System for Characterizing Execution Paths Executions of base edges: x: = t = { xi : = t} x: =? = x : = d d { i } Same-level executions: Sv { ε} ( ) ventry point S(p) Sv ( ) vreturn point of p Sv ( ) Su ( ); labuv (, ) ( uv, ) base edge S(v) Su ( ); Sp ( ) ( uv, ) calls procedure p Reaching executions: Rv ( ) Sv ( ) vin Main Rv ( ) Rp ( ); Sv ( ) vin p Rp ( ) Ru ( ) ( u,_) calls p

13 Abstract Interpretation (on Bases) I a = + = ak I # x : j a a x Span i i I I = = I I # x j :? Span, # { Mi i I} { Nj j J} = { MN i j i I j J} Span ; Span Span, # { Mi i I} { Nj j J} = ({ Mi i I} { Nj j J} ) Span Span Span Use Gauss elimination for simplifying sets of matrices

14 Theorem In an affine program: The following vector spaces of matrices can be computed precisely: α(r(v)) = Span { «π T π R(v) } for each prg. point v. The vector spaces { a F k+ affine relation a is valid at v } can be computed precisely for all prg. points v. The time complexity is linear in the program size and polynomial in the number of variables: O(n k 8 ) (n size of the program, k number of variables) CP+CV 4, Barcelona, March 6, 4 An Example Main: P: x :=x x :=x + x := x :=x +x + P() P() x :=x -x -x x :=x -x stable! 4 4 =

15 An Example a + ax + ax + ax = is valid at Main: x :=x x := a a a = a and = a a a a a = a = a = a P() x :=x -x -x 4 Span are valid at, Just the affine relations of the form a x a x a x = (a F) Extensions Local variables, value parameters, return values Computing polynomial relations of degree d Affine pre-conditions CP+CV 4, Barcelona, March 6, 4 4

16 Overview Title and results Karr s algorithm Interprocedural analysis / linear algebra Intraprocedural analysis / algebra Conclusion CP+CV 4, Barcelona, March 6, 4 5 Precise Analysis through Algebra Algebra Polynomial rings, ideals, Gröbner bases, Polynomial programs: Polynomial assignments: x := xy 5z Negated polynomial guards: (xy z = ) The rest as for affine programs! Intraprocedural computation of [SAS ] polynomial constants Intraprocedural derivation of [MO/Seidl ] all valid polynomial relations of degree d

17 Negated Polynomial Guards are Useful u v w u:= u = v+ w = v+ v:= w:= v u:=u+ w:=w+ v Note: we need the power of polynomials in order to cope with the guards! Representing other Models Polynomial programs can represent: Petri Nets Vector Addition Systems (VAS) VAS with state polynomial invariants for these models! CP+CV 4, Barcelona, March 6, 4 8

18 A Polynomial Program After n iterations at : x : : = x = q y y q + x : : = y = q x y = n i q = i = n+ = q n+ q q x ( q ) = y x q x y + = (Horner s method) x: = x ( q ) At : x y + = CP+CV 4, Barcelona, March 6, 4 9 Idea Use ideals instead of vector spaces: An ideal I F[x,,x k ] is a set of polynomials with: ) q,q I implies q +q I ) q I implies rq I for all r F[x,,x k ] B F[x,,x n ] generates I iff I = hbi = {r b + +r k b k r,,r k F [x,,x n ], b,,b k B} Intuition: Ideal hp,,p n i captures the `essence of polynomial constraint i=,,n p i (x,,x n )= Problem: no substitute for linear maps: just intra-procedural analysis

19 Observations Hilbert's Basis Theorem: Every polynomial ideal is finitely generated. every ascending chain of polynomial ideals is ultimately stable. iterative least fixpoint computations stabilize. Buchberger s Algorithm allows us to check ideal membership, ideal inclusion, ideal equality. termination can be checked effectively Only the zero ideal hi is valid at program start. Validity of weakest pre-condition checkable. Checking Polynomial Relations x : : = x = q y y q + p : = q q+ = x : : = y = q p : = xq x y+ p : = ( xq + ) q ( xq + ) yq + = q p x: = x ( q ) p : = x y+ CP+CV 4, Barcelona, March 6, 4 46

20 Question: How to infer unknown identities? Idea: Consider generic polynomial! Lemma: p = y x... x ( y fresh variables) Suppose j jk J j,..., jl k j,..., jl ( j,, jk ) J t Then: π t ( π J )[ / ] k p = a x... x ( j,, jk ) J p = p a y j j j,..., jl k Computing Polynomial Relations x : : = x = q y y q + x : : = y = q x: = x ( q ) p : = ( a+ b+ c) q+ ( d a) 4 : = ( + ) + ( ) p a c d q cq d a p : = axq ax + by + cq + d p : axq aq axq a byq cq d q p (( a c d) q cq a d) = = p := ax by cq d a+ b+ c= d a = a+ c d = c= d a= All identities of the form ax ay + a = a = d = b c= are valid.

21 Summary Precise program analysis through (linear) algebra Affine programs: Interprocedural derivation of all valid polynomial relations of degree d (under affine pre-condition) Summarize procedures by linear space of matrices Polynomial programs: Intraprocedural derivation of all valid polynomial relations of degree d Future Challenges Affine & polynomial programs: can we do without a degree bound for polynomial relations? Affine programs: guards? Polynomial programs: interprocedural analysis? complexity bound? Other abstractions CP+CV 4, Barcelona, March 6, 4 5

22 References Seidl, MO: Precise Interprocedural Analysis through Linear Algebra. POPL 4. Seidl, MO: Polynomial constants are decidable. SAS, LNCS 477, pages 4-9. MO: Variations on Constants. Habilitationsschrift, Uni Dortmund,. Seidl, MO: Computing Polynomial Program Invariants. Submitted for publication (TR, FernUniversität Hagen). Rüthing, MO: On the Complexity of Constant Propagation. ESOP. available from: Questions?

A Tutorial on Program Analysis

A Tutorial on Program Analysis A Tutorial on Program Analysis Markus Müller-Olm Dortmund University Thanks! Helmut Seidl (TU München) and Bernhard Steffen (Universität Dortmund) for discussions, inspiration, joint work,... 1 Dream of

More information

Interprocedurally Analyzing Polynomial Identities

Interprocedurally Analyzing Polynomial Identities Interprocedurally Analyzing Polynomial Identities Markus Müller-Olm 1, Michael Petter 2, and Helmut Seidl 2 1 Westfälische Wilhelms-Universität Münster, Institut für Informatik Einsteinstr. 62, 48149 Münster,

More information

Precise Interprocedural Analysis through Linear Algebra

Precise Interprocedural Analysis through Linear Algebra Precise Interprocedural Analysis through Linear Algebra Markus Müller-Olm FernUniversität Hagen, LG Praktische Informatik 5 58084 Hagen, Germany mmo@ls5csuni-dortmundde Helmut Seidl TU München, Lehrstuhl

More information

(Optimal) Program Analysis of Sequential and Parallel Programs

(Optimal) Program Analysis of Sequential and Parallel Programs (Optimal) Program Analysis of Sequential and Parallel Programs Markus Müller-Olm Westfälische Wilhelms-Universität Münster, Germany 3rd Summer School on Verification Technology, Systems, and Applications

More information

Analysis of Modular Arithmetic

Analysis of Modular Arithmetic Analysis of Modular Arithmetic MARKUS MÜLLER-OLM Westfälische Wilhelms-Universität Münster and HELMUT SEIDL TU München We consider integer arithmetic modulo a power of 2 as provided by mainstream programming

More information

Analysis of Modular Arithmetic

Analysis of Modular Arithmetic Analysis of Modular Arithmetic Markus Müller-Olm 1 and Helmut Seidl 2 1 Universität Dortmund, Fachbereich Informatik, LS 5 Baroper Str. 301, 44221 Dortmund, Germany markus.mueller-olm@cs.uni-dortmund.de

More information

Fundamentals of Program Analysis + Generation of Linear Prg. Invariants

Fundamentals of Program Analysis + Generation of Linear Prg. Invariants Fundamentals of Program Analysis + Generation of Linear Prg. Invariants Markus Müller-Olm Westfälische Wilhelms-Universität Münster, Germany 2nd Tutorial of SPP RS3: Reliably Secure Software Systems Schloss

More information

Polynomial Constants are Decidable

Polynomial Constants are Decidable Polynomial Constants are Decidable Markus Müller-Olm 1 and Helmut Seidl 2 1 University of Dortmund, FB 4, LS5, 44221 Dortmund, Germany mmo@ls5.cs.uni-dortmund.de 2 Trier University, FB 4-Informatik, 54286

More information

Analysis of Modular Arithmetic

Analysis of Modular Arithmetic Analysis of Modular Arithmetic MARKUS MÜLLER-OLM Westfälische Wilhelms-Universität Münster and HELMUT SEIDL TU München We consider integer arithmetic modulo a power of 2 as provided by mainstream programming

More information

Automatic Generation of Polynomial Invariants for System Verification

Automatic Generation of Polynomial Invariants for System Verification Automatic Generation of Polynomial Invariants for System Verification Enric Rodríguez-Carbonell Technical University of Catalonia Talk at EPFL Nov. 2006 p.1/60 Plan of the Talk Introduction Need for program

More information

Analysing All Polynomial Equations in Z 2

Analysing All Polynomial Equations in Z 2 Analysing All Polynomial Equations in Z 2 w Helmut Seidl, Andrea Flexeder and Michael Petter Technische Universität München, Boltzmannstrasse 3, 85748 Garching, Germany, {seidl, flexeder, petter}@cs.tum.edu,

More information

Generation of. Polynomial Equality Invariants. by Abstract Interpretation

Generation of. Polynomial Equality Invariants. by Abstract Interpretation Generation of Polynomial Equality Invariants by Abstract Interpretation Enric Rodríguez-Carbonell Universitat Politècnica de Catalunya (UPC) Barcelona Joint work with Deepak Kapur (UNM) 1 Introduction

More information

Generating All Polynomial Invariants in Simple Loops

Generating All Polynomial Invariants in Simple Loops Generating All Polynomial Invariants in Simple Loops E. Rodríguez-Carbonell a,, D. Kapur b a Software Department, Technical University of Catalonia, Jordi Girona, 1-3 08034 Barcelona (Spain) b Department

More information

Computing Procedure Summaries for Interprocedural Analysis

Computing Procedure Summaries for Interprocedural Analysis Computing Procedure Summaries for Interprocedural Analysis Sumit Gulwani 1 and Ashish Tiwari 2 1 Microsoft Research, Redmond, WA 98052, sumitg@microsoft.com 2 SRI International, Menlo Park, CA 94025, tiwari@csl.sri.com

More information

An Abstract Interpretation Approach. for Automatic Generation of. Polynomial Invariants

An Abstract Interpretation Approach. for Automatic Generation of. Polynomial Invariants An Abstract Interpretation Approach for Automatic Generation of Polynomial Invariants Enric Rodríguez-Carbonell Universitat Politècnica de Catalunya Barcelona Deepak Kapur University of New Mexico Albuquerque

More information

Lecture Notes: Axiomatic Semantics and Hoare-style Verification

Lecture Notes: Axiomatic Semantics and Hoare-style Verification Lecture Notes: Axiomatic Semantics and Hoare-style Verification 17-355/17-665/17-819O: Program Analysis (Spring 2018) Claire Le Goues and Jonathan Aldrich clegoues@cs.cmu.edu, aldrich@cs.cmu.edu It has

More information

Precise Relational Invariants Through Strategy Iteration

Precise Relational Invariants Through Strategy Iteration Precise Relational Invariants Through Strategy Iteration Thomas Gawlitza and Helmut Seidl TU München, Institut für Informatik, I2 85748 München, Germany {gawlitza, seidl}@in.tum.de Abstract. We present

More information

Invariant Generation for P-solvable Loops with Assignments

Invariant Generation for P-solvable Loops with Assignments Invariant Generation for P-solvable Loops with Assignments Laura Kovács EPFL, Swizterland laura.kovacs@epfl.ch Abstract. We discuss interesting properties of a general technique for inferring polynomial

More information

Precise Interprocedural Analysis using Random Interpretation

Precise Interprocedural Analysis using Random Interpretation Precise Interprocedural Analysis using Random Interpretation Sumit Gulwani gulwani@cs.berkeley.edu George C. Necula necula@cs.berkeley.edu Department of Electrical Engineering and Computer Science University

More information

Automatic Generation of Polynomial Loop Invariants: Algebraic Foundations

Automatic Generation of Polynomial Loop Invariants: Algebraic Foundations Automatic Generation of Polynomial Loop Invariants: Algebraic Foundations Enric Rodríguez-Carbonell LSI Department Technical University of Catalonia Barcelona, Spain erodri@lsi.upc.es Deepak Kapur Department

More information

The Assignment Axiom (Hoare)

The Assignment Axiom (Hoare) The Assignment Axiom (Hoare) Syntax: V := E Semantics: value of V in final state is value of E in initial state Example: X:=X+ (adds one to the value of the variable X) The Assignment Axiom {Q[E/V ]} V

More information

Generation of Basic Semi-algebraic Invariants Using Convex Polyhedra

Generation of Basic Semi-algebraic Invariants Using Convex Polyhedra Generation of Basic Semi-algebraic Invariants Using Convex Polyhedra Generation of Invariant Conjunctions of Polynomial Inequalities Using Convex Polyhedra R. Bagnara 1, E. Rodríguez-Carbonell 2, E. Zaffanella

More information

Lecture 15: Algebraic Geometry II

Lecture 15: Algebraic Geometry II 6.859/15.083 Integer Programming and Combinatorial Optimization Fall 009 Today... Ideals in k[x] Properties of Gröbner bases Buchberger s algorithm Elimination theory The Weak Nullstellensatz 0/1-Integer

More information

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics

Dynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics Dynamic Semantics Operational Semantics Denotational Semantic Dynamic Semantics Operational Semantics Operational Semantics Describe meaning by executing program on machine Machine can be actual or simulated

More information

Constraint-Based Static Analysis of Programs

Constraint-Based Static Analysis of Programs Constraint-Based Static Analysis of Programs Joint work with Michael Colon, Sriram Sankaranarayanan, Aaron Bradley and Zohar Manna Henny Sipma Stanford University Master Class Seminar at Washington University

More information

Introduction to Kleene Algebras

Introduction to Kleene Algebras Introduction to Kleene Algebras Riccardo Pucella Basic Notions Seminar December 1, 2005 Introduction to Kleene Algebras p.1 Idempotent Semirings An idempotent semiring is a structure S = (S, +,, 1, 0)

More information

Program Analysis Part I : Sequential Programs

Program Analysis Part I : Sequential Programs Program Analysis Part I : Sequential Programs IN5170/IN9170 Models of concurrency Program Analysis, lecture 5 Fall 2018 26. 9. 2018 2 / 44 Program correctness Is my program correct? Central question for

More information

INTER-PROCEDURAL TWO-VARIABLE HERBRAND EQUALITIES

INTER-PROCEDURAL TWO-VARIABLE HERBRAND EQUALITIES Logical Methods in Computer Science Vol 13(2:5)2017, pp 1 40 wwwlmcs-onlineorg Submitted Nov 18, 2015 Published May 12, 2017 INTER-PROCEDURAL TWO-VARIABLE HERBRAND EQUALITIES STEFAN SCHULZE FRIELINGHAUS,

More information

Axiomatic Semantics. Hoare s Correctness Triplets Dijkstra s Predicate Transformers

Axiomatic Semantics. Hoare s Correctness Triplets Dijkstra s Predicate Transformers Axiomatic Semantics Hoare s Correctness Triplets Dijkstra s Predicate Transformers Goal of a program = IO Relation Problem Specification Properties satisfied by the input and expected of the output (usually

More information

Abstract Domains of Affine Relations

Abstract Domains of Affine Relations Abstract Domains of Affine Relations MATT ELDER, University of Wisconsin JUNGHEE LIM, University of Wisconsin TUSHAR SHARMA, University of Wisconsin TYCHO ANDERSEN, University of Wisconsin THOMAS REPS,

More information

Program verification using Hoare Logic¹

Program verification using Hoare Logic¹ Program verification using Hoare Logic¹ Automated Reasoning - Guest Lecture Petros Papapanagiotou Part 2 of 2 ¹Contains material from Mike Gordon s slides: Previously on Hoare Logic A simple while language

More information

In this episode of The Verification Corner, Rustan Leino talks about Loop Invariants. He gives a brief summary of the theoretical foundations and

In this episode of The Verification Corner, Rustan Leino talks about Loop Invariants. He gives a brief summary of the theoretical foundations and In this episode of The Verification Corner, Rustan Leino talks about Loop Invariants. He gives a brief summary of the theoretical foundations and shows how a program can sometimes be systematically constructed

More information

Precise Interprocedural Analysis using Random Interpretation (Revised version )

Precise Interprocedural Analysis using Random Interpretation (Revised version ) Precise Interprocedural Analysis using Random Interpretation (Revised version ) Sumit Gulwani gulwani@cs.berkeley.edu George C. Necula necula@cs.berkeley.edu Report No. UCB/CSD-4-1353 August 2005 Computer

More information

Using Symbolic Summation and Polynomial Algebra for Imperative Program Verification in Theorema 1

Using Symbolic Summation and Polynomial Algebra for Imperative Program Verification in Theorema 1 Using Symbolic Summation and Polynomial Algebra for Imperative Program Verification in Theorema 1 Laura Kovács, Tudor Jebelean a and Deepak Kapur b a Research Institute for Symbolic Computation, Johannes

More information

Flow grammars a flow analysis methodology

Flow grammars a flow analysis methodology Flow grammars a flow analysis methodology James S. Uhl and R. Nigel Horspool Dept. of Computer Science, University of Victoria P.O. Box 3055, Victoria, BC, Canada V8W 3P6 E-mail: juhl@csr.uvic.ca, nigelh@csr.uvic.ca

More information

Spring 2015 Program Analysis and Verification. Lecture 6: Axiomatic Semantics III. Roman Manevich Ben-Gurion University

Spring 2015 Program Analysis and Verification. Lecture 6: Axiomatic Semantics III. Roman Manevich Ben-Gurion University Spring 2015 Program Analysis and Verification Lecture 6: Axiomatic Semantics III Roman Manevich Ben-Gurion University Tentative syllabus Semantics Static Analysis Abstract Interpretation fundamentals Analysis

More information

Constraint Solving for Program Verification: Theory and Practice by Example

Constraint Solving for Program Verification: Theory and Practice by Example Constraint Solving for Program Verification: Theory and Practice by Example Andrey Rybalchenko Technische Universität München Abstract. Program verification relies on the construction of auxiliary assertions

More information

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples Hoare Logic I Introduction to Deductive Program Verification Işıl Dillig Program Spec Deductive verifier FOL formula Theorem prover valid contingent Example specs: safety (no crashes), absence of arithmetic

More information

Formal Methods in Software Engineering

Formal Methods in Software Engineering Formal Methods in Software Engineering An Introduction to Model-Based Analyis and Testing Vesal Vojdani Department of Computer Science University of Tartu Fall 2014 Vesal Vojdani (University of Tartu)

More information

Axiomatic Semantics. Lecture 9 CS 565 2/12/08

Axiomatic Semantics. Lecture 9 CS 565 2/12/08 Axiomatic Semantics Lecture 9 CS 565 2/12/08 Axiomatic Semantics Operational semantics describes the meaning of programs in terms of the execution steps taken by an abstract machine Denotational semantics

More information

CS156: The Calculus of Computation Zohar Manna Autumn 2008

CS156: The Calculus of Computation Zohar Manna Autumn 2008 Page 3 of 52 Page 4 of 52 CS156: The Calculus of Computation Zohar Manna Autumn 2008 Lecturer: Zohar Manna (manna@cs.stanford.edu) Office Hours: MW 12:30-1:00 at Gates 481 TAs: Boyu Wang (wangboyu@stanford.edu)

More information

Hoare Calculus and Predicate Transformers

Hoare Calculus and Predicate Transformers Hoare Calculus and Predicate Transformers Wolfgang Schreiner Wolfgang.Schreiner@risc.uni-linz.ac.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.uni-linz.ac.at

More information

Polynomial Precise Interval Analysis Revisited

Polynomial Precise Interval Analysis Revisited Polynomial Precise Interval Analysis Revisited Thomas Gawlitza 1, Jérôme Leroux 2, Jan Reineke 3, Helmut Seidl 1, Grégoire Sutre 2, and Reinhard Wilhelm 3 1 TU München, Institut für Informatik, I2 80333

More information

[3] (b) Find a reduced row-echelon matrix row-equivalent to ,1 2 2

[3] (b) Find a reduced row-echelon matrix row-equivalent to ,1 2 2 MATH Key for sample nal exam, August 998 []. (a) Dene the term \reduced row-echelon matrix". A matrix is reduced row-echelon if the following conditions are satised. every zero row lies below every nonzero

More information

NOTES ON LINEAR ALGEBRA OVER INTEGRAL DOMAINS. Contents. 1. Introduction 1 2. Rank and basis 1 3. The set of linear maps 4. 1.

NOTES ON LINEAR ALGEBRA OVER INTEGRAL DOMAINS. Contents. 1. Introduction 1 2. Rank and basis 1 3. The set of linear maps 4. 1. NOTES ON LINEAR ALGEBRA OVER INTEGRAL DOMAINS Contents 1. Introduction 1 2. Rank and basis 1 3. The set of linear maps 4 1. Introduction These notes establish some basic results about linear algebra over

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be

More information

Introduction to Gröbner Bases for Geometric Modeling. Geometric & Solid Modeling 1989 Christoph M. Hoffmann

Introduction to Gröbner Bases for Geometric Modeling. Geometric & Solid Modeling 1989 Christoph M. Hoffmann Introduction to Gröbner Bases for Geometric Modeling Geometric & Solid Modeling 1989 Christoph M. Hoffmann Algebraic Geometry Branch of mathematics. Express geometric facts in algebraic terms in order

More information

CS156: The Calculus of Computation

CS156: The Calculus of Computation CS156: The Calculus of Computation Zohar Manna Winter 2010 It is reasonable to hope that the relationship between computation and mathematical logic will be as fruitful in the next century as that between

More information

A QUANTIFIER-ELIMINATION BASED HEURISTIC FOR AUTOMATICALLY GENERATING INDUCTIVE ASSERTIONS FOR PROGRAMS

A QUANTIFIER-ELIMINATION BASED HEURISTIC FOR AUTOMATICALLY GENERATING INDUCTIVE ASSERTIONS FOR PROGRAMS Jrl Syst Sci & Complexity (2006) 19: 1 24 A QUANTIFIER-ELIMINATION BASED HEURISTIC FOR AUTOMATICALLY GENERATING INDUCTIVE ASSERTIONS FOR PROGRAMS Deepak KAPUR Received: 8 June 2006 c 2006 Springer Science

More information

Axiomatic Semantics: Verification Conditions. Review of Soundness of Axiomatic Semantics. Questions? Announcements

Axiomatic Semantics: Verification Conditions. Review of Soundness of Axiomatic Semantics. Questions? Announcements Axiomatic Semantics: Verification Conditions Meeting 18, CSCI 5535, Spring 2010 Announcements Homework 6 is due tonight Today s forum: papers on automated testing using symbolic execution Anyone looking

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-18/spa/ Recap: Interprocedural Dataflow Analysis Outline of

More information

Chapter y. 8. n cd (x y) 14. (2a b) 15. (a) 3(x 2y) = 3x 3(2y) = 3x 6y. 16. (a)

Chapter y. 8. n cd (x y) 14. (2a b) 15. (a) 3(x 2y) = 3x 3(2y) = 3x 6y. 16. (a) Chapter 6 Chapter 6 opener A. B. C. D. 6 E. 5 F. 8 G. H. I. J.. 7. 8 5. 6 6. 7. y 8. n 9. w z. 5cd.. xy z 5r s t. (x y). (a b) 5. (a) (x y) = x (y) = x 6y x 6y = x (y) = (x y) 6. (a) a (5 a+ b) = a (5

More information

Axiomatic Semantics: Verification Conditions. Review of Soundness and Completeness of Axiomatic Semantics. Announcements

Axiomatic Semantics: Verification Conditions. Review of Soundness and Completeness of Axiomatic Semantics. Announcements Axiomatic Semantics: Verification Conditions Meeting 12, CSCI 5535, Spring 2009 Announcements Homework 4 is due tonight Wed forum: papers on automated testing using symbolic execution 2 Questions? Review

More information

Programming Languages and Compilers (CS 421)

Programming Languages and Compilers (CS 421) Programming Languages and Compilers (CS 421) Sasa Misailovic 4110 SC, UIUC https://courses.engr.illinois.edu/cs421/fa2017/cs421a Based in part on slides by Mattox Beckman, as updated by Vikram Adve, Gul

More information

where m is the maximal ideal of O X,p. Note that m/m 2 is a vector space. Suppose that we are given a morphism

where m is the maximal ideal of O X,p. Note that m/m 2 is a vector space. Suppose that we are given a morphism 8. Smoothness and the Zariski tangent space We want to give an algebraic notion of the tangent space. In differential geometry, tangent vectors are equivalence classes of maps of intervals in R into the

More information

Spring 2014 Program Analysis and Verification. Lecture 6: Axiomatic Semantics III. Roman Manevich Ben-Gurion University

Spring 2014 Program Analysis and Verification. Lecture 6: Axiomatic Semantics III. Roman Manevich Ben-Gurion University Spring 2014 Program Analysis and Verification Lecture 6: Axiomatic Semantics III Roman Manevich Ben-Gurion University Syllabus Semantics Static Analysis Abstract Interpretation fundamentals Analysis Techniques

More information

PUSHDOWN AUTOMATA (PDA)

PUSHDOWN AUTOMATA (PDA) PUSHDOWN AUTOMATA (PDA) FINITE STATE CONTROL INPUT STACK (Last in, first out) input pop push ε,ε $ 0,ε 0 1,0 ε ε,$ ε 1,0 ε PDA that recognizes L = { 0 n 1 n n 0 } Definition: A (non-deterministic) PDA

More information

Floyd-Hoare Style Program Verification

Floyd-Hoare Style Program Verification Floyd-Hoare Style Program Verification Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 9 Feb 2017 Outline of this talk 1 Overview 2 Hoare Triples 3

More information

Deductive Verification

Deductive Verification Deductive Verification Mooly Sagiv Slides from Zvonimir Rakamaric First-Order Logic A formal notation for mathematics, with expressions involving Propositional symbols Predicates Functions and constant

More information

Program verification. 18 October 2017

Program verification. 18 October 2017 Program verification 18 October 2017 Example revisited // assume(n>2); void partition(int a[], int n) { int pivot = a[0]; int lo = 1, hi = n-1; while (lo

More information

Static Program Analysis using Abstract Interpretation

Static Program Analysis using Abstract Interpretation Static Program Analysis using Abstract Interpretation Introduction Static Program Analysis Static program analysis consists of automatically discovering properties of a program that hold for all possible

More information

Introduction to Abstract Interpretation. ECE 584 Sayan Mitra Lecture 18

Introduction to Abstract Interpretation. ECE 584 Sayan Mitra Lecture 18 Introduction to Abstract Interpretation ECE 584 Sayan Mitra Lecture 18 References Patrick Cousot,RadhiaCousot:Abstract Interpretation: A Unified Lattice Model for Static Analysis of Programs by Construction

More information

Precise Fixpoint-Based Analysis of Programs with Thread-Creation and Procedures

Precise Fixpoint-Based Analysis of Programs with Thread-Creation and Procedures Precise Fixpoint-Based Analysis of Programs with Thread-Creation and Procedures Peter Lammich and Markus Müller-Olm Institut für Informatik, Fachbereich Mathematik und Informatik Westfälische Wilhelms-Universität

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Chomsky Normal Form and TURING MACHINES TUESDAY Feb 4 CHOMSKY NORMAL FORM A context-free grammar is in Chomsky normal form if every rule is of the form:

More information

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions Chapter 1 Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions 1.1 The IMP Language IMP is a programming language with an extensible syntax that was developed in the late 1960s. We will

More information

Groebner Bases and Applications

Groebner Bases and Applications Groebner Bases and Applications Robert Hines December 16, 2014 1 Groebner Bases In this section we define Groebner Bases and discuss some of their basic properties, following the exposition in chapter

More information

Model Checking & Program Analysis

Model Checking & Program Analysis Model Checking & Program Analysis Markus Müller-Olm Dortmund University Overview Introduction Model Checking Flow Analysis Some Links between MC and FA Conclusion Apology for not giving proper credit to

More information

Polynomials, Ideals, and Gröbner Bases

Polynomials, Ideals, and Gröbner Bases Polynomials, Ideals, and Gröbner Bases Notes by Bernd Sturmfels for the lecture on April 10, 2018, in the IMPRS Ringvorlesung Introduction to Nonlinear Algebra We fix a field K. Some examples of fields

More information

SCICO: Model pp (col. fig: NIL) ARTICLE IN PRESS

SCICO: Model pp (col. fig: NIL) ARTICLE IN PRESS + Model pp. (col. fig: NIL) Science of Computer Programming xx (xxxx) xxx xxx www.elsevier.com/locate/scico Automatic generation of polynomial invariants of bounded degree using abstract interpretation

More information

Abstract Interpretation from a Topological Perspective

Abstract Interpretation from a Topological Perspective (-: / 1 Abstract Interpretation from a Topological Perspective David Schmidt Kansas State University www.cis.ksu.edu/ schmidt Motivation and overview of results (-: / 2 (-: / 3 Topology studies convergent

More information

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11.

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11. Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 1 Overview We ll develop proof rules, such as: { I b } S { I } { I } while b do S end { I b } That allow us to verify

More information

Semantics and Verification of Software

Semantics and Verification of Software Semantics and Verification of Software Thomas Noll Software Modeling and Verification Group RWTH Aachen University http://moves.rwth-aachen.de/teaching/ss-15/sv-sw/ The Denotational Approach Denotational

More information

Constraint Solving for Program Verification: Theory and Practice by Example

Constraint Solving for Program Verification: Theory and Practice by Example Constraint Solving for Program Verification: Theory and Practice by Example Andrey Rybalchenko Technische Universität München Abstract. Program verification relies on the construction of auxiliary assertions

More information

ALGEBRAIC METHODS OF AUTOMATED REASONING IN MONADIC LOGIC by José A. Alonso in Sevilla (Spain)

ALGEBRAIC METHODS OF AUTOMATED REASONING IN MONADIC LOGIC by José A. Alonso in Sevilla (Spain) ALGEBRAIC METHODS OF AUTOMATED REASONING IN MONADIC LOGIC by José A. Alonso in Sevilla (Spain) Introduction The purpose of this paper is to explain how the theory of Gröbner bases can be used for automated

More information

Math 203A - Solution Set 1

Math 203A - Solution Set 1 Math 203A - Solution Set 1 Problem 1. Show that the Zariski topology on A 2 is not the product of the Zariski topologies on A 1 A 1. Answer: Clearly, the diagonal Z = {(x, y) : x y = 0} A 2 is closed in

More information

An Abstract Domain to Infer Ordinal-Valued Ranking Functions

An Abstract Domain to Infer Ordinal-Valued Ranking Functions An Abstract Domain to Infer Ordinal-Valued Ranking Functions Caterina Urban and Antoine Miné ÉNS & CNRS & INRIA, Paris, France urban@di.ens.fr, mine@di.ens.fr Abstract. The traditional method for proving

More information

Program Analysis and Verification

Program Analysis and Verification Program Analysis and Verification 0368-4479 Noam Rinetzky Lecture 4: Axiomatic Semantics Slides credit: Tom Ball, Dawson Engler, Roman Manevich, Erik Poll, Mooly Sagiv, Jean Souyris, Eran Tromer, Avishai

More information

Algebra C Numerical Linear Algebra Sample Exam Problems

Algebra C Numerical Linear Algebra Sample Exam Problems Algebra C Numerical Linear Algebra Sample Exam Problems Notation. Denote by V a finite-dimensional Hilbert space with inner product (, ) and corresponding norm. The abbreviation SPD is used for symmetric

More information

Outline. Complexity Theory. Example. Sketch of a log-space TM for palindromes. Log-space computations. Example VU , SS 2018

Outline. Complexity Theory. Example. Sketch of a log-space TM for palindromes. Log-space computations. Example VU , SS 2018 Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 3. Logarithmic Space Reinhard Pichler Institute of Logic and Computation DBAI Group TU Wien 3. Logarithmic Space 3.1 Computational

More information

Program verification. Hoare triples. Assertional semantics (cont) Example: Semantics of assignment. Assertional semantics of a program

Program verification. Hoare triples. Assertional semantics (cont) Example: Semantics of assignment. Assertional semantics of a program Program verification Assertional semantics of a program Meaning of a program: relation between its inputs and outputs; specified by input assertions (pre-conditions) and output assertions (post-conditions)

More information

4.4 Noetherian Rings

4.4 Noetherian Rings 4.4 Noetherian Rings Recall that a ring A is Noetherian if it satisfies the following three equivalent conditions: (1) Every nonempty set of ideals of A has a maximal element (the maximal condition); (2)

More information

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4 Chomsky Normal Form and TURING MACHINES TUESDAY Feb 4 CHOMSKY NORMAL FORM A context-free grammar is in Chomsky normal form if every rule is of the form: A BC A a S ε B and C aren t start variables a is

More information

Introduction. Pedro Cabalar. Department of Computer Science University of Corunna, SPAIN 2013/2014

Introduction. Pedro Cabalar. Department of Computer Science University of Corunna, SPAIN 2013/2014 Introduction Pedro Cabalar Department of Computer Science University of Corunna, SPAIN cabalar@udc.es 2013/2014 P. Cabalar ( Department Introduction of Computer Science University of Corunna, SPAIN2013/2014

More information

Properties of Context-Free Languages. Closure Properties Decision Properties

Properties of Context-Free Languages. Closure Properties Decision Properties Properties of Context-Free Languages Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms

More information

Computational Models - Lecture 3

Computational Models - Lecture 3 Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models - Lecture 3 Equivalence of regular expressions and regular languages (lukewarm leftover

More information

Proofs of Correctness: Introduction to Axiomatic Verification

Proofs of Correctness: Introduction to Axiomatic Verification Proofs of Correctness: Introduction to Axiomatic Verification Introduction Weak correctness predicate Assignment statements Sequencing Selection statements Iteration 1 Introduction What is Axiomatic Verification?

More information

Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition

Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition Salil Vadhan October 11, 2012 Reading: Sipser, Section 2.3 and Section 2.1 (material on Chomsky Normal Form). Pumping Lemma for

More information

Smoothing a Program Soundly and Robustly

Smoothing a Program Soundly and Robustly Smoothing a Program Soundly and Robustly Swarat Chaudhuri 1 and Armando Solar-Lezama 2 1 Rice University 2 MIT Abstract. We study the foundations of smooth interpretation, a recentlyproposed program approximation

More information

Hoare Logic: Part II

Hoare Logic: Part II Hoare Logic: Part II COMP2600 Formal Methods for Software Engineering Jinbo Huang Australian National University COMP 2600 Hoare Logic II 1 Factorial {n 0} fact := 1; i := n; while (i >0) do fact := fact

More information

Combining Logic and Algebraic Techniques for Program Verification in Theorema

Combining Logic and Algebraic Techniques for Program Verification in Theorema Second International Symposium on Leveraging Applications of Formal Methods, Verification and Validation Combining Logic and Algebraic Techniques for Program Verification in Theorema Laura Kovács, Nikolaj

More information

Matrix Factorization and Analysis

Matrix Factorization and Analysis Chapter 7 Matrix Factorization and Analysis Matrix factorizations are an important part of the practice and analysis of signal processing. They are at the heart of many signal-processing algorithms. Their

More information

2. Intersection Multiplicities

2. Intersection Multiplicities 2. Intersection Multiplicities 11 2. Intersection Multiplicities Let us start our study of curves by introducing the concept of intersection multiplicity, which will be central throughout these notes.

More information

Automatic Generation of Polynomial Invariants of Bounded Degree using Abstract Interpretation

Automatic Generation of Polynomial Invariants of Bounded Degree using Abstract Interpretation Automatic Generation of Polynomial Invariants of Bounded Degree using Abstract Interpretation E. Rodríguez-Carbonell a,, D. Kapur b a Software Department, Technical University of Catalonia, Jordi Girona,

More information

Ultimate approximation and its application in nonmonotonic knowledge representation systems

Ultimate approximation and its application in nonmonotonic knowledge representation systems Ultimate approximation and its application in nonmonotonic knowledge representation systems Marc Denecker a a Department of Computer Science, K.U.Leuven Celestijnenlaan 200A, B-3001 Heverlee Département

More information

Global Value Numbering using Random Interpretation

Global Value Numbering using Random Interpretation Global Value Numbering using Random Interpretation Sumit Gulwani gulwani@cs.berkeley.edu George C. Necula necula@cs.berkeley.edu Department of Electrical Engineering and Computer Science University of

More information

Unifying Theories of Programming

Unifying Theories of Programming 1&2 Unifying Theories of Programming Unifying Theories of Programming 3&4 Theories Unifying Theories of Programming designs predicates relations reactive CSP processes Jim Woodcock University of York May

More information

Logical Abstract Domains and Interpretations

Logical Abstract Domains and Interpretations Logical Abstract Domains and Interpretations Patrick Cousot 2,3, Radhia Cousot 3,1, and Laurent Mauborgne 3,4 1 Centre National de la Recherche Scientifique, Paris 2 Courant Institute of Mathematical Sciences,

More information

5.6. PSEUDOINVERSES 101. A H w.

5.6. PSEUDOINVERSES 101. A H w. 5.6. PSEUDOINVERSES 0 Corollary 5.6.4. If A is a matrix such that A H A is invertible, then the least-squares solution to Av = w is v = A H A ) A H w. The matrix A H A ) A H is the left inverse of A and

More information

Join Algorithms for the Theory of Uninterpreted Functions

Join Algorithms for the Theory of Uninterpreted Functions Join Algorithms for the Theory of Uninterpreted Functions Sumit Gulwani 1, Ashish Tiwari 2, and George C. Necula 1 1 University of California, Berkeley, CA 94720, {gulwani,necula}@cs.berkeley.edu 2 SRI

More information