The Essence of Reynolds

Similar documents
Automata-theoretic Model of Idealized Algol with Passive Expressions

Handout 10: Imperative programs and the Lambda Calculus

Substitution in Structural Operational Semantics and value-passing process calculi

Less naive type theory

Contents. Chapter 1 SPECIFYING SYNTAX 1

1 A question of semantics

Lecture slides & distribution files:

CIS 500 Software Foundations Fall December 6

Administrivia. Existential Types. CIS 500 Software Foundations Fall December 6. Administrivia. Motivation. Motivation

Hiding local state in direct style: a higher-order anti-frame rule

The Essence of Reynolds

Polymorphic lambda calculus Princ. of Progr. Languages (and Extended ) The University of Birmingham. c Uday Reddy

Category Theory. Andrew Pitts. Module L108, Part III and MPhil. ACS 2019 Computer Science Tripos University of Cambridge L0 1

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

Theories of Information Hiding in Lambda-Calculus

Imperative Functional Programming

A NEW PROOF-ASSISTANT THAT REVISITS HOMOTOPY TYPE THEORY THE THEORETICAL FOUNDATIONS OF COQ USING NICOLAS TABAREAU

Com S 541. Programming Languages I

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

Rule Formats for Nominal Modal Transition Systems

ACLT: Algebra, Categories, Logic in Topology - Grothendieck's generalized topological spaces (toposes)

Handout 9: Imperative Programs and State

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012

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

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

Foundational Aspects of Syntax 1

CS 6110 S14 Lecture 1 Introduction 24 January 2014

Programming Language Pragmatics

Pure (Untyped) λ-calculus. Andrey Kruglyak, 2010

Reasoning about modules: data refinement and simulation

The three faces of homotopy type theory. Type theory and category theory. Minicourse plan. Typing judgments. Michael Shulman.

Logical Relations. Amal Ahmed. Northeastern University. OPLSS Lecture 5, June 26, 2015

Course on Probabilistic Methods in Concurrency. (Concurrent Languages for Probabilistic Asynchronous Communication) Lecture 1

Second-Order Type Systems

The Polymorphic Blame Calculus and Parametricity

What if current foundations of mathematics are inconsistent? Vladimir Voevodsky September 25, 2010

DEFINING A LANGUAGE. Robert Harper. Friday, April 27, 12

7. Introduction to Denotational Semantics. Oscar Nierstrasz

An Annotated Language

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

Computer Science 190 (Autumn Term, 2010) Semantics of Programming Languages

Kurt Gödel and Computability Theory

CSCI-GA Scripting Languages

Programming Proofs and Proving Programs. Nick Benton Microsoft Research, Cambridge

1 Introduction. 3 Syntax

(Refer Slide Time: 4:00)

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.

Syntax-semantics interface and the non-trivial computation of meaning

Type Checking and Inference Are Equivalent in Lambda Calculi with Existential Types

Embedding logics in Dedukti

Type Inference with Inequalities

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions)

CLF: A logical framework for concurrent systems

Lambda Calculi With Polymorphism

Typed Lambda Calculus for Syntacticians

The design of a programming language for provably correct programs: success and failure

Modules Matter Most. Robert Harper Carnegie Mellon University. MacQueen Fest Chicago May 2012

Equivariant Syntax and Semantics (Abstract of Invited Talk)

Programming Languages Third Edition

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

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS522 Programming Language Semantics

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets?

Denotational Semantics. Domain Theory

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS422 Programming Language Semantics

Lecture 5 - Axiomatic semantics

Automata and Formal Languages - CM0081 Introduction to Agda

Proofs-Programs correspondance and Security

Reading 1 : Introduction

Programming with Patterns. ACM SIGPLAN Developer Tracks on Functional Programming (DEFUN 2009)

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

The Typed λ Calculus and Type Inferencing in ML

As Natural as 0, 1, 2. Philip Wadler University of Edinburgh

Introduction to Lambda Calculus. Lecture 7 CS /08/09

A Michael Jackson presentation. CSE503: Software Engineering. The following slides are from his keynote at ICSE 1995

CSC 501 Semantics of Programming Languages

Answer Type Polymorphism in Call-by-name Continuation Passing

Introduction. chapter Functions

SIR C R REDDY COLLEGE OF ENGINEERING

