Static Program Analysis

Size: px
Start display at page:

Download "Static Program Analysis"

Transcription

1 Static Program Analysis Lecture 16: Abstract Interpretation VI (Counterexample-Guided Abstraction Refinement) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de Winter Semester 2014/15

2 Oral Exam in Static Program Analysis Options: Thu 12 March Tue 24 March Thu 26 March Wed 08 April Registration via Exam-Static-Program-Analysis (accessible through Static Program Analysis Winter Semester 2014/

3 Outline 1 Recap: Predicate Abstraction 2 Additional Remarks 3 Counterexample-Guided Abstraction Refinement Static Program Analysis Winter Semester 2014/

4 Predicate Abstraction I Definition (Predicate abstraction) Let Var be a set of variables. A predicate is a Boolean expression p BExp over Var. A state σ Σ satisfies p BExp (σ = p) if val σ (p) = true. p implies q (p = q) if σ = q whenever σ = p (or: p is stronger than q, q is weaker than p). p and q are equivalent (p q) if p = q and q = p. Let P = {p 1,..., p n } BExp be a finite set of predicates, and let P := { p 1,..., p n }. An element of P P is called a literal. The predicate abstraction lattice is defined by: ({ } ) Abs(p 1,..., p n ) := Q Q P P, =. Abbreviations: true :=, false := {p i, p i,...} Static Program Analysis Winter Semester 2014/

5 Predicate Abstraction II Lemma Abs(p 1,..., p n ) is a complete lattice with = false, = true Q 1 Q 2 = Q 1 Q 2 Q 1 Q 2 = Q 1 Q 2 where b := {q P P b = q} (i.e., strongest formula in Abs(p 1,..., p n ) that is implied by Q 1 Q 2 ) Example Let P := {p 1, p 2, p 3 }. 1 For Q 1 := p 1 p 2 and Q 2 := p 2 p 3, we obtain Q 1 Q 2 = Q 1 Q 2 p 1 p 2 p 3 Q 1 Q 2 = Q 1 Q 2 p 2 (p 1 p 3 ) p 2 2 For Q 1 := p 1 p 2 and Q 2 := p 1 p 2, we obtain Q 1 Q 2 = Q 1 Q 2 false Q 1 Q 2 = Q 1 Q 2 p 1 (p 2 p 2 ) p 1 Static Program Analysis Winter Semester 2014/

6 Predicate Abstraction III Definition (Galois connection for predicate abstraction) The Galois connection for predicate abstraction is determined by with α : 2 Σ Abs(p 1,..., p n ) and γ : Abs(p 1,..., p n ) 2 Σ α(s) := {Q σ σ S} and γ(q) := {σ Σ σ = Q} where Q σ := ({p i 1 i n, σ = p i } { p i 1 i n, σ = p i }). Example Let Var := {x, y} Let P := {p 1, p 2, p 3 } where p 1 := (x<=y), p 2 := (x=y), p 3 := (x>y) If S = {σ 1, σ 2 } Σ with σ 1 = [x 1, y 2], σ 2 = [x 2, y 2], then α(s) = Q σ1 Q σ2 = (p 1 p 2 p 3 ) (p 1 p 2 p 3 ) = (p 1 p 2 p 3 ) (p 1 p 2 p 3 ) p 1 p 3 If Q = p 1 p 2 Abs(p 1,..., p n ), then γ(q) = {σ Σ σ(x) < σ(y)} Static Program Analysis Winter Semester 2014/

7 Abstract Semantics for Predicate Abstraction I Definition (Execution relation for predicate abstraction) If c Cmd and Q Abs(p 1,..., p n ), then c, Q is called an abstract configuration. The execution relation for predicate abstraction is defined by the following rules: (skip) skip, Q, Q (asgn) x := a, Q, {Qσ[x val σ(a)] σ = Q} (seq1) c 1, Q c 1, Q c 1 c 1 ;c 2, Q c 1 ;c 2, Q (seq2) c 1, Q, Q c 1 ;c 2, Q c 2, Q (if1) if b then c1 else c 2, Q c 1, Q b (if2) if b then c1 else c 2, Q c 2, Q b (wh1) while b do c, Q c;while b do c, Q b (wh2) while b do c, Q, Q b Static Program Analysis Winter Semester 2014/

8 Outline 1 Recap: Predicate Abstraction 2 Additional Remarks 3 Counterexample-Guided Abstraction Refinement Static Program Analysis Winter Semester 2014/

9 Additional Remarks In Rules (if1, (if2), (wh1), (wh2), the fact that b = p i for some i {1,..., n} implies Q [ ]b Abs(p 1,..., p n ), but not Q [ ]b = Q [ ]b Example 16.1 (cf. Example 15.7) p 1 := (x > y), p 2 := (x >= y) Q := true, b := p 1 Q b = p 1 p 2 Q b = p 1 For similar reasons, generally Q 1 Q 2 (= Q 1 Q 2 ) Q 1 Q 2 Example 16.2 p 1 := (x > y), p 2 := (x >= y), p 3 := (x = y) Q 1 := p 1 p 2 p 3 ( x > y), Q 2 := p 3 ( x = y) Q 1 Q 2 = Q 1 Q 2 = p 2 Q 1 Q 2 = true Static Program Analysis Winter Semester 2014/

10 Computation of Postconditions Problem: b = {q P P b = q} (i.e., the strongest formula in Abs(p 1,..., p n ) that is implied by b) is generally not computable (due to undecidability of implication in certain logics) Solutions: Over-approximation: fall back to non-strongest postconditions in practice, (automatic) theorem proving for every i {1,..., n}, try to prove b = p i and b = p i approximate b by conjunction of all provable literals Restriction of programs: = decidable for certain logics example: Presburger arithmetic (first-order theory of N with +) thus b computable for WHILE programs without multiplication Restriction to finite domains: for example, binary numbers of fixed size thus everything (domain, Galois connection,...) exactly computable problem: exponential blowup = solution: Binary Decision Diagrams Static Program Analysis Winter Semester 2014/

11 Outline 1 Recap: Predicate Abstraction 2 Additional Remarks 3 Counterexample-Guided Abstraction Refinement Static Program Analysis Winter Semester 2014/

12 Reminder: CEGAR Verification successful yes Start with (coarse) initial abstraction A Remove counterexample by refining A Property ϕ satisfied in A? no Find run violating ϕ spurious Problems: How to decide realness of counterexample? How to extract new predicates from spurious counterexample? Analyze counterexample real Error found Static Program Analysis Winter Semester 2014/

13 Counterexamples Typical properties of interest: a certain program location is not reachable (dead code) division by zero is excluded the value of x never becomes negative after program termination, the value of y is even Definition 16.3 (Counterexample) A counterexample is a sequence of abstract transitions of the form c 0, true c 1, Q 1... c k, Q k where k 1 c 0,..., c k Cmd (or c k = ) Q 1,..., Q k Abs(p 1,..., p n ) with Q k false It is called real if there exist concrete states σ 0,..., σ k Σ such that i {1,..., k} : σ i = Q i and c i 1, σ i 1 c i, σ i Otherwise it is called spurious. Static Program Analysis Winter Semester 2014/

14 Elimination of Spurious Counterexamples I Lemma 16.4 If c 0, true c 1, Q 1... c k, Q k is a spurious counterexample, there exist Boolean expressions b 0,..., b k with b 0 true, b k false, and i {1,..., k}, σ, σ Σ : σ = b i 1, c i 1, σ c i, σ = σ = b i Proof (idea). Inductive definition of b i as strongest postconditions: 1 b 0 := true 2 for i = 1,..., k: definition of b i depending on b i 1 and on (axiom) transition rule applied in c i 1,. c i,. : (skip) b i := b i 1 (asgn) b i := x.(b i 1 [x x ] x = a[x x ]) (x = previous value of x) (yields p k false; by induction on k) (if1) b i := b i 1 b (if2) b i := b i 1 b (wh1) b i := b i 1 b (wh2) b i := b i 1 b Static Program Analysis Winter Semester 2014/

15 Elimination of Spurious Counterexamples II Example 16.5 Let c 0 := [x := z] 0 ;[z := z + 1] 1 ;[y := z] 2 ; if [x = y] 3 then [skip] 4 else [skip] 5 Interesting property: after termination, x y, i.e., label 4 unreachable Initial abstraction: P = ( = Abs(P) = {true, false}) (Spurious) counterexample: 0, true 1, true 2, true 3, true 4, true Forward construction of Boolean expressions: b 0 := true (asgn) b i := x.(b i 1 [x x ] x = a[x x ]) = b 1 := x.(b 0 [x x ] x = z[x x ]) (x = z) (asgn) b i := x.(b i 1 [x x ] x = a[x x ]) = b 2 := z.(b 1 [z z ] z = z + 1[z z ]) = z.(x = z z = z + 1) (x + 1 = z) (asgn) b i := x.(b i 1 [x x ] x = a[x x ]) = b 3 := y.(b 2 [y y ] y = z[y y ]) (x + 1 = z y = z) (if1) b i := b i 1 b = b 4 := b 3 x = y (x + 1 = z y = z x = y) false Static Program Analysis Winter Semester 2014/

16 Abstraction Refinement Abstraction refinement step: Using b 1,..., k k 1 as computed before, let P := P {p 1,..., p n } where p 1,..., p n are the atomic conjuncts occurring in b 1,..., k k 1 Refine Abs(P) to Abs(P ) Lemma 16.6 After refinement, the spurious counterexample c 0, true c 1, Q 1... c k, Q k with Q k false does not exist anymore. Proof. omitted Static Program Analysis Winter Semester 2014/

17 A Simple Example Example 16.7 (cf. Example 16.5) Let c 0 := [x := z] 0 ;[z := z + 1] 1 ;[y := z] 2 ; if [x = y] 3 then [skip] 4 else [skip] 5 P =, P = {x}{{ = z}, x } + {{ 1 = z }, y = z} }{{} p 1 p 2 p 3 Refined abstract transitions: 0, true 1, p 1 p 2 2, p 1 p 2 3, p 1 p 2 p 3 4, p 1 p 2 p 3 x=y }{{} false Static Program Analysis Winter Semester 2014/

18 Another Example: Multiplication Example 16.8 Let c 0 := [z := 0] 0 ; while [x > 0] 1 do [z := z + y] 2 ; [x := x - 1] 3 ; if [z mod y = 0] 4 then [skip] 5 ; else [skip] 6 ; Initial assumption: y > 0 Interesting property: label 6 unreachable Initial abstraction: P = ( = Abs(P) = {true, false}) Abstraction refinement: on the board Static Program Analysis Winter Semester 2014/

Static Program Analysis

Static Program Analysis Static Program Analysis Lecture 13: Abstract Interpretation III (Abstract Interpretation of WHILE Programs) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de

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

Hoare Logic: Reasoning About Imperative Programs

Hoare Logic: Reasoning About Imperative Programs Hoare Logic: Reasoning About Imperative Programs COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2018 Programming Paradigms Functional. (Haskell, SML, OCaml,... ) main paradigm:

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

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

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

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/ws-1718/sv-sw/ Recap: The Denotational Approach Semantics

More information

Software Verification using Predicate Abstraction and Iterative Refinement: Part 1

Software Verification using Predicate Abstraction and Iterative Refinement: Part 1 using Predicate Abstraction and Iterative Refinement: Part 1 15-414 Bug Catching: Automated Program Verification and Testing Sagar Chaki November 28, 2011 Outline Overview of Model Checking Creating Models

More information

Design of Distributed Systems Melinda Tóth, Zoltán Horváth

Design of Distributed Systems Melinda Tóth, Zoltán Horváth Design of Distributed Systems Melinda Tóth, Zoltán Horváth Design of Distributed Systems Melinda Tóth, Zoltán Horváth Publication date 2014 Copyright 2014 Melinda Tóth, Zoltán Horváth Supported by TÁMOP-412A/1-11/1-2011-0052

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

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/ws-1617/spa/ Software Architektur Praxis-Workshop Bringen Sie Informatik

More information

Reduced Ordered Binary Decision Diagrams

Reduced Ordered Binary Decision Diagrams Reduced Ordered Binary Decision Diagrams Lecture #12 of Advanced Model Checking Joost-Pieter Katoen Lehrstuhl 2: Software Modeling & Verification E-mail: katoen@cs.rwth-aachen.de December 13, 2016 c JPK

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/ws-1617/spa/ Software Architektur Praxis-Workshop Bringen Sie Informatik

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

or simply: IC3 A Simplified Description

or simply: IC3 A Simplified Description Incremental Construction of Inductive Clauses for Indubitable Correctness or simply: IC3 A Simplified Description Based on SAT-Based Model Checking without Unrolling Aaron Bradley, VMCAI 2011 Efficient

More information

Software Verification

Software Verification Software Verification Grégoire Sutre LaBRI, University of Bordeaux, CNRS, France Summer School on Verification Technology, Systems & Applications September 2008 Grégoire Sutre Software Verification VTSA

More information

Spring 2016 Program Analysis and Verification. Lecture 3: Axiomatic Semantics I. Roman Manevich Ben-Gurion University

Spring 2016 Program Analysis and Verification. Lecture 3: Axiomatic Semantics I. Roman Manevich Ben-Gurion University Spring 2016 Program Analysis and Verification Lecture 3: Axiomatic Semantics I Roman Manevich Ben-Gurion University Warm-up exercises 1. Define program state: 2. Define structural semantics configurations:

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

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

Spring 2015 Program Analysis and Verification. Lecture 4: Axiomatic Semantics I. Roman Manevich Ben-Gurion University Spring 2015 Program Analysis and Verification Lecture 4: Axiomatic Semantics I Roman Manevich Ben-Gurion University Agenda Basic concepts of correctness Axiomatic semantics (pages 175-183) Hoare Logic

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

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

Abstractions and Decision Procedures for Effective Software Model Checking

Abstractions and Decision Procedures for Effective Software Model Checking Abstractions and Decision Procedures for Effective Software Model Checking Prof. Natasha Sharygina The University of Lugano, Carnegie Mellon University Microsoft Summer School, Moscow, July 2011 Lecture

More information

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013 Chapter 2 Reductions and NP CS 573: Algorithms, Fall 2013 August 29, 2013 2.1 Reductions Continued 2.1.1 The Satisfiability Problem SAT 2.1.1.1 Propositional Formulas Definition 2.1.1. Consider a set of

More information

COP4020 Programming Languages. Introduction to Axiomatic Semantics Prof. Robert van Engelen

COP4020 Programming Languages. Introduction to Axiomatic Semantics Prof. Robert van Engelen COP4020 Programming Languages Introduction to Axiomatic Semantics Prof. Robert van Engelen Assertions and Preconditions Assertions are used by programmers to verify run-time execution An assertion is a

More information

Decision Procedures for Satisfiability and Validity in Propositional Logic

Decision Procedures for Satisfiability and Validity in Propositional Logic Decision Procedures for Satisfiability and Validity in Propositional Logic Meghdad Ghari Institute for Research in Fundamental Sciences (IPM) School of Mathematics-Isfahan Branch Logic Group http://math.ipm.ac.ir/isfahan/logic-group.htm

More information

Theoretical Foundations of the UML

Theoretical Foundations of the UML Theoretical Foundations of the UML Lecture 17+18: A Logic for MSCs Joost-Pieter Katoen Lehrstuhl für Informatik 2 Software Modeling and Verification Group moves.rwth-aachen.de/teaching/ws-1718/fuml/ 5.

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

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30)

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/30) Computational Logic Davide Martinenghi Free University of Bozen-Bolzano Spring 2010 Computational Logic Davide Martinenghi (1/30) Propositional Logic - sequent calculus To overcome the problems of natural

