Proving an Asynchronous Message Passing Program Correct

Size: px
Start display at page:

Download "Proving an Asynchronous Message Passing Program Correct"

Transcription

1 Available at the COMP3151 website. Proving an Asynchronous Message Passing Program Correct Kai Engelhardt Revision: 1.4 This note demonstrates how to construct a correctness proof for a program that uses asynchronous message passing. Because we do not have a tailor-made proof method for such programs, we translate the program faithfully into a synchronous transition diagram, i.e., a representation for which we do have a proof method. Of the available proof methods we shall explore three: (a) Floyd s method applied in a brute-force fashion to the product transition diagram, (b) the Levin & Gries method which applies directly to synchronous transition diagrams without the need to calculate the product diagram, and (c) the compositional method, also applied to the synchronous transition diagram. Contents 1. Problem Statement: Sequence Transmission Specification Task Programming Task Verification Task Specification 2 3. C + MPI Program 2 4. Verification Asynchronous Transition Diagram P async Synchronous Transition Diagram P sync Ellipsis: A Brute Force Proof Assertion Network Proof Obligations Proving Partial Correctness with Levin & Gries First Attempt Second Attempt Proving Partial Correctness with the Compositional Method Three Compositionally-Inductive Assertion Networks Proving Termination φ k (a[k] = eof)-convergence Deadlock-Freedom A. Floyd s Method 10 B. Levin & Gries s Method 10 1

