Predicate Transforms I
|
|
- Daniel Wilcox
- 5 years ago
- Views:
Transcription
1 Predicate Transforms I Software Testing and Verification Lecture Notes 19 Prepared by Stephen M. Thebaut, Ph.D. University of Florida
2 Predicate Transforms I 1. Introduction: weakest pre-conditions (wp s) weakest liberal pre-conditions (wlp s) strongest post-conditions (sp s) 2. Proving {P} S {Q} using predicate transforms 3. Transform rules for: assignment statements sequencing selection statements
3 Introduction What are Predicate Transforms? Rules for transforming post-conditions into pre-conditions or vice-versa. They provide algorithms to reduce the problem of verifying Hoare triples to proving predicate calculus formulas. Thus, predicate transforms operationalize Hoare Logic. Also known as Predicate Transformers
4 Introduction (cont d) What is a weakest pre-condition? It is the weakest condition on the initial state of program S ensuring termination in state Q. It is denoted wp(s,q) and read, the weakest pre-condition of S with respect to Q.
5 Introduction (cont d) What is a weakest liberal pre-condition? It is the weakest condition on the initial state of program S ensuring state Q on termination IF S TERMINATES. It is denoted wlp(s,q) and read, the weakest liberal pre-condition of S with respect to Q.
6 Introduction (cont d) What is a strongest post-condition? It is the strongest condition on the final state of program S given that P holds initially and GIVEN THAT S TERMINATES. It is denoted sp(s,p) and read, the strongest post-condition of S with respect to P.
7 Predicate Transforms I 1. Introduction: weakest pre-conditions (wp s) weakest liberal pre-conditions (wlp s) strongest post-conditions (sp s) 2. Proving {P} S {Q} using predicate transforms 3. Transform rules for: assignment statements sequencing selection statements
8 ROI s (algorithms) for proving program correctness using predicate transforms P wp(s,q) {P} S {Q} strongly P wlp(s,q) {P} S {Q} sp(s,p) Q {P} S {Q}
9 ROI s (algorithms) for proving program correctness (cont d) Note the relationship between weakest liberal pre-conditions and strongest postconditions: P wlp(s,q) sp(s,p) Q We now consider rules for computing predicate transforms for structured programs comprised of assignment statements, if-then (-else) statements, and (in part II) while loops.
10 Predicate Transforms I 1. Introduction: weakest pre-conditions (wp s) weakest liberal pre-conditions (wlp s) strongest post-conditions (sp s) 2. Proving {P} S {Q} using predicate transforms 3. Transform rules for: assignment statements sequencing selection statements
11 wp and wlp Rule for Assignment Statements Rule: w(l)p(x:=e, Q(x,y,z)) Q(E,y,z)
12 wp and wlp Rule for Assignment Statements Rule: w(l)p(x:=e, Q(x,y,z)) Q(E,y,z) Examples: w(l)p(x:=y+3, x>0) =
13 wp and wlp Rule for Assignment Statements Rule: w(l)p(x:=e, Q(x,y,z)) Q(E,y,z) Examples: w(l)p(x:=y+3, x>0) = w(l)p(x:=x+1, x n+1) =
14 wp and wlp Rule for Assignment Statements Rule: w(l)p(x:=e, Q(x,y,z)) Q(E,y,z) Examples: w(l)p(x:=y+3, x>0) = w(l)p(x:=x+1, x n+1) = w(l)p(x:=7, x=7) = (cont d)
15 wp and wlp Rule for Assignment Statements Rule: w(l)p(x:=e, Q(x,y,z)) Q(E,y,z) Examples: (cont d) w(l)p(x:=7, x=6) =
16 wp and wlp Rule for Assignment Statements Rule: w(l)p(x:=e, Q(x,y,z)) Q(E,y,z) Examples: (cont d) w(l)p(x:=7, x=6) = w(l)p(x:=7, y=7) =
17 wp and wlp Rule for Assignment Statements Rule: w(l)p(x:=e, Q(x,y,z)) Q(E,y,z) Examples: (cont d) w(l)p(x:=7, x=6) = w(l)p(x:=7, y=7) = w(l)p(y:=-x, y= x ) =
18 sp Rule for Assignment Statements Rule: sp(x:=e, P) x=e(x,y,z) Л P(x,y,z)
19 sp Rule for Assignment Statements Rule: sp(x:=e, P) x=e(x,y,z) Л P(x,y,z) Examples: sp(x:=y+3, y>-3) =
20 sp Rule for Assignment Statements Rule: sp(x:=e, P) x=e(x,y,z) Л P(x,y,z) Examples: sp(x:=y+3, y>-3) = sp(x:=x+1, x<n) =
21 sp Rule for Assignment Statements Rule: sp(x:=e, P) x=e(x,y,z) Л P(x,y,z) Examples: sp(x:=y+3, y>-3) = sp(x:=x+1, x<n) = sp(x:=7, true) = (cont d)
22 sp Rule for Assignment Statements Rule: sp(x:=e, P) x=e(x,y,z) Л P(x,y,z) Examples: (cont d) sp(x:=7, false) =
23 sp Rule for Assignment Statements Rule: sp(x:=e, P) x=e(x,y,z) Л P(x,y,z) Examples: (cont d) sp(x:=7, false) = sp(x:=7, y=7) =
24 sp Rule for Assignment Statements Rule: sp(x:=e, P) x=e(x,y,z) Л P(x,y,z) Examples: (cont d) sp(x:=7, false) = sp(x:=7, y=7) = sp(y:=-x, y= x ) =
25 Predicate Transforms I 1. Introduction: weakest pre-conditions (wp s) weakest liberal pre-conditions (wlp s) strongest post-conditions (sp s) 2. Proving {P} S {Q} using predicate transforms 3. Transform rules for: assignment statements sequencing selection statements
26 wp and wlp Rule for Sequencing Rule: w(l)p(s 1 ;S 2 ;...;S n-1 ;S n, Q) w(l)p(s 1, w(l)p(s 2,...w(l)p(S n-1, w(l)p(s n, Q)) ))
27 wp and wlp Rule for Sequencing (cont d) Example: w(l)p(c:=d+1; B:=C 2; A:=B 2, A=36)
28 wp and wlp Rule for Sequencing (cont d) Example: w(l)p(c:=d+1; B:=C 2; A:=B 2, A=36) C:=D+1 B:=C 2 A:=B 2 { A=36 }
29 wp and wlp Rule for Sequencing (cont d) Example: w(l)p(c:=d+1; B:=C 2; A:=B 2, A=36) C:=D+1 C:=D+1 B:=C 2 B:=C 2 A:=B 2 { A=36 } A:=B 2 { A=36 }
30 sp Rule for Sequencing Rule: sp(s 1 ;S 2 ;...;S n-1 ;S n, P) sp(s n, sp(s n-1,...sp(s 2, sp(s 1, P)) ))
31 sp Rule for Sequencing (cont d) Example 1: sp(c:=d+1; B:=C 2; A:=B 2, D=1)
32 sp Rule for Sequencing (cont d) Example 1: sp(c:=d+1; B:=C 2; A:=B 2, D=1) { D=1 } C:=D+1 B:=C 2 A:=B 2
33 sp Rule for Sequencing (cont d) Example 1: sp(c:=d+1; B:=C 2; A:=B 2, D=1) { D=1 } C:=D+1 B:=C 2 A:=B 2
34 sp Rule for Sequencing (cont d) Compound programs often include multiple assignments to the same variable, e.g., X := X+1;...; X := Y-X;...; X := Z Y;... It is sometimes useful to anchor the initial values of such variables using some suitable notation such as X 0 when applying the sp Rule for Assignment Statements. Consider the following example...
35 sp Rule for Sequencing (cont d) Example 2: sp(s, true) where S is X:=X+1; X:=Y X; X:=X-1 { true } (1) X:=X+1 anchoring initial value of X to X 0 : { X=X +1 Л true } = { X=X 0 +1 } (2) X:=Y X { X=YX Л X =X 0 +1 } = { X=Y(X 0 +1) } (3) X:=X-1 { X=X -1 Л X =Y(X 0 +1) } = { X=Y(X 0 +1)-1 } reverting to standard X notation: Therefore, sp(s, true) is X=YX +Y-1
36 Predicate Transforms I 1. Introduction: weakest pre-conditions (wp s) weakest liberal pre-conditions (wlp s) strongest post-conditions (sp s) 2. Proving {P} S {Q} using predicate transforms 3. Transform rules for: assignment statements sequencing selection statements
37 wp and wlp Rule for if-then-else Statement Rule: w(l)p(if b then S 1 else S 2, Q) (b Л w(l)p(s 1, Q)) V ( b Л w(l)p(s 2, Q))
38 wp and wlp Rule for if-then-else Statement Rule: w(l)p(if b then S 1 else S 2, Q) (b Л w(l)p(s 1, Q)) V ( b Л w(l)p(s 2, Q)) T b F S 1 S 2 {Q}
39 wp and wlp Rule for if-then-else Statement Rule: w(l)p(if b then S 1 else S 2, Q) (b Л w(l)p(s 1, Q)) V ( b Л w(l)p(s 2, Q)) b Л w(l)p(s 1, Q) T b F S 1 S 2 {Q}
40 wp and wlp Rule for if-then-else Statement Rule: w(l)p(if b then S 1 else S 2, Q) (b Л w(l)p(s 1, Q)) V ( b Л w(l)p(s 2, Q)) b Л w(l)p(s 1, Q) T b F b Л w(l)p(s 2, Q) S 1 S 2 {Q}
41 wp and wlp Rule for if-then-else Statement Example: w(l)p(if x<0 then y:=-x else y:=x, y= x )
42 wp and wlp Rule for if-then-else Statement Example: b S 1 S 2 Q w(l)p(if x<0 then y:=-x else y:=x, y= x ) = (b Л w(l)p(s 1, Q)) V ( b Л w(l)p(s 2, Q)) = (x<0 Л w(l)p(y:=-x, y= x )) V (x 0 Л w(l)p(y:=x, y= x )) = (x<0 Л -x= x ) V (x 0 Л x= x ) = (x<0 Л x 0) V (x 0 Л x 0) = (x<0 V x 0) = true
43 wp and wlp Rule for if-then Statement Rule: w(l)p(if b then S, Q) (b Л w(l)p(s, Q)) V ( b Л Q)
44 wp and wlp Rule for if-then Statement Rule: w(l)p(if b then S, Q) (b Л w(l)p(s, Q)) V ( b Л Q) T b S F {Q}
45 wp and wlp Rule for if-then Statement Rule: w(l)p(if b then S, Q) (b Л w(l)p(s, Q)) V ( b Л Q) b Л w(l)p(s, Q) S T b F {Q}
46 wp and wlp Rule for if-then Statement Rule: w(l)p(if b then S, Q) (b Л w(l)p(s, Q)) V ( b Л Q) b Л w(l)p(s, Q) S T b F b Л Q {Q}
47 wp and wlp Rule for if-then Statement (cont d) Example: w(l)p(if x<0 then y:=-x, y= x )
48 wp and wlp Rule for if-then Statement (cont d) Example: b S Q w(l)p(if x<0 then y:=-x, y= x ) = (b Л w(l)p(s, Q)) V ( b Л Q)) = (x<0 Л w(l)p(y:=-x, y= x )) V (x 0 Л y= x ) = (x<0 Л -x= x ) V (x 0 Л y= x ) = (x<0 Л x 0) V (x 0 Л y= x ) = (x<0 V (x 0 Л y= x )) = (x<0 V (x 0 Л y=x)) = (x<0 V y=x)
49 Exercise Prove the assertion below using the wlp ROI. {Z=B} if A>B then Z := A {Z=Max(A,B)}
50 Exercise Prove the assertion below using the wlp ROI. P S Q {Z=B} if A>B then Z := A {Z=Max(A,B)}
51 Exercise Prove the assertion below using the wlp ROI. P S Q {Z=B} if A>B then Z := A {Z=Max(A,B)} Recall the wlp ROI: P wlp(s,q) {P} S {Q}
52 sp Rule for if-then-else Statement Rule: sp(if b then S 1 else S 2, P) sp(s 1, b Л P) V sp(s 2, b Л P)
53 sp Rule for if-then-else Statement Rule: sp(if b then S 1 else S 2, P) sp(s 1, b Л P) V sp(s 2, b Л P) {P} T b F S 1 S 2
54 sp Rule for if-then-else Statement Rule: sp(if b then S 1 else S 2, P) sp(s 1, b Л P) V sp(s 2, b Л P) {P} T b F S 1 S 2 sp(s 1, b Л P)
55 sp Rule for if-then-else Statement Rule: sp(if b then S 1 else S 2, P) sp(s 1, b Л P) V sp(s 2, b Л P) {P} T b F S 1 S 2 sp(s 1, b Л P) sp(s 2, b Л P)
56 sp Rule for if-then Statement Rule: sp(if b then S, P) sp(s, b Л P) V ( b Л P)
57 sp Rule for if-then Statement Rule: sp(if b then S, P) sp(s, b Л P) V ( b Л P) {P} T b S F
58 sp Rule for if-then Statement Rule: sp(if b then S, P) sp(s, b Л P) V ( b Л P) {P} T b S F sp(s, b Л P)
59 sp Rule for if-then Statement Rule: sp(if b then S, P) sp(s, b Л P) V ( b Л P) {P} T b sp(s, b Л P) S F b Л P
60 Example Prove the assertion: {y=x} if x<0 then y:=-x {y= x } using the strongest post-condition (sp) ROI.
61 Example Prove the assertion: {y=x} if x<0 then y:=-x {y= x } using the strongest post-condition (sp) ROI. Recall the sp ROI: sp(s,p) Q {P} S {Q}
62 Example Prove the assertion: {y=x} if x<0 then y:=-x {y= x } using the strongest post-condition (sp) ROI. P (1) sp(if x<0 then y:=-x, y=x) = sp(y:=-x, x<0 Л y=x) V (x 0 Л y=x) = (y=-x Л x<0 Л y =x) V (x 0 Л y=x) (2) (y=-x Л x<0 Л y =x) V (x 0 Л y=x) => (x<0 Л y=-x) V (x 0 Л y=x) => y= x Q
63 Coming Up Next Transform rules for while loops
64 Predicate Transforms I Software Testing and Verification Lecture Notes 19 Prepared by Stephen M. Thebaut, Ph.D. University of Florida
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 informationAxiomatic 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 informationSpring 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 informationProofs 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 informationDeterministic Program The While Program
Deterministic Program The While Program Shangping Ren Department of Computer Science Illinois Institute of Technology February 24, 2014 Shangping Ren Deterministic Program The While Program February 24,
More informationProgramming Languages
CSE 230: Winter 2008 Principles of Programming Languages Lecture 6: Axiomatic Semantics Deriv. Rules for Hoare Logic `{A} c {B} Rules for each language construct ` {A} c 1 {B} ` {B} c 2 {C} ` {A} skip
More informationProgram 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 informationIn 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 informationStrength; Weakest Preconditions
12/14: solved Strength; Weakest Preconditions CS 536: Science of Programming, Spring 2018 A. Why To combine correctness triples, we need to weaken and strengthen conditions. A weakest precondition is the
More informationProgram 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 informationWeakest Precondition Calculus
Weakest Precondition Calculus COMP2600 Formal Methods for Software Engineering Rajeev Goré Australian National University Semester 2, 2016 (Most lecture slides due to Ranald Clouston) COMP 2600 Weakest
More informationHoare 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 informationAxiomatic 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 informationClassical 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 informationThe 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 informationDynamic 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 informationFloyd-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 informationLecture 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 informationAxiomatic 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 informationAxiomatic 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 informationSpring 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 informationHoare 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 informationCSE 331 Software Design & Implementation
CSE 331 Software Design & Implementation Kevin Zatloukal Summer 2017 Lecture 2 Reasoning About Code With Logic (Based on slides by Mike Ernst, Dan Grossman, David Notkin, Hal Perkins, Zach Tatlock) Recall
More informationProgramming 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 informationProgram 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 informationAxiomatic semantics. Semantics and Application to Program Verification. Antoine Miné. École normale supérieure, Paris year
Axiomatic semantics Semantics and Application to Program Verification Antoine Miné École normale supérieure, Paris year 2015 2016 Course 6 18 March 2016 Course 6 Axiomatic semantics Antoine Miné p. 1 /
More informationLecture 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 informationAxiomatic 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 informationSpring 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 informationDeductive 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 informationHoare 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 informationCSE 331 Winter 2018 Reasoning About Code I
CSE 331 Winter 2018 Reasoning About Code I Notes by Krysta Yousoufian Original lectures by Hal Perkins Additional contributions from Michael Ernst, David Notkin, and Dan Grossman These notes cover most
More informationHoare 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 informationProof Calculus for Partial Correctness
Proof Calculus for Partial Correctness Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan September 7, 2016 Bow-Yaw Wang (Academia Sinica) Proof Calculus for Partial Correctness September
More informationFormal Reasoning CSE 331. Lecture 2 Formal Reasoning. Announcements. Formalization and Reasoning. Software Design and Implementation
CSE 331 Software Design and Implementation Lecture 2 Formal Reasoning Announcements Homework 0 due Friday at 5 PM Heads up: no late days for this one! Homework 1 due Wednesday at 11 PM Using program logic
More informationSolutions to exercises for the Hoare logic (based on material written by Mark Staples)
Solutions to exercises for the Hoare logic (based on material written by Mark Staples) Exercise 1 We are interested in termination, so that means we need to use the terminology of total correctness, i.e.
More informationAxiomatic 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 informationProgram 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 informationAxiomatic 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 informationDeclarative View of Imperative Programs
Declarative View of Imperative Programs Hugh Gibbons, Trinity College, Dublin, Ireland. Abstract By giving a declarative meaning to an imperative program, the verification of the imperative program is
More informationFoundations of Computation
The Australian National University Semester 2, 2018 Research School of Computer Science Tutorial 6 Dirk Pattinson Foundations of Computation The tutorial contains a number of exercises designed for the
More informationHoare 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 informationSoftware Engineering
Software Engineering Lecture 07: Design by Contract Peter Thiemann University of Freiburg, Germany 02.06.2014 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented
More informationBlack-Box Testing Techniques III
Black-Box Testing Techniques III Software Testing and Verification Lecture 6 Prepared by Stephen M. Thebaut, Ph.D. University of Florida Another Cause-Effect Example: Symbol Table Storage Specification
More informationSoundness and Completeness of Axiomatic Semantics
#1 Soundness and Completeness of Axiomatic Semantics #2 One-Slide Summary A system of axiomatic semantics is sound if everything we can prove is also true: if ` { A } c { B } then ² { A } c { B } We prove
More informationFormal Methods for Probabilistic Systems
1 Formal Methods for Probabilistic Systems Annabelle McIver Carroll Morgan Source-level program logic Introduction to probabilistic-program logic Systematic presentation via structural induction Layout
More informationAxiomatic 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 informationProof 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 informationGalois Connections. Roland Backhouse 3rd December, 2002
1 Galois Connections Roland Backhouse 3rd December, 2002 Fusion 2 Many problems are expressed in the form evaluate generate where generate generates a (possibly infinite) candidate set of solutions, and
More informationVerification Frameworks and Hoare Logic
CMSC 630 February 11, 2015 1 Verification Frameworks and Hoare Logic Sources K. Apt and E.-R. Olderog. Verification of Sequential and Concurrent Programs (Second Edition). Springer-Verlag, Berlin, 1997.
More informationINVARIANT RELATIONS: A CONCEPT FOR ANALYZING WHILE LOOPS. Ali Mili, NJIT NII, Tokyo, Japan December 20, 2011
INVARIANT RELATIONS: A CONCEPT FOR ANALYZING WHILE LOOPS Ali Mili, NJIT NII, Tokyo, Japan December 20, 2011 PLAN 2 Motivation Relational Mathematics Invariant Relations Invariant Relations and Loop Functions
More informationFirst 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 informationLast Time. Inference Rules
Last Time When program S executes it switches to a different state We need to express assertions on the states of the program S before and after its execution We can do it using a Hoare triple written
More informationWhat 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 informationHoare 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 informationCoinductive big-step semantics and Hoare logics for nontermination
Coinductive big-step semantics and Hoare logics for nontermination Tarmo Uustalu, Inst of Cybernetics, Tallinn joint work with Keiko Nakata COST Rich Models Toolkit meeting, Madrid, 17 18 October 2013
More informationCS558 Programming Languages
CS558 Programming Languages Winter 2017 Lecture 2b Andrew Tolmach Portland State University 1994-2017 Semantics Informal vs. Formal Informal semantics Descriptions in English (or other natural language)
More informationProgram 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 informationCSC 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 informationHoare 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 informationPredicate 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 informationCS156: 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 informationthat shows the semi-decidability of the problem (i.e. a semi-decision procedure for EXISTS-HALTING) and argue that it is correct.
Exercise 1 (15) Consider the following problem: EXISTS-HALTING INSTANCE: A program Π, which takes as input a string over the alphabet {a, b, c,..., z}. QUESTION: Does there exist an input I, such that
More informationMid-Semester Quiz Second Semester, 2012
THE AUSTRALIAN NATIONAL UNIVERSITY Mid-Semester Quiz Second Semester, 2012 COMP2600 (Formal Methods for Software Engineering) Writing Period: 1 hour duration Study Period: 10 minutes duration Permitted
More informationSoftwaretechnik. 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 informationSoftwaretechnik. 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 informationLoop Convergence. CS 536: Science of Programming, Fall 2018
Solved Loop Convergence CS 536: Science of Programming, Fall 2018 A. Why Diverging programs aren t useful, so it s useful to know how to show that loops terminate. B. Objectives At the end of this lecture
More informationCalculating axiomatic semantics from program equations by means of functional predicate calculus
Calculating axiomatic semantics from program equations by means of functional predicate calculus (Some initial results of recent work not for dissemination) Raymond Boute INTEC Ghent University 2004/02
More informationProving Inter-Program Properties
Unité Mixte de Recherche 5104 CNRS - INPG - UJF Centre Equation 2, avenue de VIGNATE F-38610 GIERES tel : +33 456 52 03 40 fax : +33 456 52 03 50 http://www-verimag.imag.fr Proving Inter-Program Properties
More informationProbabilistic Guarded Commands Mechanized in HOL
Probabilistic Guarded Commands Mechanized in HOL Joe Hurd joe.hurd@comlab.ox.ac.uk Oxford University Joint work with Annabelle McIver (Macquarie University) and Carroll Morgan (University of New South
More informationCOP4020 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 informationStatic Program Analysis
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
More informationDesign 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 informationTHE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600/COMP6260 (Formal Methods for Software Engineering)
THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester 2016 COMP2600/COMP6260 (Formal Methods for Software Engineering) Writing Period: 3 hours duration Study Period: 15 minutes duration Permitted Materials:
More informationCOMP2111 Glossary. Kai Engelhardt. Contents. 1 Symbols. 1 Symbols 1. 2 Hoare Logic 3. 3 Refinement Calculus 5. rational numbers Q, real numbers R.
COMP2111 Glossary Kai Engelhardt Revision: 1.3, May 18, 2018 Contents 1 Symbols 1 2 Hoare Logic 3 3 Refinement Calculus 5 1 Symbols Booleans B = {false, true}, natural numbers N = {0, 1, 2,...}, integers
More informationTHE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600 (Formal Methods in Software Engineering)
THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester 2007 COMP2600 (Formal Methods in Software Engineering) Writing Period: 3 hours duration Study Period: 15 minutes duration Permitted Materials: None Answer
More informationDecision Procedures. Jochen Hoenicke. Software Engineering Albert-Ludwigs-University Freiburg. Winter Term 2016/17
Decision Procedures Jochen Hoenicke Software Engineering Albert-Ludwigs-University Freiburg Winter Term 2016/17 Jochen Hoenicke (Software Engineering) Decision Procedures Winter Term 2016/17 1 / 436 Program
More informationA 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 informationReasoning About Imperative Programs. COS 441 Slides 10b
Reasoning About Imperative Programs COS 441 Slides 10b Last time Hoare Logic: { P } C { Q } Agenda If P is true in the initial state s. And C in state s evaluates to s. Then Q must be true in s. Program
More informationVerification and Validation
2010-2011 Cycle Ingénieur 2 ème année Département Informatique Verification and Validation Part IV : Proof-based Verification (III) Burkhart Wolff Département Informatique Université Paris-Sud / Orsay
More informationIntroduction 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 informationExtending the theory of Owicki and Gries with a logic of progress
Extending the theory of Owicki and Gries with a logic of progress Brijesh Dongol Doug Goldson August 2005 Technical Report SSE-2005-03 Division of Systems and Software Engineering Research School of Information
More informationPredicates and Predicate Transformers for. Systems 1. Ratnesh Kumar. Department of Electrical Engineering. University of Kentucky
Predicates and Predicate Transformers for Supervisory Control of Discrete Event Dynamical Systems 1 Ratnesh Kumar Department of Electrical Engineering University of Kentucy Lexington, KY 40506-0046 Vijay
More informationFormal Specification and Verification. Specifications
Formal Specification and Verification Specifications Imprecise specifications can cause serious problems downstream Lots of interpretations even with technicaloriented natural language The value returned
More informationVerificación de Programas!
Verificación de Programas! rafael ramirez rafael.ramirez@upf.edu 55.316 (Tanger) Porque verificar programas Debido a un error de programación, el cohete que llevaba al Mariner I, en viaje sin tripulación
More informationCS256/Winter 2009 Lecture #6. Zohar Manna
CS256/Winter 2009 Lecture #6 Zohar Manna Chapter 1 Invariance: Proof Methods For assertion q and SPL program P show P Õ ¼ q (i.e., q is P-invariant) 6-1 Proving Invariances Definitions Recall: the variables
More information1 Fundamental Concepts From Algebra & Precalculus
Fundamental Concepts From Algebra & Precalculus. Review Exercises.. Simplify eac expression.. 5 7) [ 5)) ]. ) 5) 7) 9 + 8 5. 8 [ 5) 8 6)] [9 + 8 5 ]. 9 + 8 5 ) 8) + 5. 5 + [ )6)] 7) 7 + 6 5 6. 8 5 ) 6
More informationFormal 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 informationCS156: The Calculus of Computation
Page 1 of 61 CS156: The Calculus of Computation Zohar Manna Winter 2010 Chapter 5: Program Correctness: Mechanics Page 2 of 61 Program A: LinearSearch with function specification @pre 0 l u < a @post rv
More informationSection 4.3 Concavity and Curve Sketching 1.5 Lectures. Dr. Abdulla Eid. College of Science. MATHS 101: Calculus I
Section 4.3 Concavity and Curve Sketching 1.5 Lectures College of Science MATHS 101: Calculus I (University of Bahrain) Concavity 1 / 29 Concavity Increasing Function has three cases (University of Bahrain)
More informationECE380 Digital Logic. Axioms of Boolean algebra
ECE380 Digital Logic Introduction to Logic Circuits: Boolean algebra Dr. D. J. Jackson Lecture 3-1 Axioms of Boolean algebra Boolean algebra: based on a set of rules derived from a small number of basic
More informationVerifying Properties of Parallel Programs: An Axiomatic Approach
Verifying Properties of Parallel Programs: An Axiomatic Approach By Susan Owicki and David Gries (1976) Nathan Wetzler nwetzler@cs.utexas.edu University of Texas, Austin November 3, 2009 Outline Introduction
More informationHoare 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«Software verification» The Long-Standing Software Safety and Security Problem. Computer hardware change of scale
«Software verification» Patrick Cousot Jerome C. Hunsaker Visiting Professor Massachusetts Institute of Technology Department of Aeronautics and Astronautics cousot mit edu www.mit.edu/~cousot The Long-Standing
More informationFirst order Logic ( Predicate Logic) and Methods of Proof
First order Logic ( Predicate Logic) and Methods of Proof 1 Outline Introduction Terminology: Propositional functions; arguments; arity; universe of discourse Quantifiers Definition; using, mixing, negating
More informationBackground reading on Hoare Logic
Background reading on Hoare Logic Mike Gordon Learning Guide for the CST Part II course. This document aims to provide background reading to support the lectures think of it as a free downloadable textbook.
More informationCS 336. We use the principle of inclusion and exclusion. Let B. = {five digit decimal numbers ending with a 5}, and
CS 336 1. The important issue is the logic you used to arrive at your answer. 2. Use extra paper to determine your solutions then neatly transcribe them onto these sheets. 3. Do not submit the scratch
More informationLogic. Propositional Logic: Syntax. Wffs
Logic Propositional Logic: Syntax Logic is a tool for formalizing reasoning. There are lots of different logics: probabilistic logic: for reasoning about probability temporal logic: for reasoning about
More informationDoc112: Hardware. Department of Computing, Imperial College London. Doc112: Hardware Lecture 1 Slide 1
Doc112: Hardware Department of Computing, Imperial College London Doc112: Hardware Lecture 1 Slide 1 First Year Computer Hardware Course Lecturers Duncan Gillies Bjoern Schuller Doc112: Hardware Lecture
More information