More information

Motivation. CS389L: Automated Logical Reasoning. Lecture 10: Overview of First-Order Theories. Signature and Axioms of First-Order Theory

Motivation. CS389L: Automated Logical Reasoning. Lecture 10: Overview of First-Order Theories. Signature and Axioms of First-Order Theory Motivation CS389L: Automated Logical Reasoning Lecture 10: Overview of First-Order Theories Işıl Dillig Last few lectures: Full first-order logic In FOL, functions/predicates are uninterpreted (i.e., structure

More information

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig First-Order Logic First-Order Theories Roopsha Samanta Partly based on slides by Aaron Bradley and Isil Dillig Roadmap Review: propositional logic Syntax and semantics of first-order logic (FOL) Semantic

More information

Foundations of Informatics: a Bridging Course

Foundations of Informatics: a Bridging Course Foundations of Informatics: a Bridging Course Week 3: Formal Languages and Semantics Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen University noll@cs.rwth-aachen.de http://www.b-it-center.de/wob/en/view/class211_id948.html

More information

Lecture 2: Axiomatic semantics

Lecture 2: Axiomatic semantics Chair of Software Engineering Trusted Components Prof. Dr. Bertrand Meyer Lecture 2: Axiomatic semantics Reading assignment for next week Ariane paper and response (see course page) Axiomatic semantics

More information

A Short Introduction to Hoare Logic

A Short Introduction to Hoare Logic A Short Introduction to Hoare Logic Supratik Chakraborty I.I.T. Bombay June 23, 2008 Supratik Chakraborty (I.I.T. Bombay) A Short Introduction to Hoare Logic June 23, 2008 1 / 34 Motivation Assertion checking

More information

Predicate Abstraction: A Tutorial

Predicate Abstraction: A Tutorial Predicate Abstraction: A Tutorial Predicate Abstraction Daniel Kroening May 28 2012 Outline Introduction Existential Abstraction Predicate Abstraction for Software Counterexample-Guided Abstraction Refinement

More information

Lecture Notes on Software Model Checking

Lecture Notes on Software Model Checking 15-414: Bug Catching: Automated Program Verification Lecture Notes on Software Model Checking Matt Fredrikson André Platzer Carnegie Mellon University Lecture 19 1 Introduction So far we ve focused on

More information

Axiomatic Semantics. Semantics of Programming Languages course. Joosep Rõõmusaare

Axiomatic Semantics. Semantics of Programming Languages course. Joosep Rõõmusaare Axiomatic Semantics Semantics of Programming Languages course Joosep Rõõmusaare 2014 Direct Proofs of Program Correctness Partial correctness properties are properties expressing that if a given program

More information

Model Checking: An Introduction

Model Checking: An Introduction Model Checking: An Introduction Meeting 3, CSCI 5535, Spring 2013 Announcements Homework 0 ( Preliminaries ) out, due Friday Saturday This Week Dive into research motivating CSCI 5535 Next Week Begin foundations

More information

What happens to the value of the expression x + y every time we execute this loop? while x>0 do ( y := y+z ; x := x:= x z )

What happens to the value of the expression x + y every time we execute this loop? while x>0 do ( y := y+z ; x := x:= x z ) Starter Questions Feel free to discuss these with your neighbour: Consider two states s 1 and s 2 such that s 1, x := x + 1 s 2 If predicate P (x = y + 1) is true for s 2 then what does that tell us about

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

CIS 500 Software Foundations. Midterm II. March 28, 2012

CIS 500 Software Foundations. Midterm II. March 28, 2012 CIS 500 Software Foundations Midterm II March 28, 2012 Name: Pennkey: Scores: 1 2 3 4 5 6 Total (80 max) This exam concentrates on the material on the Imp programming language, program equivalence, and

More information

Proof Rules for Correctness Triples

Proof Rules for Correctness Triples Proof Rules for Correctness Triples CS 536: Science of Programming, Fall 2018 A. Why? We can t generally prove that correctness triples are valid using truth tables. We need proof axioms for atomic statements

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

EFFICIENT PREDICATE ABSTRACTION OF PROGRAM SUMMARIES

EFFICIENT PREDICATE ABSTRACTION OF PROGRAM SUMMARIES EFFICIENT PREDICATE ABSTRACTION OF PROGRAM SUMMARIES Arie Gurfinkel, Sagar Chaki and Samir Sapra Carnegie Mellon Uni In NFM11 Presented by Nimrod Partush OUTLINE Introduction Predicate Abstraction CEGAR

More information

Lecture 14 Rosser s Theorem, the length of proofs, Robinson s Arithmetic, and Church s theorem. Michael Beeson

Lecture 14 Rosser s Theorem, the length of proofs, Robinson s Arithmetic, and Church s theorem. Michael Beeson Lecture 14 Rosser s Theorem, the length of proofs, Robinson s Arithmetic, and Church s theorem Michael Beeson The hypotheses needed to prove incompleteness The question immediate arises whether the incompleteness

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 Logic (I): Axiomatic Semantics and Program Correctness

Hoare Logic (I): Axiomatic Semantics and Program Correctness Hoare Logic (I): Axiomatic Semantics and Program Correctness (Based on [Apt and Olderog 1991; Gries 1981; Hoare 1969; Kleymann 1999; Sethi 199]) Yih-Kuen Tsay Dept. of Information Management National Taiwan

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

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

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach EDA045F: Program Analysis LECTURE 10: TYPES 1 Christoph Reichenbach In the last lecture... Performance Counters Challenges in Dynamic Performance Analysis Taint Analysis Binary Instrumentation 2 / 44 Types

More information

Axiomatic Verification II

Axiomatic Verification II Axiomatic Verification II Software Testing and Verification Lecture Notes 18 Prepared by Stephen M. Thebaut, Ph.D. University of Florida Axiomatic Verification II Reasoning about iteration (while loops)

More information

Learning Goals of CS245 Logic and Computation

Learning Goals of CS245 Logic and Computation Learning Goals of CS245 Logic and Computation Alice Gao April 27, 2018 Contents 1 Propositional Logic 2 2 Predicate Logic 4 3 Program Verification 6 4 Undecidability 7 1 1 Propositional Logic Introduction

More information

3-Valued Abstraction-Refinement

3-Valued Abstraction-Refinement 3-Valued Abstraction-Refinement Sharon Shoham Academic College of Tel-Aviv Yaffo 1 Model Checking An efficient procedure that receives: A finite-state model describing a system A temporal logic formula

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

Information Flow Analysis via Path Condition Refinement

Information Flow Analysis via Path Condition Refinement Information Flow Analysis via Path Condition Refinement Mana Taghdiri, Gregor Snelting, Carsten Sinz Karlsruhe Institute of Technology, Germany FAST September 16, 2010 KIT University of the State of Baden-Wuerttemberg

More information

Abstraction for Falsification

Abstraction for Falsification Abstraction for Falsification Thomas Ball 1, Orna Kupferman 2, and Greta Yorsh 3 1 Microsoft Research, Redmond, WA, USA. Email: tball@microsoft.com, URL: research.microsoft.com/ tball 2 Hebrew University,

More information

Hoare Logic: Reasoning About Imperative Programs

Hoare Logic: Reasoning About Imperative Programs Hoare Logic: Reasoning About Imperative Programs COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2017 Catch Up / Drop in Lab When Fridays, 15.00-17.00 Where N335, CSIT Building

More information

Axiomatic Semantics. Operational semantics. Good for. Not good for automatic reasoning about programs

Axiomatic Semantics. Operational semantics. Good for. Not good for automatic reasoning about programs Review Operational semantics relatively l simple many flavors (small vs. big) not compositional (rule for while) Good for describing language implementation reasoning about properties of the language eg.

More information

Satisfiability Modulo Theories (SMT)

Satisfiability Modulo Theories (SMT) CS510 Software Engineering Satisfiability Modulo Theories (SMT) Slides modified from those by Aarti Gupta Textbook: The Calculus of Computation by A. Bradley and Z. Manna 1 Satisfiability Modulo Theory

More information

SAT-Based Verification with IC3: Foundations and Demands

SAT-Based Verification with IC3: Foundations and Demands SAT-Based Verification with IC3: Foundations and Demands Aaron R. Bradley ECEE, CU Boulder & Summit Middle School SAT-Based Verification with IC3:Foundations and Demands 1/55 Induction Foundation of verification

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

Softwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany

Softwaretechnik. Lecture 13: Design by Contract. Peter Thiemann University of Freiburg, Germany Softwaretechnik Lecture 13: Design by Contract Peter Thiemann University of Freiburg, Germany 25.06.2012 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented

More information

0.1 Random useful facts. 0.2 Language Definition

0.1 Random useful facts. 0.2 Language Definition 0.1 Random useful facts Lemma double neg : P : Prop, {P} + { P} P P. Lemma leq dec : n m, {n m} + {n > m}. Lemma lt dec : n m, {n < m} + {n m}. 0.2 Language Definition Definition var := nat. Definition

More information

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either Introduction to Temporal Logic The purpose of temporal logics is to specify properties of dynamic systems. These can be either Desired properites. Often liveness properties like In every infinite run action

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

CIS 500: Software Foundations

CIS 500: Software Foundations CIS 500: Software Foundations Midterm II November 8, 2016 Directions: This exam booklet contains both the standard and advanced track questions. Questions with no annotation are for both tracks. Other

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

Algorithmic verification

Algorithmic verification Algorithmic verification Ahmed Rezine IDA, Linköpings Universitet Hösttermin 2018 Outline Overview Model checking Symbolic execution Outline Overview Model checking Symbolic execution Program verification

More information

Hoare Logic and Model Checking

Hoare Logic and Model Checking Hoare Logic and Model Checking Kasper Svendsen University of Cambridge CST Part II 2016/17 Acknowledgement: slides heavily based on previous versions by Mike Gordon and Alan Mycroft Introduction In the

More information

On the Complexity of the Reflected Logic of Proofs

On the Complexity of the Reflected Logic of Proofs On the Complexity of the Reflected Logic of Proofs Nikolai V. Krupski Department of Math. Logic and the Theory of Algorithms, Faculty of Mechanics and Mathematics, Moscow State University, Moscow 119899,

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

Problem 1: Suppose A, B, C and D are finite sets such that A B = C D and C = D. Prove or disprove: A = B.

Problem 1: Suppose A, B, C and D are finite sets such that A B = C D and C = D. Prove or disprove: A = B. Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination III (Spring 2007) Problem 1: Suppose A, B, C and D are finite sets

More information

Introduction to Axiomatic Semantics

Introduction to Axiomatic Semantics #1 Introduction to Axiomatic Semantics #2 How s The Homework Going? Remember that you can t just define a meaning function in terms of itself you must use some fixed point machinery. #3 Observations A

More information

Part 1: Propositional Logic

Part 1: Propositional Logic Part 1: Propositional Logic Literature (also for first-order logic) Schöning: Logik für Informatiker, Spektrum Fitting: First-Order Logic and Automated Theorem Proving, Springer 1 Last time 1.1 Syntax

More information

Propositional Logic: Equivalence

Propositional Logic: Equivalence Propositional Logic: Equivalence Alice Gao Lecture 5 Based on work by J. Buss, L. Kari, A. Lubiw, B. Bonakdarpour, D. Maftuleac, C. Roberts, R. Trefler, and P. Van Beek 1/42 Outline Propositional Logic:

More information

CEGAR:Counterexample-Guided Abstraction Refinement

CEGAR:Counterexample-Guided Abstraction Refinement CEGAR: Counterexample-guided Abstraction Refinement Sayan Mitra ECE/CS 584: Embedded System Verification November 13, 2012 Outline Finite State Systems: Abstraction Refinement CEGAR Validation Refinment

More information

Geometric Quantifier Elimination Heuristics for Automatically Generating Octagonal and Max-plus Invariants

Geometric Quantifier Elimination Heuristics for Automatically Generating Octagonal and Max-plus Invariants Geometric Quantifier Elimination Heuristics for Automatically Generating Octagonal and Max-plus Invariants Deepak Kapur 1 Zhihai Zhang 2 Matthias Horbach 1 Hengjun Zhao 3 Qi Lu 1 and ThanhVu Nguyen 1 1

More information

Peano Arithmetic. CSC 438F/2404F Notes (S. Cook) Fall, Goals Now

Peano Arithmetic. CSC 438F/2404F Notes (S. Cook) Fall, Goals Now CSC 438F/2404F Notes (S. Cook) Fall, 2008 Peano Arithmetic Goals Now 1) We will introduce a standard set of axioms for the language L A. The theory generated by these axioms is denoted PA and called Peano

