Computer programs are an indispensable part of many of the systems we rely upon in our daily lives, and the proper functioning and safety of these systems is of paramount importance. The development of methods that ensure program correctness is therefore a key challenge for computer scientists. This widely anticipated third edition of **__Verification of Sequential and Concurrent Programs__** provides a systematic exploration of one of the most common approaches to program verification, known as the "assertional" approach. Following the successful formula of previous editions, this approach is applied to deterministic and nondeterministic sequential programs of varying complexity, together with both parallel and distributed concurrent programs. The expanded content of this thorough new edition also includes coverage of the verification of object-oriented programs. For each class of programs, the authors introduce an operational semantics and proof systems for the verification of partial and total correctness, justified formally in corresponding soundness theorems. Case studies supplied throughout the book demonstrate the use of the proof systems to formally verify solutions to classical problems, such as sorting, manipulation of lists, producer/consumer and mutual exclusion. **Topics and Features:** * Includes a thorough introductory section, familiarizing the reader with the basic concepts and notation used in the book, as well as the book’s structure * Explains Hoare’s approach to program verification for **while** programs, providing a correctness proof of a program for partitioning an array **(NEW)** * Concludes each chapter with exercises and bibliographic remarks for further reading * Discusses recursive programs that extend deterministic programs by parameterless procedures and procedures with the call-by-value parameter mechanism, and provides a correctness proof of the quicksort program **(NEW)** * Explores nondeterministic and distributed programs, presenting a verification method of distributed programs based on a transformation into nondeterministic ones * Presents object-oriented programs, with a focus on the main characteristics of objects **(NEW)** * Investigates parallel programs with shared variables and with synchronization * Studies the issue of fairness in the framework of nondeterministic programs, using an approach based on the method of explicit schedulers * Includes a Foreword by Professor Amir Pnueli This modern update of a classic, reader-friendly textbook is perfect for an introductory course on program verification for advanced undergraduate or graduate students, and may also be used as an introduction to operational semantics. Outlines for possible courses are suggested in the Preface to the book. This book is unique in addressing assertional verification of all essential classes of imperative programs: **while** programs, recursive programs, object-oriented programs, nondeterministic programs, parallel programs, and distributed programs. Endorsements 5 Foreword 7 Preface 8 Outlines of One-semester Courses 13 Part I In the Beginning 23 1 Introduction 25 1.1 An Example of a Concurrent Program 26 1.2 Program Correctness 33 1.3 Structure of this Book 35 1.4 Automating Program Verification 38 1.5 Assertional Methods in Practice 39 2 Preliminaries 41 2.1 Mathematical Notation 43 2.2 Typed Expressions 51 2.3 Semantics of Expressions 54 2.4 Formal Proof Systems 60 2.5 Assertions 61 2.6 Semantics of Assertions 63 2.7 Substitution 64 2.8 Substitution Lemma 69 2.9 Exercises 72 2.10 Bibliographic Remarks 73 Part II Deterministic Programs 75 3 while Programs 77 3.1 Syntax 79 3.2 Semantics 80 3.3 Verification 85 3.4 Proof Outlines 101 3.5 Completeness 107 3.6 Parallel Assignment 113 3.7 Failure Statement 116 3.8 Auxiliary Axioms and Rules 119 3.9 Case Study: Partitioning an Array 121 3.10 Systematic Development of Correct Programs 135 3.11 Case Study: Minimum-Sum Section Problem 138 3.12 Exercises 143 3.13 Bibliographic Remarks 146 4 Recursive Programs 149 4.1 Syntax 151 4.2 Semantics 151 4.3 Verification 154 4.4 Case Study: Binary Search 166 4.5 Exercises 171 4.6 Bibliographic Remarks 172 5 Recursive Programs with Parameters 173 5.1 Syntax 174 5.2 Semantics 176 5.3 Verification 179 5.4 Case Study: Quicksort 194 5.5 Exercises 204 5.6 Bibliographic Remarks 204 6 Object-Oriented Programs 207 6.1 Syntax 209 6.2 Semantics 214 6.3 Assertions 219 6.4 Verification 222 6.5 Adding Parameters 228 6.6 Transformation of Object-Oriented Programs 233 6.7 Object Creation 239 6.8 Case Study: Zero Search in Linked List 248 6.9 Case Study: Insertion into a Linked List 254 6.10 Exercises 260 6.11 Bibliographic Remarks 262 Part III Parallel Programs 265 7 Disjoint Parallel Programs 267 7.1 Syntax 269 7.2 Semantics 270 7.3 Verification 275 7.4 Case Study: Find Positive Element 283 7.5 Exercises 286 7.6 Bibliographic Remarks 288 8 Parallel Programs with Shared Variables 289 8.1 Access to Shared Variables 291 8.2 Syntax 292 8.3 Semantics 293 8.4 Verification: Partial Correctness 296 8.5 Verification: Total Correctness 306 8.6 Case Study: Find Positive Element More Quickly 313 8.7 Allowing More Points of Interference 316 8.8 Case Study: Parallel Zero Search 321 8.9 Exercises 325 8.10 Bibliographic Remarks 327 9 Parallel Programs with Synchronization 329 9.1 Syntax 331 9.2 Semantics 332 9.3 Verification 333 9.4 Case Study: Producer/Consumer Problem 341 9.5 Case Study: The Mutual Exclusion Problem 346 9.6 Allowing More Points of Interference 356 9.7 Case Study: Synchronized Zero Search 357 9.8 Exercises 366 9.9 Bibliographic Remarks 367 Part IV Nondeterministic and Distributed Programs 369 10 Nondeterministic Programs 371 10.1 Syntax 373 10.2 Semantics 374 10.3 Why Are Nondeterministic Programs Useful? 376 10.4 Verification 379 10.5 Case Study: The Welfare Crook Problem 382 10.6 Transformation of Parallel Programs 385 10.7 Exercises 390 10.8 Bibliographic Remarks 392 11 Distributed Programs 395 11.1 Syntax 397 11.2 Semantics 402 11.3 Transformation into Nondeterministic Programs 404 11.4 Verification 412 11.5 Case Study: A Transmission Problem 418 11.6 Exercises 424 11.7 Bibliographic Remarks 427 12 Fairness 429 12.1 The Concept of Fairness 431 12.2 Transformational Semantics 435 12.3 Well-Founded Structures 435 12.4 Random Assignment 436 12.5 Schedulers 441 12.6 Transformation 449 12.7 Verification 452 12.8 Case Study: Zero Search 464 12.9 Case Study: Asynchronous Fixed Point Computation 468 12.10 Exercises 474 12.11 Bibliographic Remarks 477 A Semantics 479 B Axioms and Proof Rules 481 C Proof Systems 493 D Proof Outlines 497 References 499 Index 513 Author Index 519 Symbol Index 523 HIS BOOK CONTAINS a most comprehensive text that presents syntax-directed and compositional methods for the formal veri?- T cation of programs. The approach is not language-bounded in the sense that it covers a large variety of programming models and features that appear in most modern programming languages. It covers the classes of - quential and parallel, deterministic and non-deterministic, distributed and object-oriented programs. For each of the classes it presents the various c- teria of correctness that are relevant for these classes, such as interference freedom, deadlock freedom, and appropriate notions of liveness for parallel programs. Also, special proof rules appropriate for each class of programs are presented. In spite of this diversity due to the rich program classes cons- ered, there exist a uniform underlying theory of veri?cation which is synt- oriented and promotes compositional approaches to veri?cation, leading to scalability of the methods. The text strikes the proper balance between mathematical rigor and - dactic introduction of increasingly complex rules in an incremental manner, adequately supported by state-of-the-art examples. As a result it can serve as a textbook for a variety of courses on di?erent levels and varying durations. It can also serve as a reference book for researchers in the theory of veri?- tion, in particular since it contains much material that never before appeared in book form. This is specially true for the treatment of object-oriented p- grams which is entirely novel and is strikingly elegant. Computer programs are becoming more and more part of systems that we use to rely on in our daily lives. The proper functioning and safety of these systems is of paramount importance. A major challenger for computer science is to develop methods that ensure program correctness. This textbook provides a structured introduction to program verification using an assertional approach - so named because it relies on the use of assertions that are attached to program control points. Sequential programs in the form of deterministic and nondeterministic programs, and concurrent programs in the form of parallel and distributed programs are considered within the context of their partial and total correctness. The use of these proof systems is demonstrated with the help of case studies. In particular solutions to classical problems such as mutual exclusion are formally verified. Each chapter concludes with exercises and bibliographic remarks for further reading. As a result, this text will be appropriate for either an introductory course on program verification for upper division of undergraduate studies or for graduate studies. It can also be used as an introduction to operational semantics. Outlines of possible courses are presented in the preface of the book. Front Matter....Pages i-xxiii Front Matter....Pages 3-3 Introduction....Pages 3-17 Preliminaries....Pages 18-52 Front Matter....Pages 53-53 While Programs....Pages 55-126 Recursive Programs....Pages 127-150 Recursive Programs with Parameters....Pages 151-183 Object-Oriented Programs....Pages 185-241 Front Matter....Pages 243-243 Disjoint Parallel Programs....Pages 243-266 Parallel Programs with Shared Variables....Pages 267-305 Parallel Programs with Synchronization....Pages 307-346 Front Matter....Pages 347-347 Nondeterministic Programs....Pages 347-372 Distributed Programs....Pages 373-406 Fairness....Pages 407-455 Back Matter....Pages 457-502