Formal Verification with Ada 2012

Size: px
Start display at page:

Download "Formal Verification with Ada 2012"

Transcription

1 Formal Verification with Ada 2012 A Very Simple Case Study Didier Willame Ada DevRoom, FOSEDM 2014 February 1, 2014

2 Content The Toy A Sandpile Simulator A Quick Reminder Floyd-Hoare Logic Design by Contract Tool Suite by AdaCore Overview Installation Get Started Conclusion References Iconography

3 Introduction Definitions verification dynamic verification testing static verification manual review formal verification - act of proving or disproving the correctness of implemented algorithms with respect to given formal properties and using formal methods of logic 1

4 The Toy A Sandpile Simulator - Overview Figure 1: a flow on a sand dune 2

5 The Toy A Sandpile Simulator - Overview Figure 2: a sandpile 3

6 The Toy A Sandpile Simulator - Physics open system - model in which sand grains enter regularly by a unique source (center of the ceiling) and drop out by the sides. conservative law - there is no spontaneous generation of sand grains nor spontaneous annihilation. gravity force - each sand grain spontaneousely falls from top to bottom (vertical move). pressure - the stability of each sand grain, in contact directly or not with the ground, is proportional to the number of grains just above it. break - an horizontal move into a neighbour cell is possible, if this neighbour cell is empty, and if the pressure is high enough (toppling and cascade). 4

7 The Toy A Sandpile Simulator - Concepts model of sandpiles physics of granular materials dynamical systems displaying self-organized criticality applications models for avanches models for earthquakes models for forest-fires etc. simulator 2-D cellular automaton update of cell state synchronous depends of state of the neighboring cells (Von Neumann of indeterminate range) race conditions solved by random decision 5

8 The Toy A Sandpile Simulator - 1-to-2 race 1-to-2 race - possible horizontal move of 1 grain of sand, in the contiguous empty cells example: Figure 3: an 1-to-2 race and falls 6

9 The Toy A Sandpile Simulator - 2-to-1 race 2-to-1 race - possible horizontal moves of 2 grains of sand, in the same empty cell example: Figure 4: a 2-to-1 race, falls and an horizontal move 7

10 The Toy A Sandpile Simulator - Conventions Convention 1 (cell states) A = {0, 1, g, v} 0 - empty 1 - settled (by a grain of sand) g - ground v - vacuum Convention 2 (neighborhood) [ lef t neighborhood ; current column ; right neighborhood ] neighborhood (N) ::= N column column N ɛ column ::= upper column A lower column column A A column ɛ 8

11 The Toy A Sandpile Simulator - Rules Rule 1 (no move) [ 1 ; 1 ; ] 1 {1, g} [ ; 1 ; ] Rule 2 (fall) [ ; 1 ; 0 ] [ ; 0 ; 1 ] 9

12 The Toy A Sandpile Simulator - Rules Rule 3 (left move) ; 1 ;. {1, g} > 1 ; 0 ; Rule 4 (right move) 1. 0 ; 1 ; 0. {1, g} > ; 0 ; 1 10

13 The Toy A Sandpile Simulator - Definitions Definition 1 (state transitions) deterministic transition (always occurs) > possible transition time dependency - during a computation loop, the neighborhood can change (race issue) fragility - probability of breaking σ( T (P i,j ) ) θ σ - sigmoid map (shift, slope) T - triangular density function (width) Pi,j - pressure on the cell i,j θ - threshold 11

14 The Toy A Sandpile Simulator - Definitions Definition 2 (sigmoid map) σ : R [ 1, 1] : x x 1 + x 2 Figure 5: the algebraic sigmoid (shift = 0.0 and slope = 1.0) 12