Thunks (continued) Olivier Danvy, John Hatcli. Department of Computing and Information Sciences. Kansas State University. Manhattan, Kansas 66506, USA

System Description: Twelf A Meta-Logical Framework for Deductive Systems

Computing Fundamentals 2 Introduction to CafeOBJ

Type Systems COMP 311 Rice University Houston, Texas

More Lambda Calculus and Intro to Type Systems

A Revisionist History of Denotational Semantics

Lecture 5: The Halting Problem. Michael Beeson

EXTENSIONS OF FIRST ORDER LOGIC

CSCI B522 Lecture 11 Naming and Scope 8 Oct, 2009

Programmiersprachen (Programming Languages)

MPRI course 2-4 Functional programming languages Exercises

Going beyond propositional logic

Lecture Notes on Data Representation

Boolean Algebra & Digital Logic

Chapter 1. Introduction

Programming with Math and Logic

Chapter 3. Describing Syntax and Semantics

Research Statement. Daniel R. Licata

Lambda Calculi With Polymorphism

A Small Interpreted Language

CS 242. Fundamentals. Reading: See last slide

Transcription:

The Essence of Reynolds 3. State and Abstraction Uday S. Reddy 1 1 University of Birmingham POPL, 2014

John C. Reynolds, 1935-2013

Emmy Noether, 1882-1935 According to Mac Lane, she emphasized the importance of homomorphisms. Within 10 years of her passing, category theory was born, taking homomorphisms as the primary elements, and formulating naturality as the preservation of homomorphisms.

John Reynolds emphasized the importance of logical relations, formulating relational parametricity as the preservation of logical relations. Can we hope for a new theory within 10 years of his passing? Do logical relations pose a challenge to the supremacy of homomorphisms? Do they give us a better handle on the mathematical reality? At least as seen from the Computer Science point of view? Or, perhaps more generally, are there aspects of mathematical phenomena hidden from our view which might be unveiled by understanding logical relations?

Logical relations Logical relations are relations compatible with structure, just like homomorphisms are functions preserving structure. See Hermida, Reddy and Robinson [2014]. Other names for logical relations in the literature: Regular relation, Homogeneous relation, Compatible relation (algebra) Congruence relation (algebra - for equivalence relations) Covering relation (automata theory) Simulation relation, Bisimulation relation (Milner, CCS & pi-calculus) Refinement mapping (Abadi & Lamport, Dist. systems) Relational parametricity asks for parametrically polymorphic functions to preserve all logical relations. A R A F(A) F(R) F(A ) t A> G(A) G(R) t A > G(A )

Peter Freyd I took this affront to category theory as a challenge. There were several years that I often found myself thinking and then saying out loud when lecturing that if we were to work very, very hard, we might catch up to where John Reynolds was years ago. 2 Core algebra revisited, 2007 2 I must record John s words when he attended one such lecture: You too? I ve long been trying to catch up to where I used to be.

Relational parametricity 1974: Towards a theory of type structure Polymorphic lambda calculus Representation independence theorem (using Galois connections for complete lattices). 1983: Types, abstraction and parametric polymorphism Relational parametricity Abstraction theorem (generalizing representation theorem ) Uses relations instead of Galois connections

Why relations? Reynolds was a co-inventor of logical relations (1974), along with Plotkin (1973), Milne (1974). The crux of logical relations is this formula for properties of functions f : A B: (P Q)(f ) ( x. P(x) = Q(f (x)) ) Or, for binary relations: (R S)(f, f ) ( x, x. R(x, x ) = S(f (x), f (x )) ) Most people think of this as a proof technique to get induction to work.

Gordon Plotkin Plotkin s [1980] use of logical relations was much deeper. Because of the logical nature of λ-definable elements, they should be invariant under the permutations of D. Lambda definability in the full type hierarchy Elaborating: Other types Mathematics Logic network connections integer, real, The logical constructions of λ-calculus can t see the mathematical types that lie above. Plotkin s logical = Reynolds s parametric?

Abstraction Logical relations were also invented in automata theory [Ginzburg and Yoeli, 1965, Eilenberg, 1976]. Milner [1969] rechristened them simulation relations and applied them to programming theory. Later bisimulations. Hoare [1972] applied the idea to data representations (abstract data types). Reynolds [1972-1981] used all these ideas in Data representation structuring (Ch. 5 of Craft of Programming). Mitchell and Plotkin [1982] made the connection between abstract types and existential types.