2 1. Problem Statement: Sequence Transmission Develop a program that transmits the content of a file from one node in a network to another Specification Task Formalise the informal requirements. The safety aspects should be acaptured in pre- and postconditions φ and ψ in a suitable assertion language such as predicate logic Programming Task Write a C + MPI program P C+MPI that implements the specification Verification Task Show that the program is correct w.r.t. the informal requirements. More precisely, this amounts to the following tasks: 1. Faithfully translate the program into an asynchronous transition system P async. 2. Translate P async into a synchronous transition system P sync. 3. Prove { φ P sync { ψ. 4. Prove termination: a) Find a precondition φ and prove φ -convergence of P sync. b) Prove deadlock-freedom of P sync. 2. Specification Suppose the input file is an eof-terminated sequence a of items that is to be copied to the sequence b by program P. The safety aspects of this can be captured by the following Hoare triple. {true P { i ( k i (b[k] = a[k] (a[k] = eof k = i))) (1) The liveness aspect would be that P is ( k (a[k] = eof))-convergent and deadlock-free. 3. C + MPI Program / MPI program to transmit a sequence of values from one process to another Compilation: mpicc Wall transmit. mpi.c o transmit. mpi Synopsis: mpirun n 2 transmit. mpi [ infile [ outfile ]] / #include <mpi.h> #include <stdio.h> #include < stdlib.h> int main ( int argc, char argv []) { int myid, otherid, size ; int tag = 1; MPI_Status status ; / initialize MPI and get own id (rank) / MPI_Init (&argc, &argv); 2 Id: asyncproofexample.tex,v /10/06 01:53:53 kaie Exp

3 MPI_Comm_rank (MPI_COMM_WORLD, &myid); MPI_Comm_size (MPI_COMM_WORLD, &size); if ( size!= 2) { fprintf ( stderr, "Error : use exactly two processes\ n" ); exit (EXIT_FAILURE); otherid = 1 myid; if (myid == 0) { / sender / / sort out where to read from / FILE infilep = stdin ; if (argc > 1) { if (( infilep = fopen (argv [1], "r" )) == NULL) { fprintf ( stderr, "Error : Couldn t open %s\n", argv [1]); exit (EXIT_FAILURE); int ci ; do { ci = fgetc ( infilep ); printf (" process %d sending %c to process %d\n", myid, (char) ci, otherid ); MPI_Send (&ci, 1, MPI_INT, otherid, tag, MPI_COMM_WORLD); while ( ci!= EOF); fclose ( infilep ); else { / receiver / / sort out where to write to / FILE outfilep = stdout ; if (argc > 2) { if (( outfilep = fopen (argv [2], "w")) == NULL) { fprintf ( stderr, "Error : Couldn t open %s\n", argv [2]); exit (EXIT_FAILURE); int co; do { MPI_Recv (&co, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status); printf (" process %d received a %c\n", myid, (char) co); while (co!= EOF && fputc (co, outfilep )!= EOF); fclose ( outfilep ); MPI_Finalize (); return EXIT_SUCCESS; Translating the program to Promela is not really feasible because there are no unbounded asynchronous channels in Promela. Nevertheless, it may make sense to do so. #define f(x) 20 x #define CHANSIZE 5 #define EOF 1 chan C = [CHANSIZE] of { short active proctype P0 () { short i = 0; do LATEXed on October 6,

4 :: C! f( i ) if :: f( i ) == EOF > break :: else > fi i = i+1 od active proctype P1 () { short x; do :: C? x if :: x == EOF > break :: else > fi od This code can be used in a variety of ways. We can simulate it randomly, verify that f values are transmitted in order, verify that termination of both processes follows from having an i such that f (i) = EOF, or verify that any number of values transmitted by P0 is actually received by P1 even if there s no i with f (i) = EOF. 4. Verification 4.1. Asynchronous Transition Diagram P async Fig. 4.1 contains our faithful model of the program as an asynchronous transition diagram. (In quotes because we ve never really defined such a thing. Suffices to say that it s syntactically indistinguishable from a synchronous one, only the semantics assumes asynchronous message passing, i.e., channels modeled as FIFO queues, non-bocking sends and blocking receives.) a[i] EOF; C!a[i] i := i+1 C?b[j] j := j+1 s a[i] = EOF; C!a[i] i := i+1 s' j > 0 b[j-1] = EOF t t' Figure 1: Asynchronous transition diagram P async Synchronous Transition Diagram P sync Fig. 4.2 contains the translation of P async into a synchronous transition diagram P sync. Observe that the two processes did not change at all except for renaming one half of the channel. A third process was added to act as the asynchronous channel. We adapt the partial correctness claim one should prove to { i = 0 j = 0 q = [ ] Psync { b[0.. j 1] = a[0..i 1] a[i 1] = eof (2) to accommodate the initialisations of the local variables of the processes. 4 Id: asyncproofexample.tex,v /10/06 01:53:53 kaie Exp

5 a[i] EOF; C!a[i] i := i+1 D?b[j] j := j+1 C?x q := (q:x) s s' a[i] = EOF; C!a[i] i := i+1 s q q = [EOF]; D!EOF q := [ ] t q j > 0 b[j-1] = EOF t q = (x:q') [EOF]; D!x q := q' t' Figure 2: Synchronous transition diagram P sync with an explicit buffer process. Remark 1 This is harmless and could be avoided by having one extra location and transition in each process to initialise the variables but doing would add nothing of interest to the task. Second, one should prove that P sync is (i = 0 j = 0 q = [ ] k (a[k] = eof))-convergent and deadlock-free. 5. Ellipsis: A Brute Force Proof Instead of using one of the more sophisticated proof methods (Levin & Gries or AFR), we calculate the product transition system. This is feasible because the resulting transition diagram is still relatively small. It has at most 8 states (2 2 2). A casual inspection of the three processes reveals that half of these 8 states are unreachable. See Fig. 5 for the remaining transition diagram P Floyd. a[i] EOF i,q := i+1,(q:a[i]) q = (x:q') [EOF] q,b[j],j := q',x,j+1 s,s q,s' a[i] = EOF q,i := (q:a[i]),i+1 t,t q,t' j > 0 b[j-1] = EOF t,s q,s' q = [EOF] q,b[j],j := [ ],EOF,j+1 t,t q,s' q = (x:q') [EOF] q,b[j],j := q',x,j+1 Figure 3: Product transition diagram P Floyd Assertion Network As usual, all our assertions share an invariant I = i 0 j 0 a[0..i 1] = b[0.. j 1] ++ q Q s,sq,s = I (i > 0 a[i 1] eof) Q t,sq,s = I i > 0 a[i 1] = eof Q t,tq,s = I i > 0 a[i 1] = eof q = [ ] LATEXed on October 6,

6 Q t,tq,t = I i > 0 a[i 1] = eof q = [ ] 5.2. Proof Obligations Each of the six transitions gives rise to one proof obligation. = Q s,sq,s a[i] eof (Q s,s q,s ) (i, q := i + 1, (q : a[i])) (3) = Q s,sq,s q = (x : q ) [eof] (Q s,sq,s ) (q, b[j], j := q, x, j + 1) (4) = Q s,sq,s a[i] = eof (Q t,s q,s ) (i, q := i + 1, (q : a[i])) (5) = Q t,sq,s q = (x : q ) [eof] (Q t,sq,s ) (q, b[j], j := q, x, j + 1) (6) = Q t,sq,s q = [eof] (Q t,t q,s ) (q, b[j], j := [ ], eof, j + 1) (7) = Q t,tq,s j > 0 b[j 1] = eof Q t,t q,t (8) Besides these proof obligations, we also must show that pre-, resp., postcondition relate to the initial, resp., final assertion. = i = 0 j = 0 q = [ ] Q s,sq,s (9) = Q t,tq,s b[0.. j 1] = a[0..i 1] a[i 1] = eof (10) 6. Proving Partial Correctness with Levin & Gries Let us return to Fig According to Levin & Gries, we may need to augment the synchronous transition diagram with auxiliary variables before being able to express the assertions First Attempt As demonstrated in class, it suffices to add a single history variable h for recording communication, similar in nature to the one we ve met when we discussed the open semantics. We write h {X for the sequence of values recorded in h for communications along channel X. Let #s denote the length of sequence s. a[i] EOF; C!a[i] i,h := i+1,h D?b[j] j := j+1 C?x q := (q:x) s s' a[i] = EOF; C!a[i] i,h := i+1,h s q q = [EOF]; D!EOF q,h := [ ],h t q j > 0 b[j-1] = EOF t q = (x:q') [EOF]; D!x q,h := q',h t' Figure 4: Synchronous transition diagram P sync. Q s = i 0 a[0..i 1] = h {C eof a[0..i 1] Q t = i > 0 a[0..i 1] = h {C eof a[0..i 2] a[i 1] = eof Q sq = h {D ++ q = h {C eof h {C [0..#(h {C ) 2] Q tq = h [ ] q = [ ] h {D = h {C eof h {C [0..#(h {C ) 2] h {C [#(h {C ) 1] = eof Q s = j 0 b[0.. j 1] = h {D eof b[0.. j 2] Q t = j > 0 b[0.. j 1] = h {D eof b[0.. j 2] b[j 1] = eof In retrospect, using a single auxiliary variable complicates notation. 6 Id: asyncproofexample.tex,v /10/06 01:53:53 kaie Exp

7 6.2. Second Attempt We now move to two separate auxiliary variables h for channel C and h for channel D. a[i] EOF; C!a[i] i,h := i+1,h D?b[j] j := j+1 C?x q := (q:x) s s' a[i] = EOF; C!a[i] i,h := i+1,h s q q = [EOF]; D!EOF q,h' := [ ],h' t q j > 0 b[j-1] = EOF t q = (x:q') [EOF]; D!x q,h' := q',h' t' Figure 5: Augmented synchronous transition diagram P sync. We propose the following assertion network in accordance with point 2 of Levin & Gries s method (see Appendix B). Q s = i 0 a[0..i 1] = h eof a[0..i 1] Q t = i > 0 a[0..i 1] = h eof a[0..i 2] a[i 1] = eof Q sq = h ++ q = h eof h[0..#h 2] Q tq = h [ ] q = [ ] h = h eof h[0..#h 2] h[#h 1] = eof Q s = j 0 b[0.. j 1] = h eof b[0.. j 2] Q t = Q s j > 0 b[j 1] = eof For local correctness (point 3 of Levin & Gries) we note that there s only a single internal transition, from s to t in P 3. The resulting proof obligation, = Q s j > 0 b[j 1] = eof Q s j > 0 b[j 1] = eof is immediate. There are four syntactically matching pairs of I/O-transitions. Each one of them gives rise to a proof obligation. = Q s Q sq a[i] eof (Q s Q sq ) (i, h := i + 1, h ++ [a[i]]) (q := (q : x)) (x := a[i]) (11) = Q s Q sq a[i] = eof (Q t Q sq ) (i, h := i + 1, h ++ [a[i]]) (q := (q : x)) (x := a[i]) (12) = Q sq Q s q = (x : q ) [eof] (Q sq Q s ) (q, h := q, h ++ [x]) ( j := j + 1) (b[j] := x) (13) = Q sq Q s q = [eof] [eof] (Q tq Q s ) (q, h := [ ], h ++ [x]) ( j := j + 1) (b[j] := x) (14) All these should be checked, preferably by a machine. To demonstrate how this would be done on paper, we pick just one, say, (13). We begin on the RHS (right-hand side) of the implication and work our way backwards through a sequence of (or ) steps until we reach the LHS. The reason for proceeding right-to-left is that here, the RHS has more structure with its three occurrences of. Let σ be a state. σ = (Q sq Q s ) (q, h := q, h ++ [x]) ( j := j + 1) (b[j] := x) translating the update functions into substitutions (see Remark 2 below) σ = (Q sq Q s )[ q,h ++[x] / q,h ][ j+1 / j ][ (b:j x) / b ] def s of the assertions ( h σ = ++ q = h eof h[0..#h 2] j 0 b[0.. j 1] = h eof b[0.. j 2] performing the substitutions ) [ q,h ++[x] / q,h ][ j+1 / j ][ (b:j x) / b ] LATEXed on October 6,

8 σ = σ = h ++ [x] ++ q = h eof h[0..#h 2] j (b : j x)[0.. j + 1 1] = h ++ [x] eof (b : j x)[0.. j + 1 2] logic (see Remark 3 below) h ++ q = h eof h[0..#h 2] j 0 b[0.. j 1] = h eof b[0.. j 2] q = (x : q ) [eof] def s of the assertions σ = Q sq Q s q = (x : q ) [eof] Remark 2 Note that in the first step the order of the substitutions is relevant because we re first receiving into the array cell b[j] and then update j. In Hoare logic, we could express the entire proof obligation as { Qsq Q s q = (x : q ) [eof] b[j] := x; j := j + 1; q, h := q, h ++ [x] { Q sq Q s Using the sequential composition rule and the assignment axioms of Hoare logic we obtain that the substitutions need to be applied in the opposite order of the execution of the assignment statements. Remark 3 The step justified by logic above is the only interesting one. If in doubt, one ought to spend a few more words on justifying why this is a valid implication. Observe that, by our choice of auxiliary variables, all interference freedom tests (point 4 of Levin & Gries) are trivially satisfied because the only processes referring to a history variable are those two using the channel associated with that history variable. The state transformer f in point 5 could be just (h, h := [ ], [ ]). The last two points of Levin & Gries are then obvious. 7. Proving Partial Correctness with the Compositional Method With the compositional method, we prove properties of the three processes in Fig. 4.2 independently and then combine the properties using the parallel composition rule. Observe that the auxiliary variable h introduced explicitly in our first attempt using Levin & Gries in Section 6.1 is implicitly maintained in the compositional method. We therefore begin with the assertion network defined in that section Three Compositionally-Inductive Assertion Networks Let us call the three processes of the synchronous transition diagram presented in Fig. 4.2 S (for sender), A (for asychronous channel), and R (for receiver). The sender s assertion network is just Q s = (i 0 a[0..i 1] = h {C eof a[0..i 1]) Q t = (i > 0 a[0..i 1] = h {C eof a[0..i 2] a[i 1] = eof) followed by A s assertion network Q sq = (h {D ++ q = h {C eof h {C [0..#(h {C ) 2]) Q tq and, finally, R s. = (h [ ] q = [ ] h {D = h {C eof h {C [0..#(h {C ) 2] h {C [#(h {C ) 1] = eof) Q s = ( j 0 b[0.. j 1] = h {D eof b[0.. j 2]) Q t = ( j > 0 b[0.. j 1] = h {D eof b[0.. j 2] b[j 1] = eof) To prove that these are compositionally-inductive, we discharge seven proof obligations one for each transition. ( ) i 0 a[0..i 1] = h {C = eof a[0..i 1] a[i] eof (15) (i 0 a[0..i 1] = h {C eof a[0..i 1]) ([i := i + 1] [h := h ++ [(C, a[i])]]) 8 Id: asyncproofexample.tex,v /10/06 01:53:53 kaie Exp

9 = i 0 a[0..i 1] = h {C eof a[0..i 1] a[i] = eof (i > 0 a[0..i 1] = h {C eof a[0..i 2] a[i 1] = eof) ([i := i + 1] [h := h ++ [(C, a[i])]]) = h {D ( ++ q = h {C eof h {C [0..#(h {C ) 2] ) (h {D x ++ q = h {C eof h {C [0..#(h {C ) 2]) ([q := q ++ [x]] [h := h ++ [(C, x)]]) ( h {D = ++ q = h {C eof h {C [0..#(h {C ) 2] q = ([v] ++ q ) ) [eof] (h {D ++ q = h {C eof h {C [0..#(h {C ) 2]) ([q := q ] [h := h ++ [(D, v)]]) = h {D ++ q = h {C eof h {C [0..#(h {C ) 2] q = [eof] (h [ ] q = [ ] h {D = h {C eof h {C [0..#(h {C ) 2] h {C [#(h {C ) 1] = eof) ([q := [ ]] [h := h ++ [(D, eof)]]) = j 0 ( b[0.. j 1] = h {D eof b[0.. j 2] ) ( j 0 b[0.. j 1] = h {D b[j] eof b[0.. j 2]) ([j := j + 1] [h := h ++ [(D, b[j])]]) ( j 0 b[0.. j 1] = h {D = eof b[0.. j 2] j > 0 b[j 1] = eof j > 0 b[0.. j 1] = h {D eof b[0.. j 2] b[j 1] = eof By the diagram rule, discharging all these by proof establishes three triples. {Q s S {Q t { { Qsq A Qtq {Q s S {Q t Using the parallel composition rule twice, we arrive at: { { Qs Q sq Q s S A R Qt Q tq Q t Next we use the consequence rule with the additional premises to establish i = 0 j = 0 q = [ ] h = [ ] Q s Q sq Q s (26) Q t Q tq Q t b[0.. j 1] = a[0..i 1] a[i 1] = eof (27) {i = 0 j = 0 q = [ ] h = [ ] S A R {b[0.. j 1] = a[0..i 1] a[i 1] = eof (28) Finally, an application of the initialization rule yields as desired. {i = 0 j = 0 q = [ ] S A R {b[0.. j 1] = a[0..i 1] a[i 1] = eof ) (16) (17) (18) (19) (20) (21) (22) (23) (24) (25) 8. Proving Termination 8.1. φ k (a[k] = eof)-convergence Let k 0 be the smallest k such that a[k] = eof. The ranking functions are: ρ s = k 0 i + 2 ρ t = ρ tq = ρ t = 0 ρ sq = 2k 0 (#h + #h ) + 3 ρ s = Deadlock-Freedom Each one of the seven global locations (i.e., triples consisting of one location for each of our three processes) different from the terminal one, (t, t q, t ), is live, that is, for location (l 1, l 2, l 3 ), if the three assertions Q l1, Q l2, and Q l3 are satisfied, then there exists an enabled internal transition (or a matching pair of enabled I/O-transitions) leaving from either of these locations. LATEXed on October 6,

10 A. Floyd s Method To prove {φ P {ψ for a transition diagram P = (L, T, s, t) proceed as follows: 1. Choose an assertion network (Q l ) l L. 2. For every transition l = Q l b Q l f. 3. Prove = φ Q s. 4. Prove = Q t ψ. b f l T prove: B. Levin & Gries s Method To prove {φ P {ψ for a synchronous transition diagram P = P 1... P n, where the P i = (L i, T i, s i, t i ) are such that the processes location sets L i are pairwise disjoint and the processes variable sets are pairwise disjoint, we proceed as follows: 1. Augment each of the P i by introducing (shared) auxiliary variables z, which should occur in neither P, nor φ, nor ψ. Every I/O transition α f is extended to α f g, where g is a state transformation such that its write variables are amongst the elements of the vector z. This leads to an augmented synchronous transition diagram P = P 1... P n with transition relations T 1,... T n. 2. Choose an assertion network (Q l ) l ni=1 L i such that assertions for locations of process P i involve only program variables of P i and and auxiliary variables. 3. Prove (local correctness) for every P i : for every internal transition l b f l T i prove: = Q l b Q l f. For all i j and matching pairs of I/O transitions l i = Q li Q lj b b (Q l i Q l j ) f g (x := e). b;c!e f l i T i and l j b ;C?x g l j T j show that b i ;C!e f i 4. Prove interference freedom for matching pairs l i l i T i and l j of process P m, m i, j: = Q li Q lj Q lm b i b j Q lm f i f j (x := e) b j ;C?x f j l j T j, and location l m 5. Prove = φ ( n i=1 Q si ) f for some state transformation f whose write variables are auxiliary. 6. Prove = n i=1 Q ti ψ. 10 Id: asyncproofexample.tex,v /10/06 01:53:53 kaie Exp

Introductory MPI June 2008

Introductory MPI June 2008 7: http://people.sc.fsu.edu/ jburkardt/presentations/ fdi 2008 lecture7.pdf... John Information Technology Department Virginia Tech... FDI Summer Track V: Parallel Programming 10-12 June 2008 MPI: Why,

More information

Lecture 24 - MPI ECE 459: Programming for Performance

Lecture 24 - MPI ECE 459: Programming for Performance ECE 459: Programming for Performance Jon Eyolfson March 9, 2012 What is MPI? Messaging Passing Interface A language-independent communation protocol for parallel computers Run the same code on a number

More information

Distributed Memory Programming With MPI

Distributed Memory Programming With MPI John Interdisciplinary Center for Applied Mathematics & Information Technology Department Virginia Tech... Applied Computational Science II Department of Scientific Computing Florida State University http://people.sc.fsu.edu/

More information

The Sieve of Erastothenes

The Sieve of Erastothenes The Sieve of Erastothenes Parallel and Distributed Computing Department of Computer Science and Engineering (DEI) Instituto Superior Técnico October 25, 2010 José Monteiro (DEI / IST) Parallel and Distributed

More information

The Message Passing Interface (MPI) TMA4280 Introduction to Supercomputing

The Message Passing Interface (MPI) TMA4280 Introduction to Supercomputing The Message Passing Interface (MPI) TMA4280 Introduction to Supercomputing NTNU, IMF February 9. 2018 1 Recap: Parallelism with MPI An MPI execution is started on a set of processes P with: mpirun -n N

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

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

Asynchronous Communication 2

Asynchronous Communication 2 Asynchronous Communication 2 INF4140 22.11.12 Lecture 11 INF4140 (22.11.12) Asynchronous Communication 2 Lecture 11 1 / 37 Overview: Last time semantics: histories and trace sets specification: invariants

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

Hoare Logic (I): Axiomatic Semantics and Program Correctness

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

More information

A quick introduction to MPI (Message Passing Interface)

A quick introduction to MPI (Message Passing Interface) A quick introduction to MPI (Message Passing Interface) M1IF - APPD Oguz Kaya Pierre Pradic École Normale Supérieure de Lyon, France 1 / 34 Oguz Kaya, Pierre Pradic M1IF - Presentation MPI Introduction

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

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

Hoare Logic: Reasoning About Imperative Programs

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

More information

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Modeling Concurrent Systems

Modeling Concurrent Systems Modeling Concurrent Systems 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

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

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

Snapshots. Chandy-Lamport Algorithm for the determination of consistent global states <$1000, 0> <$50, 2000> mark. (order 10, $100) mark

Snapshots. Chandy-Lamport Algorithm for the determination of consistent global states <$1000, 0> <$50, 2000> mark. (order 10, $100) mark 8 example: P i P j (5 widgets) (order 10, $100) cji 8 ed state P i : , P j : , c ij : , c ji : Distributed Systems

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

Proof Rules for Correctness Triples

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

More information

MOST OF the published research on control of discreteevent

MOST OF the published research on control of discreteevent IEEE TRANSACTIONS ON AUTOMATIC CONTROL, VOL. 43, NO. 1, JANUARY 1998 3 Discrete-Event Control of Nondeterministic Systems Michael Heymann and Feng Lin, Member, IEEE Abstract Nondeterminism in discrete-event

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

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

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

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

The Underlying Semantics of Transition Systems

The Underlying Semantics of Transition Systems The Underlying Semantics of Transition Systems J. M. Crawford D. M. Goldschlag Technical Report 17 December 1987 Computational Logic Inc. 1717 W. 6th St. Suite 290 Austin, Texas 78703 (512) 322-9951 1

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

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

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

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

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

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

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

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

Sequential programs. Uri Abraham. March 9, 2014

Sequential programs. Uri Abraham. March 9, 2014 Sequential programs Uri Abraham March 9, 2014 Abstract In this lecture we deal with executions by a single processor, and explain some basic notions which are important for concurrent systems as well.

More information

Verified Characteristic Formulae for CakeML. Armaël Guéneau, Magnus O. Myreen, Ramana Kumar, Michael Norrish April 18, 2017

Verified Characteristic Formulae for CakeML. Armaël Guéneau, Magnus O. Myreen, Ramana Kumar, Michael Norrish April 18, 2017 Verified Characteristic Formulae for CakeML Armaël Guéneau, Magnus O. Myreen, Ramana Kumar, Michael Norrish April 18, 2017 CakeML Has: references, modules, datatypes, exceptions, a FFI,... Doesn t have:

More information

Proving Inter-Program Properties

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

Denotational Semantics

Denotational Semantics 5 Denotational Semantics In the operational approach, we were interested in how a program is executed. This is contrary to the denotational approach, where we are merely interested in the effect of executing

More information

Lecture Notes on Programs with Arrays

Lecture Notes on Programs with Arrays 15-414: Bug Catching: Automated Program Verification Lecture Notes on Programs with Arrays Matt Fredrikson Ruben Martins Carnegie Mellon University Lecture 6 1 Introduction The previous lecture focused

More information

Consistent Global States of Distributed Systems: Fundamental Concepts and Mechanisms. CS 249 Project Fall 2005 Wing Wong

Consistent Global States of Distributed Systems: Fundamental Concepts and Mechanisms. CS 249 Project Fall 2005 Wing Wong Consistent Global States of Distributed Systems: Fundamental Concepts and Mechanisms CS 249 Project Fall 2005 Wing Wong Outline Introduction Asynchronous distributed systems, distributed computations,

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

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

Antonio Falabella. 3 rd nternational Summer School on INtelligent Signal Processing for FrontIEr Research and Industry, September 2015, Hamburg

Antonio Falabella. 3 rd nternational Summer School on INtelligent Signal Processing for FrontIEr Research and Industry, September 2015, Hamburg INFN - CNAF (Bologna) 3 rd nternational Summer School on INtelligent Signal Processing for FrontIEr Research and Industry, 14-25 September 2015, Hamburg 1 / 44 Overview 1 2 3 4 5 2 / 44 to Computing The

More information

Recognizing Safety and Liveness by Alpern and Schneider

Recognizing Safety and Liveness by Alpern and Schneider Recognizing Safety and Liveness by Alpern and Schneider Calvin Deutschbein 17 Jan 2017 1 Intro 1.1 Safety What is safety? Bad things do not happen For example, consider the following safe program in C:

More information

Trace semantics: towards a unification of parallel paradigms Stephen Brookes. Department of Computer Science Carnegie Mellon University

Trace semantics: towards a unification of parallel paradigms Stephen Brookes. Department of Computer Science Carnegie Mellon University Trace semantics: towards a unification of parallel paradigms Stephen Brookes Department of Computer Science Carnegie Mellon University MFCSIT 2002 1 PARALLEL PARADIGMS State-based Shared-memory global

More information

Inductive Data Flow Graphs

Inductive Data Flow Graphs Inductive Data Flow Graphs Azadeh Farzan University of Toronto Zachary Kincaid Andreas Podelski University of Freiburg Abstract The correctness of a sequential program can be shown by the annotation of

More information

Chapter 3 Deterministic planning

Chapter 3 Deterministic planning Chapter 3 Deterministic planning In this chapter we describe a number of algorithms for solving the historically most important and most basic type of planning problem. Two rather strong simplifying assumptions

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

Agreement. Today. l Coordination and agreement in group communication. l Consensus

Agreement. Today. l Coordination and agreement in group communication. l Consensus Agreement Today l Coordination and agreement in group communication l Consensus Events and process states " A distributed system a collection P of N singlethreaded processes w/o shared memory Each process

More information

On the Complexity of the Reflected Logic of Proofs

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

More information

CSE 331 Winter 2018 Reasoning About Code I

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

Introduction to Permission-Based Program Logics Part II Concurrent Programs

Introduction to Permission-Based Program Logics Part II Concurrent Programs Introduction to Permission-Based Program Logics Part II Concurrent Programs Thomas Wies New York University Example: Lock-Coupling List 2 3 5 7 8 9 There is one lock per node; threads acquire locks in

More information

Communicating Parallel Processes. Stephen Brookes

Communicating Parallel Processes. Stephen Brookes Communicating Parallel Processes Stephen Brookes Carnegie Mellon University Deconstructing CSP 1 CSP sequential processes input and output as primitives named parallel composition synchronized communication

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

hal , version 1-21 Oct 2009

hal , version 1-21 Oct 2009 ON SKOLEMISING ZERMELO S SET THEORY ALEXANDRE MIQUEL Abstract. We give a Skolemised presentation of Zermelo s set theory (with notations for comprehension, powerset, etc.) and show that this presentation

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

CSE 331 Winter 2018 Homework 1

CSE 331 Winter 2018 Homework 1 Directions: - Due Wednesday, January 10 by 11 pm. - Turn in your work online using gradescope. You should turn in a single pdf file. You can have more than one answer per page, but please try to avoid

More information

Diagnosis of Repeated/Intermittent Failures in Discrete Event Systems

Diagnosis of Repeated/Intermittent Failures in Discrete Event Systems Diagnosis of Repeated/Intermittent Failures in Discrete Event Systems Shengbing Jiang, Ratnesh Kumar, and Humberto E. Garcia Abstract We introduce the notion of repeated failure diagnosability for diagnosing

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

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

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

Decentralized Control of Discrete Event Systems with Bounded or Unbounded Delay Communication

Decentralized Control of Discrete Event Systems with Bounded or Unbounded Delay Communication Decentralized Control of Discrete Event Systems with Bounded or Unbounded Delay Communication Stavros Tripakis Abstract We introduce problems of decentralized control with communication, where we explicitly

More information

The equation does not have a closed form solution, but we see that it changes sign in [-1,0]

The equation does not have a closed form solution, but we see that it changes sign in [-1,0] Numerical methods Introduction Let f(x)=e x -x 2 +x. When f(x)=0? The equation does not have a closed form solution, but we see that it changes sign in [-1,0] Because f(-0.5)=-0.1435, the root is in [-0.5,0]

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

COMP 3161/9161 Week 2

COMP 3161/9161 Week 2 Concepts of Programming Languages Judgements, Inference Rules & Proofs Lecturer: Gabriele Keller Tutor: Liam O Connor University of New South Wales School of Computer Sciences & Engineering Sydney, Australia

More information

Panorama des modèles et outils de programmation parallèle

Panorama des modèles et outils de programmation parallèle Panorama des modèles et outils de programmation parallèle Sylvain HENRY sylvain.henry@inria.fr University of Bordeaux - LaBRI - Inria - ENSEIRB April 19th, 2013 1/45 Outline Introduction Accelerators &

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

This is logically equivalent to the conjunction of the positive assertion Minimal Arithmetic and Representability

This is logically equivalent to the conjunction of the positive assertion Minimal Arithmetic and Representability 16.2. MINIMAL ARITHMETIC AND REPRESENTABILITY 207 If T is a consistent theory in the language of arithmetic, we say a set S is defined in T by D(x) if for all n, if n is in S, then D(n) is a theorem of

More information

Kirsten Lackner Solberg. Dept. of Math. and Computer Science. Odense University, Denmark

Kirsten Lackner Solberg. Dept. of Math. and Computer Science. Odense University, Denmark Inference Systems for Binding Time Analysis Kirsten Lackner Solberg Dept. of Math. and Computer Science Odense University, Denmark e-mail: kls@imada.ou.dk June 21, 1993 Contents 1 Introduction 4 2 Review

More information

Introduction to MPI. School of Computational Science, 21 October 2005

Introduction to MPI. School of Computational Science, 21 October 2005 Introduction to MPI John Burkardt School of Computational Science Florida State University... http://people.sc.fsu.edu/ jburkardt/presentations/ mpi 2005 fsu.pdf School of Computational Science, 21 October

More information

Lecture 4 Event Systems

Lecture 4 Event Systems Lecture 4 Event Systems This lecture is based on work done with Mark Bickford. Marktoberdorf Summer School, 2003 Formal Methods One of the major research challenges faced by computer science is providing

More information

Distributed Algorithms (CAS 769) Dr. Borzoo Bonakdarpour

Distributed Algorithms (CAS 769) Dr. Borzoo Bonakdarpour Distributed Algorithms (CAS 769) Week 1: Introduction, Logical clocks, Snapshots Dr. Borzoo Bonakdarpour Department of Computing and Software McMaster University Dr. Borzoo Bonakdarpour Distributed Algorithms

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

Integer Linear Programming Based Property Checking for Asynchronous Reactive Systems

Integer Linear Programming Based Property Checking for Asynchronous Reactive Systems IEEE TRANSACTIONS ON SOFTWARE ENGINEERING 1 Integer Linear Programming Based Property Checking for Asynchronous Reactive Systems Stefan Leue Department of Computer and Information Science University of

More information

Lecture 4. Writing parallel programs with MPI Measuring performance

Lecture 4. Writing parallel programs with MPI Measuring performance Lecture 4 Writing parallel programs with MPI Measuring performance Announcements Wednesday s office hour moved to 1.30 A new version of Ring (Ring_new) that handles linear sequences of message lengths

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

Formal Methods for Probabilistic Systems

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

Strength; Weakest Preconditions

Strength; 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 information

A Constructor-Based Reachability Logic for Rewrite Theories

A Constructor-Based Reachability Logic for Rewrite Theories A Constructor-Based Reachability Logic for Rewrite Theories Stephen Skeirik, Andrei Stefanescu, Jose Meseguer October 10th, 2017 Outline 1 Introduction 2 Reachability Logic Semantics 3 The Invariant Paradox

More information

INTERFACE-BASED DESIGN

INTERFACE-BASED DESIGN INTERFACE-BASED DESIGN Luca de Alfaro UC Santa Cruz, California luca@soe.ucsc.edu Thomas A. Henzinger EPFL, Switzerland, and UC Berkeley, California tah@epfl.ch Abstract Surveying results from [5] and

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