15 The Toy A Sandpile Simulator - Definitions Definition 3 (triangular density function) 1 + x if x [ 1, 0[ T : R [0, 1] : x 1 x if x [0, 1] 0 else 0 if x < 1 (1+x) 2 2 if x [ 1, 0[ F : R [0, 1] : x 1 (1 x)2 2 if x [0, 1] 1 if x > 1 { 2x 1 if x [0, 0.5[ F 1 : [0, 1] R : x 1 2(1 x) if x [0.5, 1] 13

16 The Toy A Sandpile Simulator - Design 1 procedure Agit Main i s 2 3 to beat out the rhythm ( the computing c y c l e s ) 4 Next Time : Time ; 5 6 begin 7 Agit Cellular Automaton. S t a r t ; 8 9 loop 10 Next Time := Clock ; to r e s t a r t the timer Agit Cellular Automaton. Add A Grain ; 13 Agit Cellular Automaton. Next ; 14 Agit Cellular Automaton. Show ; delay u n t i l Next Time ; 17 end loop ; Agit Cellular Automaton. Stop ; 20 end Agit Main ; Listing 1: The main procedure 14

17 The Toy A Sandpile Simulator - Design 1 type State Type i s new Natural range ; 2 empty or s e t t l e d 3 4 p r o t e c t e d type P r o t e c t e d S t a t e i s 5 entry Set ( S t a t e : i n State Type ) ; 6 f u n c t i o n Get r e t u r n State Type ; 7 8 p r i v a t e 9 C u r r e n t S t a t e : State Type ; 10 Not Busy : Boolean := True ; the guard 11 end P r o t e c t e d S t a t e ; S t a t e s : array ( X Coordinate range, Y Coordinate range ) 14 o f P r o t e c t e d S t a t e ; Listing 2: The specification of the array of states 15

18 The Toy A Sandpile Simulator - Design 1 t a s k type C e l l i s 2 entry S t a r t (X : i n X Coordinate ; 3 Y : i n Y Coordinate ) ; 4 entry Stop ; 5 entry Drive Out Fall And Break ; 6 entry Make Fall ; 7 end C e l l ; 8 9 type C e l l A c c e s s i s a c c e s s C e l l ; Automaton : array ( X Coordinate range, 12 Y Coordinate range ) o f C e l l A c c e s s ; Listing 3: The specification of the array of cells 16

19 The Toy A Sandpile Simulator - Design 1 type H oriz onta l Mov e Sid e i s ( NO HORIZONTAL MOVE, 2 LEFT, 3 RIGHT ) ; 4 type Horizontal Move Type i s 5 r e c o r d 6 X : X Coordinate ; 7 Y : Y Coordinate ; c u r r e n t c e l l ( s e t t l e d ) 8 Side : H o r i z o n t a l M o v e S i d e ; 9 end r e c o r d ; p r o t e c t e d P o s s i b l e B r e a k i s 12 entry I n s e r t ( Key : Sigmoid Type ; 13 Horizontal Move : Horizontal Move Type ) ; 14 procedure Reset ; 15 procedure Make Breaks ; p r i v a t e 18 Horizontal Move Map : P o s s i b l e B r e a k P a c k a g e. Map ; 19 Not Busy : Boolean := True ; the guard 20 end P o s s i b l e B r e a k ; Listing 4: The specification of the list of break events 17

20 The Toy A Sandpile Simulator - Design 1 procedure Next i s 2 begin 3 Automaton Rendezvous. Reset ; 4 f o r J i n Y Coordinate range loop 5 f o r I i n X Coordinate range loop 6 Automaton ( I, J ). Drive Out Fall And Break ; 7 end loop ; 8 end loop ; 9 Wait Until End Of Computation ; Automaton Rendezvous. Reset ; 12 f o r J i n Y Coordinate range loop 13 f o r I i n X Coordinate range loop 14 Automaton ( I, J ). Make Fall ; v e r t i c a l move 15 end loop ; 16 end loop ; 17 Wait Until End Of Computation ; P o s s i b l e B r e a k. Make Breaks ; h o r i z o n t a l moves 20 end Next ; Listing 5: The next procedure 18

21 A Quick Reminder Floyd-Hoare Logic - The Pioneers Figure 6: Alan Mathison Turing ( ) Checking a Large Routine, 1949 [4] (the first proof of a program) 19

22 A Quick Reminder Floyd-Hoare Logic - The Pioneers Figure 7: Robert W. Floyd ( ) Assigning Meaning to Programs, 1967 [2] (use of logical assertions on flowcharts) 20

23 A Quick Reminder Floyd-Hoare Logic - The Pioneers Figure 8: Sir Charles Antony Richard Hoare (1934 -) An Axiomatic Basis for Computer Programming, 1969 [3] (set of inference rules) 21

24 A Quick Reminder Floyd-Hoare Logic - The Pioneers Figure 9: Edsger Wybe Dijkstra ( ) Guarded Commands, Nondeterminacy and Formal Derivation of Programs, 1975 [1] (total correctness) 22

25 A Quick Reminder Floyd-Hoare Logic - A Program Language imperative programming - flow of statements that change the program state (how to do) syntax e ::= n x e op e n denotes an integer constant x denotes a variable identifier op ::= + = < > and or s ::= skip x := e s;s if e then s else s while e loop s in the conditional and the loop structures, { true when e 0 e denotes false when e = 0 23

26 A Quick Reminder Floyd-Hoare Logic - A Program Language semantics Σ - current program state Σ(x) - current value of the variable x [e]σ - evaluation Σ, s Σ, s - execution of the next step of s Σ, s Σ, s - execution reaches Σ and remains s Σ, s Σ, skip - terminating execution (if Σ exists) 24

27 = P - denotes that Σ = P holds, for any state Σ 25 A Quick Reminder Floyd-Hoare Logic - Propositions about Programs (declarative programming) declarative programming - description of the desired results (what to do) syntax (FOL) P ::= true false e P P P P P P P x, P x, P semantics e denotes an assertion written in the imperative language [P ]Σ - evaluation (valid or not) [e]σ - defined by [[e] Σ 0 Σ = P - formula [P ]Σ is valid (Σ satisfies P )

28 A Quick Reminder Floyd-Hoare Logic - Inference Rules Hoare triple {P }s{q} validity - {P }s{q} is valid, if s is executed in a state satisfying its precondition {P }, and if it terminates, then the resulting state satisfies its post-condition {Q}. {P }s{q} is valid iff Σ, Σ, (Σ = P Σ, s Σ, skip) (Σ = Q) 26

29 A Quick Reminder Floyd-Hoare Logic - Inference Rules Rule 1 (empty statement axiom schema) {P } skip {P } 27

30 A Quick Reminder Floyd-Hoare Logic - Inference Rules Rule 2 (assignment axiom schema) {P [x e]} x:=e {P } P [x e] denotes the assertion P in which each free occurrence of x has been replaced by the expression E {x + 1 = 43} y := x + 1 {y = 43} is valid 28

31 A Quick Reminder Floyd-Hoare Logic - Inference Rules Rule 3 (composition rule) {P }s 1 {Q}, {Q}s 2 {R} {P } s 1 ;s 2 {R} 29

32 A Quick Reminder Floyd-Hoare Logic - Inference Rules Rule 4 (conditional rule) {P (e 0)}s 1 {Q}, {P (e = 0)}s 2 {Q} {P } if (e 0) then s 1 else s 2 {Q} 30

33 A Quick Reminder Floyd-Hoare Logic - Inference Rules Rule 5 (consequence rule) P 1 P 2, {P 2 }s{q 2 }, Q 2 Q 1 {P 1 } s {Q 1 } This rule allows to strengthen the precondition {P 2 } and/or to weaken the postcondition {Q 2 } 31

34 A Quick Reminder Floyd-Hoare Logic - Inference Rules Rule 6 (while rule for partial correctness) {I (e 0)}s{I} {I} while (e 0) loop s {I (e = 0)} I is a loop invariant 32

35 A Quick Reminder Floyd-Hoare Logic - Inference Rules Rule 7 (while rule for total correctness) wf( ), {I (e 0) (v = ξ)}s{i (v ξ)} {I} while (e 0) loop s {I (e = 0)} wf( ) is a well-founded order relation v is a loop variant 33

36 A Quick Reminder Floyd-Hoare Logic - Case Study (addition by incrementation) Figure 10: a geometric interpretation of the addition 34

37 A Quick Reminder Floyd-Hoare Logic - Case Study (addition by incrementation) 1 module IncrementalAddition 2 3 use import i n t. I n t 4 use import r e f. Ref 5 6 l e t a d d I t e r a t i v e ( x : i n t ) ( y : i n t ) : i n t 7 r e q u i r e s { x >= 0 /\ y >= 0 } 8 e n s u r e s { r e s u l t = x + y } 9 = 10 l e t s = r e f x i n ( the sum ) 11 l e t r = r e f y i n ( the r e s t to add ) 12 w h i l e! r > 0 do 13 i n v a r i a n t {! r >= 0 /\! s +! r = x + y } 14 ( the d i s c r e t e l i n e L ::= r = ( x+y ) s ) 15 v a r i a n t {! r } 16 ( the move on L must be downward ) 17 s :=! s + 1 ; 18 r :=! r 1 19 done ; 20! s 21 end Listing 6: The why3 proof of the incremental addition. 35

38 A Quick Reminder Floyd-Hoare Logic - Why3 why3 (INRIA, LRI and CNRS) (see the gallery of verified programs) a platform for verification of algorithms, based on the Floyd-Hoare Logic IVC - Intermediate Verification Language (stepping stone between source languages and reasoning engines - e.g., Alt-Ergo or Coq) VC - Verification Condition (e.g., precondition, postcondition, loop invariant or loop variant) 36

39 A Quick Reminder Design by Contract Design by Contract (DbC) design approach requiring the definition of formal, precise and verifiable specifications, using verification conditions mastering Floyd-Hoare logic helps develop relevant VC (what means correctness?) 37

40 Tool Suite by AdaCore Overview Figure 11: why3, a chain link 38

41 Tool Suite by AdaCore Overview Figure 12: gratprove, an integrated tool 39

42 Tool Suite by AdaCore Installation - Linux 1. dowload the packages from select the platform x86 64-linux select the packages GNAT 2013 (development environment) SPARK-HiLite GPL 2013 (proof environment) 2. install the packages (Makefile) /usr/gnat 3. set enrironment variables PATH=$PATH:/usr/gnat/bin 40

43 Tool Suite by AdaCore Get Started - Documentation Various Projects and Technical Documents SPARK GNATprove

44 Tool Suite by AdaCore Get Started - Case Study (addition by incrementation) 1 package Incremental Add i s 2 3 f u n c t i o n Incremental Add ( X, Y : Natural ) 4 r e t u r n Natural 5 with 6 Pre => ( Y <= Natural Last X ), 7 Post => ( Incremental Add Result = X+Y ) ; 8 9 end Incremental Add ; Listing 7: incremental add.ads (the specifications) 42

45 Tool Suite by AdaCore Get Started - Case Study (addition by incrementation) 1 package body Incremental Add i s 2 f u n c t i o n Incremental Add ( X, Y : Natural ) 3 r e t u r n Natural i s 4 5 S : Natural := X; the sum 6 R : Natural := Y; the r e s t to add 7 begin 8 9 w h i l e ( R > 0 ) loop 10 pragma L o o p I n v a r i a n t ( (R>=0) and ( S+R=X+Y) ) ; 11 pragma Loop Variant ( De cr eas es => R ) ; S := S + 1 ; 14 R := R 1 ; 15 end loop ; r e t u r n S ; end Incremental Add ; 20 end Incremental Add ; Listing 8: incremental add.adb (the body) 43

46 Tool Suite by AdaCore Get Started - Case Study (addition by incrementation) 1 with Incremental Add ; 2 3 with Ada. Text IO, Ada. I n t e g e r T e x t I O ; 4 use Ada. Text IO, Ada. I n t e g e r T e x t I O ; 5 6 procedure Add i s 7 X : Natural ; 8 Y : Natural ; 9 Result : Natural ; 10 begin 11 put ( X: ) ; get ( X ) ; 12 put ( Y: ) ; get ( Y ) ; Result := Incremental Add. Incremental Add ( X, Y ) ; 15 Put ( X + Y = ) ; 16 Put Line ( Natural Image ( Result ) ) ; e x c e p t i o n 19 when C o n s t r a i n t E r r o r => 20 Put Line ( o v e r f l o w! ) ; 21 end Add ; Listing 9: add.adb (the main unit) 44

47 Tool Suite by AdaCore Get Started - Case Study (addition by incrementation) 1 p r o j e c t Add i s 2 3 f o r S o u r c e D i r s use ( add/ s r c / ) ; 4 5 f o r S o u r c e F i l e s use ( i n c r e m e n t a l a d d. adb, 6 i n c r e m e n t a l a d d. ads, 7 add. adb ) ; 8 9 f o r O b j ect D i r use. / add/ obj / ; 10 f o r Exec Dir use. / add/ bin / ; 11 f o r Main use ( add. adb ) ; package Compiler i s 14 f o r D e f a u l t S w i t c h e s ( ada ) use ( gnat12 ) ; 15 end Compiler ; end Add ; Listing 10: add.gpr (the GPS script) 45

48 Tool Suite by AdaCore Get Started - Case Study (addition by incrementation) the gnatprove invocation > gnatprove -Padd.gpr --report=all the output (the phases) Phase 1 of 3: frame condition computation... Phase 2 of 3: translation to intermediate language... Statistics logged in./add/obj/gnatprove/gnatprove.out (detailed info can be found in./add/obj/gnatprove/*.alfa) Phase 3 of 3: generation and proof of VCs... 46

49 Tool Suite by AdaCore Get Started - Case Study (addition by incrementation) the output (the analysis) analyzing Incremental_Add.Incremental_Add, 9 checks incremental_add.adb:10:10: info: loop invariant initialization proved incremental_add.adb:10:10: info: loop invariant preservation proved incremental_add.adb:10:47: info: overflow check proved incremental_add.adb:10:51: info: overflow check proved incremental_add.adb:11:10: info: loop variant proved incremental_add.adb:13:17: info: overflow check proved incremental_add.adb:14:17: info: range check proved incremental_add.ads:7:14: info: postcondition proved incremental_add.ads:7:42: info: overflow check proved analyzing precondition for Incremental_Add.Incremental_Add, 1 checks incremental_add.ads:6:34: info: overflow check proved 47

50 Tool Suite by AdaCore Get Started - Case Study (addition by incrementation) the gnatprove.out file Subprograms in SPARK : 50% (1/2)... already supported : 50% (1/2)... not yet supported : 0% (0/2) Subprograms not in SPARK : 50% (1/2) Subprograms not in SPARK due to (possibly more than one reason): exception : 50% (1/2) Subprograms not yet supported due to (possibly more than one reason): (none) Units with the largest number of subprograms in SPARK: incremental_add : 100% (1/1) Units with the largest number of subprograms not in SPARK: add : 100% (1/1) 48

51 Conclusion current status theoretical basis to develop relevant VC complex and funny enough toy to make exciting exercises next steps make available on the internet the toy s source code complete the source code of the toy with relevant VC start a blog to discuss the relevance of the used VC use and/or develop with Jacob Sparre Andersen, the Jacob s tutorial about the design by contract 49

52 Thanks! Any questions?

53 References [1] Edsger W. Dijkstra, Guarded commands, nondeterminacy and formal derivation of programs, Commun. ACM 18 (1975), no. 8, pp [2] Robert W. Floyd, Assigning meaning to programs, Proceedings of Symposium on Applied Mathematics Mathematical Aspects of Computer Science (1967), no. 19, pp [3] C. A. R. Hoare, An axiomatic basis for computer programming, Commun. ACM 12 (1969), no. 10, pp [4] A. M. Turing, Checking a large routine, EDSAC Inaugural Conference, Report of a Conference on High Speed Automatic Calculating machines, Mathematical Laboratory, Cambridge, 24 June 1949, pp

54 Iconography fig. 1 : John K. Nakata (Landslides in art part 11) fig. 6 : faetopia.com fig. 7 : www-cs.stanford.edu fig. 8 : Rama (en.wikipedia.org) fig. 9 : Hamilton Richards (en.wikipedia.org) fig. 11 : Jean-Christophe Filliâtre (Deductive Program Verification with Why3, 2013) fig. 12 : Hi-Lite (project description, 2013) fig. 13 : Yale Babylonian Collection fig. 14 : University of Pennsylvania fig. 2, 3, 4, 5 and 10 : Didier Willame (Argonauts-IT Ltd)

55 Figure 13: Old Babylonian clay tablet (circa BCE), showing a computation of 2

56 Figure 14: fragment of Euclid s Elements (Oxyrhynchus papyrus I 29, circa A.D.), showing a sketch of the proof of the pythagorean theorem

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

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

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

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

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

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

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

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

Last Time. Inference Rules

Last 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 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

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

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

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

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

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

Foundations of Computation

Foundations 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 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

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

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

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

Reasoning About Imperative Programs. COS 441 Slides 10b

Reasoning 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 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

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

Probabilistic Guarded Commands Mechanized in HOL

Probabilistic 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 information

Verifying Properties of Parallel Programs: An Axiomatic Approach

Verifying 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 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

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

Proof Calculus for Partial Correctness

Proof 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 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

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

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

Axiomatic 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 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 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 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

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

Weakest Precondition Calculus

Weakest 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 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

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

Introduction to Axiomatic Semantics

Introduction to Axiomatic Semantics Introduction to Axiomatic Semantics Meeting 9, CSCI 5535, Spring 2009 Announcements Homework 3 is out, due Mon Feb 16 No domain theory! Homework 1 is graded Feedback attached 14.2 (mean), 13 (median),

More information

CS558 Programming Languages

CS558 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 information

Software Engineering

Software 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 information

COMP2111 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. 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 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

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

(La méthode Event-B) Proof. Thanks to Jean-Raymond Abrial. Language of Predicates.

(La méthode Event-B) Proof. Thanks to Jean-Raymond Abrial. Language of Predicates. CSC 4504 : Langages formels et applications (La méthode Event-B) J Paul Gibson, A207 paul.gibson@it-sudparis.eu http://www-public.it-sudparis.eu/~gibson/teaching/event-b/ Proof http://www-public.it-sudparis.eu/~gibson/teaching/event-b/proof.pdf

More information

Software Analysis AdaCore

Software Analysis AdaCore Software Analysis Tools @ AdaCore Yannick Moy LSL Seminar, CEA-LIST December 8 th, 2009 Outline Ada & AdaCore Dynamic Analysis Tools @ AdaCore Static Analysis Tools @ AdaCore Project Hi-Lite 1 / 46 Outline

More information

A Humble Introduction to DIJKSTRA S A A DISCIPLINE OF PROGRAMMING

A Humble Introduction to DIJKSTRA S A A DISCIPLINE OF PROGRAMMING A Humble Introduction to DIJKSTRA S A A DISCIPLINE OF PROGRAMMING Do-Hyung Kim School of Computer Science and Engineering Sungshin Women s s University CONTENTS Bibliographic Information and Organization

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

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

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

The Expressivity of Universal Timed CCP: Undecidability of Monadic FLTL and Closure Operators for Security

The Expressivity of Universal Timed CCP: Undecidability of Monadic FLTL and Closure Operators for Security The Expressivity of Universal Timed CCP: Undecidability of Monadic FLTL and Closure Operators for Security Carlos Olarte and Frank D. Valencia INRIA /CNRS and LIX, Ecole Polytechnique Motivation Concurrent

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

1 Introduction. 2 First Order Logic. 3 SPL Syntax. 4 Hoare Logic. 5 Exercises

1 Introduction. 2 First Order Logic. 3 SPL Syntax. 4 Hoare Logic. 5 Exercises Contents 1 Introduction INF5140: Lecture 2 Espen H. Lian Institutt for informatikk, Universitetet i Oslo January 28, 2009 2 Proof System 3 SPL 4 GCD 5 Exercises Institutt for informatikk (UiO) INF5140:

More information

CIS (More Propositional Calculus - 6 points)

CIS (More Propositional Calculus - 6 points) 1 CIS6333 Homework 1 (due Friday, February 1) 1. (Propositional Calculus - 10 points) --------------------------------------- Let P, Q, R range over state predicates of some program. Prove or disprove

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

Automata-Theoretic Model Checking of Reactive Systems

Automata-Theoretic Model Checking of Reactive Systems Automata-Theoretic Model Checking of Reactive Systems Radu Iosif Verimag/CNRS (Grenoble, France) Thanks to Tom Henzinger (IST, Austria), Barbara Jobstmann (CNRS, Grenoble) and Doron Peled (Bar-Ilan University,

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

Bilateral Proofs of Safety and Progress Properties of Concurrent Programs (Working Draft)

Bilateral Proofs of Safety and Progress Properties of Concurrent Programs (Working Draft) Bilateral Proofs of Safety and Progress Properties of Concurrent Programs (Working Draft) Jayadev Misra December 18, 2015 Contents 1 Introduction 3 2 Program and Execution Model 4 2.1 Program Structure..........................

More information

Introduction to Kleene Algebra Lecture 14 CS786 Spring 2004 March 15, 2004

Introduction to Kleene Algebra Lecture 14 CS786 Spring 2004 March 15, 2004 Introduction to Kleene Algebra Lecture 14 CS786 Spring 2004 March 15, 2004 KAT and Hoare Logic In this lecture and the next we show that KAT subsumes propositional Hoare logic (PHL). Thus the specialized

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

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

Formal Specification and Verification. Specifications

Formal 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 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

THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600/COMP6260 (Formal Methods for Software Engineering)

THE 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 information

ICS141: Discrete Mathematics for Computer Science I

ICS141: Discrete Mathematics for Computer Science I ICS141: Discrete Mathematics for Computer Science I Dept. Information & Computer Sci., Jan Stelovsky based on slides by Dr. Baek and Dr. Still Originals by Dr. M. P. Frank and Dr. J.L. Gross Provided by

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

Problem Sheet 1: Axiomatic Semantics

Problem Sheet 1: Axiomatic Semantics Problem Sheet 1: Axiomatic Semantics Chris Poskitt ETH Zürich Starred exercises ( ) are more challenging than the others. 1 Partial and Total Correctness Recall the Hoare triple from lectures, {pre} P

More information

Control Predicates Are Better Than Dummy Variables For Reasoning About Program Control

Control Predicates Are Better Than Dummy Variables For Reasoning About Program Control Control Predicates Are Better Than Dummy Variables For Reasoning About Program Control LESLIE LAMPORT Digital Equipment Corporation When explicit control predicates rather than dummy variables are used,

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. 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

Soundness and Completeness of Axiomatic Semantics

Soundness 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 information

THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600 (Formal Methods for Software Engineering)

THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester COMP2600 (Formal Methods for Software Engineering) THE AUSTRALIAN NATIONAL UNIVERSITY Second Semester 2012 COMP2600 (Formal Methods for Software Engineering) Writing Period: 3 hours duration Study Period: 15 minutes duration Permitted Materials: One A4

More information

Lecture 17: Floyd-Hoare Logic for Partial Correctness

Lecture 17: Floyd-Hoare Logic for Partial Correctness Lecture 17: Floyd-Hoare Logic for Partial Correctness Aims: To look at the following inference rules Page 1 of 9 sequence; assignment and consequence. 17.1. The Deduction System for Partial Correctness

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

Logic. Propositional Logic: Syntax

Logic. Propositional Logic: Syntax 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 information

«Software verification» The Long-Standing Software Safety and Security Problem. Computer hardware change of scale

«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 information

Verification Frameworks and Hoare Logic

Verification 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 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

Lecture Notes on Inductive Definitions

Lecture Notes on Inductive Definitions Lecture Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 August 28, 2003 These supplementary notes review the notion of an inductive definition and give

More information

What? Correctness? Bugs!

What? Correctness? Bugs! Program Correctness Literatuur Verification of Sequential and Concurrent Programs. Krzysztof R. Apt, Frank S. de Boer, Ernst-Rüdiger Olderog. Series: Texts in Computer Science. Springer. 3rd ed. 2nd Printing.

More information

Program Verification Using Separation Logic

Program Verification Using Separation Logic Program Verification Using Separation Logic Cristiano Calcagno Adapted from material by Dino Distefano Lecture 1 Goal of the course Study Separation Logic having automatic verification in mind Learn how

More information

Design of Embedded Systems: Models, Validation and Synthesis (EE 249) Lecture 9

Design of Embedded Systems: Models, Validation and Synthesis (EE 249) Lecture 9 Design of Embedded Systems: Models, Validation and Synthesis (EE 249) Lecture 9 Prof. Dr. Reinhard von Hanxleden Christian-Albrechts Universität Kiel Department of Computer Science Real-Time Systems and

More information

From Hoare Logic to Matching Logic

From Hoare Logic to Matching Logic From Hoare Logic to Matching Logic Grigore Roşu and Andrei Ştefănescu Department of Computer Science, University of Illinois at Urbana-Champaign {grosu, stefane1}@illinois.edu Abstract. Matching logic

More information

Hence, the sequence of triangular numbers is given by., the. n th square number, is the sum of the first. S n

Hence, the sequence of triangular numbers is given by., the. n th square number, is the sum of the first. S n Appendix A: The Principle of Mathematical Induction We now present an important deductive method widely used in mathematics: the principle of mathematical induction. First, we provide some historical context

More information

Solutions 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) 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 information

Lecture Notes on Inductive Definitions

Lecture Notes on Inductive Definitions Lecture Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 September 2, 2004 These supplementary notes review the notion of an inductive definition and

More information

Deterministic Program The While Program

Deterministic 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 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

3 Propositional Logic

3 Propositional Logic 3 Propositional Logic 3.1 Syntax 3.2 Semantics 3.3 Equivalence and Normal Forms 3.4 Proof Procedures 3.5 Properties Propositional Logic (25th October 2007) 1 3.1 Syntax Definition 3.0 An alphabet Σ consists

More information

Decision 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 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 information

Dynamic Noninterference Analysis Using Context Sensitive Static Analyses. Gurvan Le Guernic July 14, 2007

Dynamic Noninterference Analysis Using Context Sensitive Static Analyses. Gurvan Le Guernic July 14, 2007 Dynamic Noninterference Analysis Using Context Sensitive Static Analyses Gurvan Le Guernic July 14, 2007 1 Abstract This report proposes a dynamic noninterference analysis for sequential programs. This

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

Matching Logic: Syntax and Semantics

Matching Logic: Syntax and Semantics Matching Logic: Syntax and Semantics Grigore Roșu 1 and Traian Florin Șerbănuță 2 1 University of Illinois at Urbana-Champaign, USA grosu@illinois.edu 2 University of Bucharest, Romania traian.serbanuta@unibuc.ro

More information

Mid-Semester Quiz Second Semester, 2012

Mid-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 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

Time and Timed Petri Nets

Time and Timed Petri Nets Time and Timed Petri Nets Serge Haddad LSV ENS Cachan & CNRS & INRIA haddad@lsv.ens-cachan.fr DISC 11, June 9th 2011 1 Time and Petri Nets 2 Timed Models 3 Expressiveness 4 Analysis 1/36 Outline 1 Time

More information

Logical Time. 1. Introduction 2. Clock and Events 3. Logical (Lamport) Clocks 4. Vector Clocks 5. Efficient Implementation

Logical Time. 1. Introduction 2. Clock and Events 3. Logical (Lamport) Clocks 4. Vector Clocks 5. Efficient Implementation Logical Time Nicola Dragoni Embedded Systems Engineering DTU Compute 1. Introduction 2. Clock and Events 3. Logical (Lamport) Clocks 4. Vector Clocks 5. Efficient Implementation 2013 ACM Turing Award:

More information

Marie Farrell Supervisors: Dr Rosemary Monahan & Dr James Power Principles of Programming Research Group

Marie Farrell Supervisors: Dr Rosemary Monahan & Dr James Power Principles of Programming Research Group EXAMINING REFINEMENT: THEORY, TOOLS AND MATHEMATICS Marie Farrell Supervisors: Dr Rosemary Monahan & Dr James Power Principles of Programming Research Group PROBLEM Different formalisms do not integrate

More information

Logic. Propositional Logic: Syntax. Wffs

Logic. 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 information

Programming Languages

Programming 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 information