Reynolds s idea In putting all these ideas together, Reynolds made his characteristic giant leap: The way of out of this impasse is to generalize homomorphisms from functions to relations. Types, Abstraction and Parametric Polymorphism, 1983. Homomorphisms represent the very foundation of the 20 th century mathematics! But Reynolds says, they only work for first-order types. We must generalize homomorphisms to logical relations to handle higher-order types.

Information hiding (Abstraction) In automata, process calculi and abtract types, computations are black boxes with hidden state: M : Q. F(Q) This is global information hiding. Parametric polymorphism gives you local information hiding. t : Q. F (Q) G(Q)

What next? Information hiding, a Computer Science idea, is also at the heart of mathematics. Reynolds parametricity gives us a mathematical theory of information hiding, which should have a wide range of applications. Computer Science has an opportunity to cause a disruptive change to 21st century Mathematics and, throught it, perhaps all of science. Some beginnings: Hermida, Reddy, Robinson [2014]. Atkey [2014] in this POPL.

Section 2 State

The Craft of Programming Reynolds was a superior imperative programmer (Algol 60, Algol W, Algol 68, assembly). Between 1972-1981, he taught a graduate course on programming at Syracuse, developing the work published as The Craft of Programming.

The Craft of Programming (contd) Contains a wealth of information about: what imperative programming means, how to develop imperative programs rigorously, the type structure of imperative programs, reasoning principles (both practical, e.g., arrays, and abstract, e.g., Specification Logic), how to reason about data abstraction (or information hiding). Separation Logic, 2000, may be seen as a continuation of this body of work.

The Craft of Programming (contd) The Craft of Programming apparently gave rise to a series of landmark papers. 1978: Syntactic Control of Interference. 1979: Reasoning about arrays. 1980: Using Category Theory to Design Implicit Conversions and Generic Operators. 1981: The Essence of Algol. 1982: The Idealized Algol and its Specification Logic. 1983: Types, Abstraction and Parametric Polymorphism. 1984: Polymorphism is not set-theoretic. What do we see here? The ideas of state, types, data abstraction, polymorphism are all interconnected in Reynolds s mind. State is the key.

State and abstraction Two major insights: Procedures of Algol 60 = typed lambda calculus. Recall: Call-by-name! A Polymorphic Model of Algol [Notes dated 1975]: Algol types are type constructors, parameterized by state types.. com[s] = S S (θ 1 θ 2 )[S] = S. θ 1 [S S ] θ 2 [S S ] Whereas pure functional programming lives in classical set theory, imperative programmign works in intuitionistic set theory (Kripke-style, presheaf model). Contrast with Strachey s denotational semantics, which essentially tries to reduce imperative programming to functional programming, i.e., classical set theory.

Interpreting Algol types The correspondence between Algol and functional programs: Algol (intuitionistic) types terms classical functional type constructors (functors/relators) polymorphic functions (natural/parametric transformations) So, first-order Algol programs become polymorphic higher-order functional programs. Parametricity implies: [com com] = N. (a form of Church numerals). Hoare s proof rule for while loops is a free theorem.

Intuitionistic set theory (Kripke models) An intuitionistic set (in the sense of Kripke and Lawvere) is a set parameterized by some context, which we call a world. A(X) =... Lawvere (Sets for Mathematics, 2003) also calls them variable sets. Normal sets are called constant sets. In the Algol case, worlds are store shapes. Functions: (A B)(X) = Y X A(Y ) B(Y ) Intuitively: a function of type A B at world X can work at every future world Y, accepting arguments of type A at world Y and giving results of type B at world Y.

Modularity in State Since state is an implicit type parameter, Reynolds thought about further information hiding aspects to capture modularity in state. Syntactic Control of Interference [1978]: (θ 1 θ 2 )[S] = S θ 1 [S ] θ 2 [S S ] Procedure and its argument should not interfere (depend on separate portions of storage). Corresponding non-interfering product [O Hearn et al.]: (θ 1 θ 2 )[S] = S1,S 2 S 1 S 2 S θ 1 [S 1 ] θ 2 [S 2 ] Separation logic [2000-2013] reinterprets these ideas for predicates instead of types. A fitting culmination of a lifelong quest for understanding the deepest underpinnings of programming languages!

John C. Reynolds, 1935-2013