The Formal Semantics of Programming Languages An Introduction. Glynn Winskel. The MIT Press Cambridge, Massachusetts London, England

Similar documents
Contents. Chapter 1 SPECIFYING SYNTAX 1

Semantics. There is no single widely acceptable notation or formalism for describing semantics Operational Semantics

Dynamic Logic David Harel, The Weizmann Institute Dexter Kozen, Cornell University Jerzy Tiuryn, University of Warsaw The MIT Press, Cambridge, Massac

A CRASH COURSE IN SEMANTICS

EXTENSIONS OF FIRST ORDER LOGIC

Introduction to Axiomatic Semantics

Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m.

From Hoare Logic to Matching Logic Reachability. Grigore Rosu and Andrei Stefanescu University of Illinois, USA

axiomatic semantics involving logical rules for deriving relations between preconditions and postconditions.

LOGIC AND DISCRETE MATHEMATICS

Introduction to Axiomatic Semantics (1/2)

Foundations of Computing Michael Garey and Albert Meyer, editors

Semantics and Concurrence Module on Semantic of Programming Languages

Introduction to Axiomatic Semantics (1/2)

Chapter 3. Describing Syntax and Semantics ISBN

Semantics and Concurrence Module on Semantic of Programming Languages

AN INTRODUCTION TO FUZZY SETS Analysis and Design. Witold Pedrycz and Fernando Gomide

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

An Annotated Language

Hoare Logic. COMP2600 Formal Methods for Software Engineering. Rajeev Goré

Chapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction

A Hoare Logic Contract Theory: An Exercise in Denotational Semantics

Chapter 3. Describing Syntax and Semantics

Abstract Interpretation

Programming Languages Third Edition

Chapter 3 (part 3) Describing Syntax and Semantics

Introductory logic and sets for Computer scientists

6. Hoare Logic and Weakest Preconditions

Logik für Informatiker Logic for computer scientists

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

Informal Semantics of Data. semantic specification names (identifiers) attributes binding declarations scope rules visibility

The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers.

Virtual World Development

Chapter 3. Describing Syntax and Semantics ISBN

Chapter 3. Describing Syntax and Semantics

Proving Properties on Programs From the Coq Tutorial at ITP 2015

Introduction to Denotational Semantics. Class Likes/Dislikes Survey. Dueling Semantics. Denotational Semantics Learning Goals. You re On Jeopardy!

Com S 541. Programming Languages I

Hoare triples. Floyd-Hoare Logic, Separation Logic

Lambda Calculus. CS 550 Programming Languages Jeremy Johnson

Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1

Logic and its Applications

MATHEMATICAL STRUCTURES FOR COMPUTER SCIENCE

Propositional Calculus. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

Denotational Semantics

Formal Methods. CITS5501 Software Testing and Quality Assurance

Chapter 3. Syntax - the form or structure of the expressions, statements, and program units

Defining Languages GMU

Formal Systems and their Applications

Denotational Semantics. Domain Theory

Denotational Semantics of a Simple Imperative Language Using Intensional Logic

Discrete Mathematics Lecture 4. Harper Langston New York University

In Our Last Exciting Episode

Boolean Reasoning. The Logic of Boolean Equations. Frank Markham Brown Air Force Institute of Technology

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

Lecture Notes on Data Representation

CSE 505: Concepts of Programming Languages

CMSC 330: Organization of Programming Languages

1.3. Conditional expressions To express case distinctions like

Introduction to Denotational Semantics. Brutus Is An Honorable Man. Class Likes/Dislikes Survey. Dueling Semantics

CS611 Lecture 33 Equirecursive types & Recursive domain equations November 19, 2001

Discrete Mathematics SECOND EDITION OXFORD UNIVERSITY PRESS. Norman L. Biggs. Professor of Mathematics London School of Economics University of London

Lecture 4. First order logic is a formal notation for mathematics which involves:

Part II. Hoare Logic and Program Verification. Why specify programs? Specification and Verification. Code Verification. Why verify programs?

An Evolution of Mathematical Tools

Modal Logic ALEXANDER CHAGROV. Tver State University. and MICHAEL ZAKHARYASCHEV

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

Computation Club: Gödel s theorem

Last class. CS Principles of Programming Languages. Introduction. Outline

Comp 411 Principles of Programming Languages Lecture 7 Meta-interpreters. Corky Cartwright January 26, 2018

λ calculus is inconsistent

Specification, Verification, and Interactive Proof

1 A question of semantics

Hoare Logic: Proving Programs Correct

Conjunctive queries. Many computational problems are much easier for conjunctive queries than for general first-order queries.

COSC252: Programming Languages: Semantic Specification. Jeremy Bolton, PhD Adjunct Professor

Lecture 5 - Axiomatic semantics

Functional Programming

Chapter 3. Semantics. Topics. Introduction. Introduction. Introduction. Introduction

The Untyped Lambda Calculus

Software Quality Assurance

3.7 Denotational Semantics

Formalizing Dijkstra

λ-calculus Lecture 1 Venanzio Capretta MGS Nottingham

Untyped Lambda Calculus

7. Introduction to Denotational Semantics. Oscar Nierstrasz

Numerical Computations and Formal Methods

Introduction to Algorithms Third Edition

Main Goal. Language-independent program verification framework. Derive program properties from operational semantics

PROPER TECHNIQUE OF SOFTWARE INSPECTION USING GUARDED COMMAND LANGUAGE

CS152: Programming Languages. Lecture 5 Pseudo-Denotational Semantics. Dan Grossman Spring 2011

Deductive Program Verification with Why3, Past and Future

Lambda Calculus. Variables and Functions. cs3723 1