More information

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester)

First-Order Theorem Proving and Vampire. Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester) First-Order Theorem Proving and Vampire Laura Kovács (Chalmers University of Technology) Andrei Voronkov (The University of Manchester) Outline Introduction First-Order Logic and TPTP Inference Systems

More information

Understanding IC3. Aaron R. Bradley. ECEE, CU Boulder & Summit Middle School. Understanding IC3 1/55

Understanding IC3. Aaron R. Bradley. ECEE, CU Boulder & Summit Middle School. Understanding IC3 1/55 Understanding IC3 Aaron R. Bradley ECEE, CU Boulder & Summit Middle School Understanding IC3 1/55 Further Reading This presentation is based on Bradley, A. R. Understanding IC3. In SAT, June 2012. http://theory.stanford.edu/~arbrad

More information

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula:

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula: Logic: The Big Picture Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about time (and

More information

PREDICATE LOGIC: UNDECIDABILITY AND INCOMPLETENESS HUTH AND RYAN 2.5, SUPPLEMENTARY NOTES 2

PREDICATE LOGIC: UNDECIDABILITY AND INCOMPLETENESS HUTH AND RYAN 2.5, SUPPLEMENTARY NOTES 2 PREDICATE LOGIC: UNDECIDABILITY AND INCOMPLETENESS HUTH AND RYAN 2.5, SUPPLEMENTARY NOTES 2 Neil D. Jones DIKU 2005 14 September, 2005 Some slides today new, some based on logic 2004 (Nils Andersen) OUTLINE,

More information

Tutorial 1: Modern SMT Solvers and Verification

Tutorial 1: Modern SMT Solvers and Verification University of Illinois at Urbana-Champaign Tutorial 1: Modern SMT Solvers and Verification Sayan Mitra Electrical & Computer Engineering Coordinated Science Laboratory University of Illinois at Urbana

More information

Logic As Algebra COMP1600 / COMP6260. Dirk Pattinson Australian National University. Semester 2, 2017

Logic As Algebra COMP1600 / COMP6260. Dirk Pattinson Australian National University. Semester 2, 2017 Logic As Algebra COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2017 Recap: And, Or, and Not x AND y x y x y 0 0 0 0 1 0 1 0 0 1 1 1 x OR y x y x y 0 0 0 0 1 1 1 0 1 1 1

More information

Lecture 11: Measuring the Complexity of Proofs

Lecture 11: Measuring the Complexity of Proofs IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Advanced Course on Computational Complexity Lecture 11: Measuring the Complexity of Proofs David Mix Barrington and Alexis Maciel July

More information

Topics in Model-Based Reasoning

Topics in Model-Based Reasoning Towards Integration of Proving and Solving Dipartimento di Informatica Università degli Studi di Verona Verona, Italy March, 2014 Automated reasoning Artificial Intelligence Automated Reasoning Computational

More information

First-Order Theorem Proving and Vampire

First-Order Theorem Proving and Vampire First-Order Theorem Proving and Vampire Laura Kovács 1,2 and Martin Suda 2 1 TU Wien 2 Chalmers Outline Introduction First-Order Logic and TPTP Inference Systems Saturation Algorithms Redundancy Elimination

More information

Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE

Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE 6341 1 Outline Introduction What are axiomatic semantics? First-order logic & assertions about states Results (triples)

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

Propositional Dynamic Logic

Propositional Dynamic Logic Propositional Dynamic Logic Contents 1 Introduction 1 2 Syntax and Semantics 2 2.1 Syntax................................. 2 2.2 Semantics............................... 2 3 Hilbert-style axiom system

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

Software Testing Lecture 5. Justin Pearson

Software Testing Lecture 5. Justin Pearson Software Testing Lecture 5 Justin Pearson 2017 1 / 34 Covering Logical Expressions Logic expression show up in many situations Covering logical expressions have a long history, many are the covering criteria

More information

Part 1: Propositional Logic

Part 1: Propositional Logic Part 1: Propositional Logic Literature (also for first-order logic) Schöning: Logik für Informatiker, Spektrum Fitting: First-Order Logic and Automated Theorem Proving, Springer 1 Last time 1.1 Syntax

More information

First Order Logic vs Propositional Logic CS477 Formal Software Dev Methods

First Order Logic vs Propositional Logic CS477 Formal Software Dev Methods First Order Logic vs Propositional Logic CS477 Formal Software Dev Methods Elsa L Gunter 2112 SC, UIUC egunter@illinois.edu http://courses.engr.illinois.edu/cs477 Slides based in part on previous lectures

More information

Hoare Examples & Proof Theory. COS 441 Slides 11

Hoare Examples & Proof Theory. COS 441 Slides 11 Hoare Examples & Proof Theory COS 441 Slides 11 The last several lectures: Agenda Denotational semantics of formulae in Haskell Reasoning using Hoare Logic This lecture: Exercises A further introduction

More information

IC3 and Beyond: Incremental, Inductive Verification

IC3 and Beyond: Incremental, Inductive Verification IC3 and Beyond: Incremental, Inductive Verification Aaron R. Bradley ECEE, CU Boulder & Summit Middle School IC3 and Beyond: Incremental, Inductive Verification 1/62 Induction Foundation of verification

More information

02 Propositional Logic

02 Propositional Logic SE 2F03 Fall 2005 02 Propositional Logic Instructor: W. M. Farmer Revised: 25 September 2005 1 What is Propositional Logic? Propositional logic is the study of the truth or falsehood of propositions or

More information

Labeled Transition Systems

Labeled Transition Systems Labeled Transition Systems Lecture #1 of Probabilistic Models for Concurrency Joost-Pieter Katoen Lehrstuhl II: Programmiersprachen u. Softwarevalidierung E-mail: katoen@cs.rwth-aachen.de March 12, 2005

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

The Curry-Howard Isomorphism

The Curry-Howard Isomorphism The Curry-Howard Isomorphism Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) The Curry-Howard Isomorphism MFES 2008/09

More information

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 3: Practical SAT Solving

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 3: Practical SAT Solving Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 3: Practical SAT Solving Matt Fredrikson mfredrik@cs.cmu.edu October 17, 2016 Matt Fredrikson SAT Solving 1 / 36 Review: Propositional

More information