locales ISAR IS BASED ON CONTEXTS CONTENT Slide 3 Slide 1 proof - fix x assume Ass: A. x and Ass are visible Slide 2 Slide 4 inside this context

Compilation and Program Analysis (#11) : Hoare triples and shape analysis

Chapter 1. Introduction

Proof Carrying Code(PCC)

Lectures 20, 21: Axiomatic Semantics

Type Systems COMP 311 Rice University Houston, Texas

Transcription:

The Formal Semantics of Programming Languages An Introduction Glynn Winskel The MIT Press Cambridge, Massachusetts London, England

Series foreword Preface xiii xv 1 Basic set theory 1 1.1 Logical notation 1 1.2 Sets 2 1.2.1 Sets and properties 3 1.2.2 Some important sets 3 1.2.3 Constructions on sets 4 1.2.4 The axiom of foundation 6 1.3 Relations and functions 6 1.3.1 Lambda notation 7 1.3.2 Composing relations and functions 7 1.3.3 Direct and inverse image of a relation 9 1.3.4 Equivalence relations 9 1.4 Further reading, 10 2 Introduction to operational semantics 11 2.1 IMP a simple imperative language 11 2.2 The evaluation of arithmetic expressions 13 2.3 The evaluation of boolean expressions 17 2.4 The execution of commands 19 2.5 A simple proof 20 2.6 Alternative semantics 24 2.7 Further reading - 26 3 Some principles of induction 27 3.1 Mathematical induction * 27 3.2 Structural induction 28 3.3 Well-founded induction 31 3.4 Induction on derivations 35 3.5 Definitions by induction 39

3.6 Further reading 40 4 Inductive definitions 41 4.1 Rule induction 41 4.2 Special rule induction -44 4.3 Proof rules for operational semantics 45 4.3.1 Rule induction for arithmetic expressions 45 4.3.2 Rule induction for boolean expressions 46 4.3.3 Rule induction for commands 47 4.4 Operators and their least fixed points 52 4.5 Further reading 54 5 The denotational semantics of IMP 55 5.1 Motivation 55 5.2 Denotational semantics 56 5.3 Equivalence of the semantics 61 5.4 Complete partial orders and continuous functions 68 5.5 The Knaster-Tarski Theorem 74 5.6 Further reading 75 6 The axiomatic semantics of IMP 77 6.1 The idea 77 6.2 The assertion language Assn 80 6.2.1 Free and bound variables 81 6.2.2 Substitution 82 6.3 Semantics of assertions 84 6.4 Proof rules for partial correctness 89 6.5 Soundness 91 6.6 Using the Hoare rules an example 93 6.7 Further reading 96 7 Completeness jof the Hoare rules 99

7.1 Godel's Incompleteness Theorem 99 7.2 Weakest preconditions and expressiveness 100 7.3 Proof of Godel's Theorem 110 7.4 Verification conditions 112 7.5- Predicate transformers 115 7.6 Further reading 117 8 Introduction to domain theory 119 8.1 Basic definitions 119 8.2 Streams an example 121 8.3 Constructions on cpo's. 123 8.3.1 Discrete cpo's 124 8.3.2 Finite products 125 8.3.3 Function space 128 8.3.4 Lifting ' 131 8.3.5 Sums 133 8.4 A metalanguage 135 8.5 Further reading 139 9 Recursion equations 141 9.1 The language REC 141 9.2 Operational semantics of call-by-value 143 9.3 Denotational semantics of call-by-value 144 9.4 Equivalence of semantics for call-by-value 149 9.5 Operational semantics of call-by-name 153 9.6 Denotational semantics of call-by-name 154 9.7 Equivalence of semantics for call-by-name 157 9.8 Local declarations 161 9.9 Further reading 162 10 Techniques for recursion 163 10.1 Bekic's Theorem. - 163

10.2 Fixed-point induction 166 10.3 Well-founded induction 174 10.4 Well-founded recursion 176 10.5 An exercise 179 10.6 Further reading. 181 11 Languages with higher types 183 11.1 An eager language 183 11.2 Eager operational semantics 186 11.3 Eager denotational semantics 188 11.4 Agreement of eager semantics 190 11.5 A lazy language 200 11.6 Lazy operational semantics 201 11.7 Lazy denotational semantics 203 11.8 Agreement of lazy semantics 204 11.9 Fixed-point operators 209 11.10 Observations and full abstraction 215 11.11 Sums 219 11.12 Further reading 221 12 Information systems 223 12.1 Recursive types 223 12.2 Information systems 225 12.3 Closed families and Scott predomains 228 12.4 A cpo of information systems 233 12.5 Constructions 236 12.5.1 Lifting 237 12.5.2 Sums 239 12.5.3 Product 241 12.5.4 Lifted function space 243 12.6 Further reading 249

13 Recursive types 251 13.1 An eager language 251 13.2 Eager operational semantics 255 13.3 Eager denotational semantics 257 13.4 Adequacy of eager semantics 262 13.5 The eager A-calculus 267 13.5.1 Equational theory 269 13.5.2 A fixed-point operator 272 13.6 A lazy language 278 13.7 Lazy operational semantics 278 13.8 Lazy denotational semantics 281 13.9 Adequacy of lazy semantics 288 13.10The lazy A-calculus 290 13.10.1 Equational theory 291 13.10.2 A fixed-point operator 292 13.11 Further reading 295 14 Nondeterminism and parallelism 297 14.1 Introduction 297 14.2 Guarded commands 298 14.3 Communicating processes 303 14.4 Milner's CCS 308 14.5 Pure CCS 311 14.6 A specification language 316 14.7 The modal v-calculus 321 14.8 Local model checking 327 14.9 Further reading 335 A Incompleteness and undecidability 337 Bibliography 353 Index 357