Monads for Relations. Jeremy G. Siek University of Colorado at Boulder SPLS, June Jeremy Siek Monads for Relations 1 / 20

Size: px
Start display at page:

Download "Monads for Relations. Jeremy G. Siek University of Colorado at Boulder SPLS, June Jeremy Siek Monads for Relations 1 / 20"

Transcription

1 Monads for Relations Jeremy G. Siek University of Colorado at Boulder SPLS, June 2010 Jeremy Siek Monads for Relations 1 / 20

2 Natural (Big-Step) Semantics for CBV Lambda ρ e v Env Expr Value ρ x ρ x ρ λx.e λx.e, ρ ρ e 1 λx.e, ρ ρ e 2 v 2 ρ [x v 2 ] e v 3 ρ e 1 e 2 v 3 Jeremy Siek Monads for Relations 2 / 20

3 Natural (Big-Step) Semantics for CBV Lambda ρ e v Env Expr Value ρ x ρ x ρ λx.e λx.e, ρ ρ e 1 λx.e, ρ ρ e 2 v 2 ρ [x v 2 ] e v 3 ρ e 1 e 2 v 3 When adding features to this language, we d like to not change the above rules. Jeremy Siek Monads for Relations 2 / 20

4 CBV Lambda with References ρ; µ e v; µ Env Store Expr Value Store ρ; µ 0 e 1 λx.e, ρ ; µ 1 ρ; µ 1 e 2 v 2 ; µ 2 ρ [x v 2 ]; µ 2 e v 3 ; µ 3 ρ; µ x ρ x; µ ρ; µ λx.e λx.e, ρ ; µ ρ; µ 0 e 1 e 2 v 3 ; µ 3 ρ; µ e v; µ a / dom µ ρ; µ ref e a; µ [a v] ρ; µ e a; µ ρ; µ!e µ a; µ ρ; µ 0 e 1 a 1 ; µ 1 ρ; µ 1 e 2 v 2 ; µ 2 ρ; µ 0 e 1 := e 2 v 2 ; µ 2 [a 1 v 2 ] Jeremy Siek Monads for Relations 3 / 20

5 CBV Lambda with References and Abort ρ; µ e r Env Store Expr (Value Store + Abort) ρ; µ 0 e 1 λx.e, ρ ; µ 1 ρ; µ 1 e 2 v 2 ; µ 2 ρ [x v 2 ]; µ 2 e v 3 ; µ 3 ρ; µ x ρ x; µ ρ; µ λx.e λx.e, ρ ; µ ρ; µ 0 e 1 e 2 v 3 ; µ 3 ρ; µ e v; µ a / dom µ ρ; µ ref e a; µ [a v] ρ; µ e a; µ ρ; µ!e µ a; µ ρ; µ 0 e 1 a 1 ; µ 1 ρ; µ 1 e 2 v 2 ; µ 2 ρ; µ 0 e 1 :=e 2 v 2 ; µ 2 [a 1 v 2 ] ρ; µ e v; µ ρ; µ abort e abort v ρ; µ e abort v ρ; µ abort e abort v ρ; µ e 1 abort v ρ; µ e 1 e 2 abort v ρ; µ 0 e 1 λx.e, ρ ; µ 1 ρ; µ 1 e 2 abort v ρ; µ 0 e 1 e 2 abort v ρ; µ 0 e abort v ρ; µ 0 ref e abort v ρ; µ 0 e abort v ρ; µ 0!e abort v ρ; µ 0 e 1 abort v ρ; µ 0 e 1 :=e 2 abort v ρ; µ 0 e 1 a 1 ; µ 1 ρ; µ 1 e 2 abort v ρ; µ 0 e 1 :=e 2 abort v Jeremy Siek Monads for Relations 4 / 20

6 Denotational Semantics e ρ : Expr Env Value x ρ = ρ x λx.e ρ = λz. e ρ[x z] e 1 e 2 ρ = let f = e 1 ρ in let v = e 2 ρ in f v Jeremy Siek Monads for Relations 5 / 20

7 Make sequencing explicit with Monadic operators M is the type operator for the monad. Γ e : T Γ return e : MT Γ m : MT 1 Γ, x : T 1 body : MT 2 Γ let x = m in body : MT 2 x ρ = return ρ x λx.e ρ = return λz. e ρ[x z] e 1 e 2 ρ = let f = e 1 ρ in let v = e 2 ρ in f v (let x = m in e) = bind m (λx.e) Jeremy Siek Monads for Relations 6 / 20

8 CBV Lambda with References x ρ = return ρ x λx.e ρ = return λz. e ρ[x z] e 1 e 2 ρ = let f = e 1 ρ in let v = e 2 ρ in f v ref e ρ = let v = e ρ in alloc v!e ρ = let a = e ρ in get a e 1 := e 2 ρ = let a = e 1 ρ in let v = e 2 ρ in set a v Jeremy Siek Monads for Relations 7 / 20

9 CBV Lambda with References and Abort x ρ = return ρ x λx.e ρ = return λz. e ρ[x z] e 1 e 2 ρ = let f = e 1 ρ in let v = e 2 ρ in f v ref e ρ = let v = e ρ in alloc v!e ρ = let a = e ρ in get a e 1 := e 2 ρ = let a = e 1 ρ in let v = e 2 ρ in set a v abort e ρ = let v = e ρ in exit v Jeremy Siek Monads for Relations 8 / 20

10 The State and Error Monad Definition MT State (T State + Abort) return v λµ.inl(v, µ) let x = m in body λµ. case m µ of inl(v, µ ) (body[v/x])µ inr(abort v) inr(abort v) alloc v λµ.(a, µ[a v]) where a / dom(µ) get a λµ.(µ(a), µ) set a v λµ.(v, µ[a v]) Jeremy Siek Monads for Relations 9 / 20

11 Functions vs. Relations There s a standard correspondence between functions and relations: A B graph graph 1 A B graph(f ) = {(x, y) y = F (x)} graph 1 (R)(x) = y where y is the unique y s.t. (x, y) R Characteristic function of a relation: A B = A B bool Jeremy Siek Monads for Relations 10 / 20

12 From Functions to Relations R L B = B R L T 1 T 2 = R L T 1 R R T 2 R L T 1 T 2 = R L T 1 R L T 2 R R B = B bool R R T 1 T 2 = R L T 1 R R T 2 R R T 1 T 2 = R R T 1 R R T 2 Jeremy Siek Monads for Relations 11 / 20

13 Relational Return and Bind Functional version: return : T MT bind : MT 1 (T 1 MT 2 ) MT 2 Relational version: return : R T MT = T MT bool bind : R MT 1 (T 1 MT 2 ) MT 2 = MT 1 (T 1 MT 2 bool) MT 2 bool Jeremy Siek Monads for Relations 12 / 20

14 Notation for Relational Monadic Let bind : MT 1 (T 1 MT 2 bool) MT 2 bool m 12 { x m 1 m 2. body bind m 1 (λx m 2.body) m 12 Γ m 1 : MT 1 Γ, x : T 1, m 2 : MT 2 body : bool Γ m 12 : MT { 2 ) x m 1 Γ (m 12 : bool m 2. body Jeremy Siek Monads for Relations 13 / 20

15 Monadic CBV Lambda with References and Abort ρ e m Env Expr M Value return (ρ x) m ρ x m return λx.e, ρ m ρ λx.e m ρ { e 1 m 1 v m 1 m 1 12 m 2. v 1 = λx.e, ρ ρ e 2 m { 2 v m 2 m m 3. ρ [x v 2 ] e m 3 ρ e 1 e 2 m 13 ρ e m 1 m 12 { v m 1 m 2. alloc v m 2 ρ ref e m 12 ρ e m 1 m 12 { v m 1 m 2. a. v = a get a m 2 ρ!e m 12 ρ e 1 m 1 v 1 m 1 ρ e 2 m 2 m 13 m 23. v 2 m 2 m 23 m 3. a. v 1 = a set a v 2 m 3 ρ e 1 := e 2 m 13 ρ e m 1 m 12 { v m 1 m 2. exit v m 2 ρ abort e m 12 Jeremy Siek Monads for Relations 14 / 20

16 The State and Error Monad Definition MT State (T State + Abort) return v m µ. m = (µ, inl(v, µ)) m 12 { x m 1 m 2. body µ 0. (m 1 = (µ 0, inr(abort)) m 12 = (µ 0, inr(abort))) ( µ 1 v 1 m 2. m 1 = (µ 0, inl(v 1, µ 1 )) body[v 1 /x] ((m 2 = (µ 1, inr(abort)) m 12 = (µ 0, inr(abort))) ( v 2 µ 2.m 2 = (µ 1, inl(v 2, µ 2 )) m 12 = (µ 0, inl(v 2, µ 2 ))))) Jeremy Siek Monads for Relations 15 / 20

17 The State and Error Monad Definition, cont d alloc v m µa. m = (µ, inl(a, µ[a v])) a / dom(µ) get a m µ. m = (µ, inl(µ(a), µ)) set a v m µ. m = (µ, inl(v, µ[a v])) exit v m µ. m = (µ, inr(abort v)) Jeremy Siek Monads for Relations 16 / 20

18 Non-deterministic Choice e ::=... amb e e fail MT T set return v m (m = {v}) m 12 { x m 1 m 2. body { m 12 = v x m 2. x m 1 v m 2 body } Jeremy Siek Monads for Relations 17 / 20

19 First-Class Continuations (Untested) e ::=... letcc x.e throw e e MT (T Answer bool) Answer Answer Value return v 1 m ( c v 2.m = (c, v 2 ) c v 1 v 2 ) m 12 { x m 1 m 2. body c 1 v 2.m 12 = (c 1, v 2 ) m 1 = (λx v 1. m 2. m 2 = (c 1, v 1 ) body, v 2 ) Jeremy Siek Monads for Relations 18 / 20

20 Tool Support Isabelle state, error, and non-determinism work just fine. having trouble with continuations (need to convince Isabelle that the rules are monotonic). Kanren (logic programming in Scheme, from Dan Friedman et al.) state, error, and non-determinism work just fine. can t do continuations because it doesn t support higher-order unification On the to-do list: Agda λprolog Jeremy Siek Monads for Relations 19 / 20

Discrete Mathematics

Discrete Mathematics Discrete Mathematics Jeremy Siek Spring 2010 Jeremy Siek Discrete Mathematics 1 / 24 Outline of Lecture 3 1. Proofs and Isabelle 2. Proof Strategy, Forward and Backwards Reasoning 3. Making Mistakes Jeremy

More information

λ S : A Lambda Calculus with Side-effects

λ S : A Lambda Calculus with Side-effects L14-1 λ S : A Lambda Calculus with Side-effects delivered by Jacob Schwartz Laboratory for Computer Science M.I.T. Lecture 14 M-Structures and Barriers L14-2 Some problems cannot be expressed functionally

More information

Operational Semantics Using the Partiality Monad

Operational Semantics Using the Partiality Monad page.1 Operational Semantics Using the Partiality Monad Nils Anders Danielsson (Göteborg) Shonan Meeting 026: Coinduction for computation structures and programming languages The research leading to these

More information

Blame for All. Amal Ahmed, Robert Bruce Findler, Jeremy Siek, Philip Wadler

Blame for All. Amal Ahmed, Robert Bruce Findler, Jeremy Siek, Philip Wadler Blame for All Amal Ahmed, Robert Bruce Findler, Jeremy Siek, Philip Wadler Vs. Part I The bit you know from before with a twist A simple untyped program let inc = λx. x + 1 in let app = λf. λx. f x in

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Xiangyu Zhang The slides are compiled from Alex Aiken s Michael D. Ernst s Sorin Lerner s A Scary Outline Type-based analysis Data-flow analysis Abstract interpretation Theorem

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

Programming Languages

Programming Languages CSE 230: Winter 2010 Principles of Programming Languages Lecture 10: Programming in λ-calculusc l l Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2

More information

A Modular Rewriting Semantics for CML

A Modular Rewriting Semantics for CML A Modular Rewriting Semantics for CML Fabricio Chalub Barbosa do Rosário frosario@ic.uff.br 19 de março de 2004 0-0 Outline A closer look at MSOS Mapping MSOS to MRS Executing and model checking CML programs

More information

Review. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007

Review. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007 CSE 230: Winter 2007 Principles of Programming Languages Lecture 12: The λ-calculus Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2 Several evaluation

More information

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus CS 4110 Programming Languages & Logics Lecture 16 Programming in the λ-calculus 30 September 2016 Review: Church Booleans 2 We can encode TRUE, FALSE, and IF, as: TRUE λx. λy. x FALSE λx. λy. y IF λb.

More information

GOTO the past / programs choose their own adventure. CSE 505: Programming Languages

GOTO the past / programs choose their own adventure. CSE 505: Programming Languages GOTO the past / programs choose their own adventure. CSE 505: Programming Languages Lecture 13 Evaluation Contexts First-Class Continuations Continuation-Passing Style Zach Tatlock Fall 2013 Zach Tatlock

More information

A Call-by-Name CPS Hierarchy

A Call-by-Name CPS Hierarchy A Call-by-Name CPS Hierarchy Asami Tanaka and Yukiyoshi Kameyama University of Tsukuba, Japan asami@logic.cs.tsukuba.ac.jp,kameyama@acm.org Abstract. The Continuation-Passing-Style (CPS) translation gives

More information

Conditioning and density, mathematically and computationally

Conditioning and density, mathematically and computationally This work is supported by DARPA grant FA87-14-2-7. 1 Conditioning and density, mathematically and computationally Chung-chieh Shan (with Wazim Mohammed Ismail) Mathematical Foundations of Programming Semantics

More information

Abstracting Definitional Interpreters. David Van Horn

Abstracting Definitional Interpreters. David Van Horn Abstracting Definitional Interpreters David Van Horn Abstracting Definitional Interpreters David Van Horn Northeastern University Definitional interpreters written in monadic style can express a wide variety

More information

Command = Value Context. Hans-Dieter Hiep. 15th of June, /17

Command = Value Context. Hans-Dieter Hiep. 15th of June, /17 1/17 Command = Value Context Hans-Dieter Hiep 15th of June, 2018 2/17 Example Consider a total functional programming language. swap :: A B B A swap (a, b) = (b, a) paws :: A B B A paws a = a paws b =

More information

CS 611 Advanced Programming Languages. Andrew Myers Cornell University. Lecture 26 Type reconstruction. 1 Nov 04. Type reconstruction

CS 611 Advanced Programming Languages. Andrew Myers Cornell University. Lecture 26 Type reconstruction. 1 Nov 04. Type reconstruction CS 611 Advanced Programming Languages Andrew Myers Cornell University Lecture 26 Type reconstruction 1 Nov 04 Type reconstruction Simple typed language: e ::= x b λx:τ. e e 1 e 2 e 1 + e 2 if e 0 then

More information

A Systematic Approach to Delimited Control with Multiple Prompts. Paul Downen, Zena M. Ariola. March 25, University of Oregon

A Systematic Approach to Delimited Control with Multiple Prompts. Paul Downen, Zena M. Ariola. March 25, University of Oregon A Systematic Approach to Delimited Control with Multiple Prompts Paul Downen, Zena M. Ariola University of Oregon March 25, 2012 Introduction to control operators Separating a redex from its evaluation

More information

CS 6110 Lecture 35 Solving Domain Equations 19 April 2013 Lecturer: Andrew Myers

CS 6110 Lecture 35 Solving Domain Equations 19 April 2013 Lecturer: Andrew Myers CS 6110 Lecture 35 Solving Domain Equations 19 April 2013 Lecturer: Andrew Myers To develop a denotational semantics for a language with recursive types, or to give a denotational semantics for the untyped

More information

Consistency of a Programming Logic for a Version of PCF Using Domain Theory

Consistency of a Programming Logic for a Version of PCF Using Domain Theory Consistency of a Programming Logic for a Version of PCF Using Domain Theory Andrés Sicard-Ramírez EAFIT University Logic and Computation Seminar EAFIT University 5 April, 3 May 2013 A Core Functional Programming

More information

CS611 Lecture 25 Solving Domain Equations 22 October 2007 Lecturer: Andrew Myers

CS611 Lecture 25 Solving Domain Equations 22 October 2007 Lecturer: Andrew Myers CS611 Lecture 25 Solving Domain Equations 22 October 2007 Lecturer: Andrew Myers To develop a denotational semantics for a language with recursive types, or to give a denotational semantics for the untyped

More information

A proof checking kernel for the λπ-calculus modulo

A proof checking kernel for the λπ-calculus modulo A proof checking kernel for the λπ-calculus modulo Mathieu Boespflug, École Polytechnique PhD defense, 18 january 2011 Funded by Pythia of Delphi Pythia of Delphi True False Proof implies truth. 1 1 For

More information

COMPUTER SCIENCE TRIPOS

COMPUTER SCIENCE TRIPOS CST.2016.6.1 COMPUTER SCIENCE TRIPOS Part IB Thursday 2 June 2016 1.30 to 4.30 COMPUTER SCIENCE Paper 6 Answer five questions. Submit the answers in five separate bundles, each with its own cover sheet.

More information

Refined Environment Classifiers

Refined Environment Classifiers Refined Environment Classifiers Type- and Scope-safe Code Generation with Mutable Cells Oleg Kiselyov Yukiyoshi Kameyama Yuto Sudo Tohoku University University of Tsukuba APLAS 2016 November 22, 2016 Region

More information

Extending the Lambda Calculus: An Eager Functional Language

Extending the Lambda Calculus: An Eager Functional Language Syntax of the basic constructs: Extending the Lambda Calculus: An Eager Functional Language canonical forms z cfm ::= intcfm boolcfm funcfm tuplecfm altcfm intcfm ::= 0 1-1... boolcfm ::= boolconst funcfm

More information

Analysis-directed semantics

Analysis-directed semantics Analysis-directed semantics Dominic Orchard Imperial College London work in progress Syntax directed e.g. (untyped) λ-calculus to reduction relation (λx. e 1 ) e 2 e 1 [x/e 2 ] e 1 e 1 e 1 e 2 e 1 e 2

More information

Normalization by Evaluation

Normalization by Evaluation Normalization by Evaluation Andreas Abel Department of Computer Science and Engineering Chalmers and Gothenburg University PhD Seminar in Mathematical Engineering EAFIT University, Medellin, Colombia 9

More information

Element x is R-minimal in X if y X. R(y, x).

Element x is R-minimal in X if y X. R(y, x). CMSC 22100/32100: Programming Languages Final Exam M. Blume December 11, 2008 1. (Well-founded sets and induction principles) (a) State the mathematical induction principle and justify it informally. 1

More information

A Concurrent Logical Framework

A Concurrent Logical Framework A Concurrent Logical Framework Frank Pfenning Carnegie Mellon University Types Workshop Torino, Italy, April 2003 Joint work with Iliano Cervesato, David Walker, and Kevin Watkins Types 03, Torino, April

More information

Typed Arithmetic Expressions

Typed Arithmetic Expressions Typed Arithmetic Expressions CS 550 Programming Languages Jeremy Johnson TAPL Chapters 3 and 5 1 Types and Safety Evaluation rules provide operational semantics for programming languages. The rules provide

More information

References. 7 November. Fall Software Foundations CIS 500. Another example. Announcements. Homework 7 out today, due November 14.

References. 7 November. Fall Software Foundations CIS 500. Another example. Announcements. Homework 7 out today, due November 14. CIS 500 Software Foundations Fall 2005 7 November CIS 500, 7 November 1 References CIS 500, 7 November 3 Announcements Midterm II is one week from Wednesday (November 16). It will cover TAPL chapters 8-14

More information

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications NICTA Advanced Course Theorem Proving Principles, Techniques, Applications λ 1 CONTENT Intro & motivation, getting started with Isabelle Foundations & Principles Lambda Calculus Higher Order Logic, natural

More information

Principles of Program Analysis: Control Flow Analysis

Principles of Program Analysis: Control Flow Analysis Principles of Program Analysis: Control Flow Analysis Transparencies based on Chapter 3 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis. Springer Verlag

More information

Fully-Abstract Compilation by Approximate Back-Translation Technical Appendix

Fully-Abstract Compilation by Approximate Back-Translation Technical Appendix Fully-Abstract Compilation by Approximate Back-Translation Technical Appendix Abstract This technical appendix provides the full formalisation and proofs for its paper 1 Contents 1 The Source Language

More information

Discrete Mathematics

Discrete Mathematics Discrete Mathematics Jeremy Siek Spring 2010 Jeremy Siek Discrete Mathematics 1 / 20 Outline of Lecture 4 1. Overview of First-Order Logic 2. Beyond Booleans: natural numbers, integers, etc. 3. Universal

More information

Extraction from classical proofs using game models

Extraction from classical proofs using game models 1/16 Extraction from classical proofs using game models Valentin Blot University of Bath research funded by the UK EPSRC 2/16 The computational content of classical logic Griffin, 1990: Computational content

More information

The Lambda Calculus. Stephen A. Edwards. Fall Columbia University

The Lambda Calculus. Stephen A. Edwards. Fall Columbia University The Lambda Calculus Stephen A. Edwards Columbia University Fall 2014 Lambda Expressions Function application written in prefix form. Add four and five is (+ 4 5) Evaluation: select a redex and evaluate

More information

High-Level Small-Step Operational Semantics for Transactions (Technical Companion)

High-Level Small-Step Operational Semantics for Transactions (Technical Companion) High-Level Small-Step Operational Semantics for Transactions (Technical Companion) Katherine F. Moore, Dan Grossman July 15, 2007 Abstract This document is the technical companion to our POPL 08 submission

More information

Realizability Semantics of Parametric Polymorphism, General References, and Recursive Types

Realizability Semantics of Parametric Polymorphism, General References, and Recursive Types Realizability Semantics of Parametric Polymorphism, General References, and Recursive Types Lars Birkedal IT University of Copenhagen Joint work with Kristian Støvring and Jacob Thamsborg Oct, 2008 Lars

More information

A nominal relational model for local store

A nominal relational model for local store Replace this file with prentcsmacro.sty for your meeting, or with entcsmacro.sty for your meeting. Both can be found at the ENTCS Macro Home Page. A nominal relational model for local store Rasmus Ejlers

More information

Homework 5: Parallelism and Control Flow : Types and Programming Languages Fall 2015 TA: Evan Cavallo

Homework 5: Parallelism and Control Flow : Types and Programming Languages Fall 2015 TA: Evan Cavallo Homework 5: Parallelism and Control Flow 15-814: Types and Programming Languages Fall 2015 TA: Evan Cavallo (ecavallo@cs.cmu.edu) Out: 11/5/15 Due: 11/17/15, 10:30am 1 Cost Dynamics In this section, we

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

A probabilistic lambda calculus - Some preliminary investigations

A probabilistic lambda calculus - Some preliminary investigations A probabilistic lambda calculus - Some preliminary investigations Ugo Dal Lago, Margherita Zorzi Università di Bologna, Università di Verona June, 9-11, 2010, Torino Introduction: Λ P We present some results

More information

The Computational SLR: A Calculus for Verifying Cryptographic Proofs

The Computational SLR: A Calculus for Verifying Cryptographic Proofs The Computational SLR: A Calculus for Verifying Cryptographic Proofs Yu Zhang Institute of Software Chinese Academy of Sciences BASICS 09, Shanghai, China October 13, 2009 Background Formal verification

More information

On the Correctness of the Krivine Machine

On the Correctness of the Krivine Machine On the Correctness of the Krivine Machine Mitchell Wand Northeastern University 2003-10-03 15:55:00 wand October 3, 2003 Abstract We provide a short proof of the correctness of the Krivine machine by showing

More information

Denotational semantics

Denotational semantics Denotational semantics Semantics and Application to Program Verification Antoine Miné École normale supérieure, Paris year 2015 2016 Course 4 4 March 2016 Course 4 Denotational semantics Antoine Miné p.

More information

Cartesian closed 2-categories and rewriting

Cartesian closed 2-categories and rewriting Cartesian closed 2-categories and rewriting Aurore Alcolei A brief presentation of Tom Hirschowitz s paper, Cartesian closed 2-categories and permutation equivalence in higher-order rewriting June 7, 2014

More information

Depending on equations

Depending on equations Depending on equations A proof-relevant framework for unification in dependent type theory Jesper Cockx DistriNet KU Leuven 3 September 2017 Unification for dependent types Unification is used for many

More information

State-Dependent Representation Independence (Technical Appendix)

State-Dependent Representation Independence (Technical Appendix) State-Dependent Representation Independence (Technical Appendix) Amal Ahmed Derek Dreyer Andreas Rossberg TTI-C MPI-SWS MPI-SWS amal@tti-c.org dreyer@mpi-sws.mpg.de rossberg@mpi-sws.mpg.de Contents August

More information

A Sample State Machine

A Sample State Machine A Sample State Machine Environment Signatures An environment signature is a triple of sets of guards, actions, and messages. H = (G H, A H, M H ) Guards: formulas in some logical language, e.g. OCL. Actions

More information

CS357: CTL Model Checking (two lectures worth) David Dill

CS357: CTL Model Checking (two lectures worth) David Dill CS357: CTL Model Checking (two lectures worth) David Dill 1 CTL CTL = Computation Tree Logic It is a propositional temporal logic temporal logic extended to properties of events over time. CTL is a branching

More information

Continuations, Processes, and Sharing. Paul Downen, Luke Maurer, Zena M. Ariola, Daniele Varacca. September 8, 2014

Continuations, Processes, and Sharing. Paul Downen, Luke Maurer, Zena M. Ariola, Daniele Varacca. September 8, 2014 Continuations, Processes, and Sharing Paul Downen, Luke Maurer, Zena M. Ariola, Daniele Varacca University of Oregon, Université Paris Diderot September 8, 2014 The plethora of semantic artifacts Many

More information

Semantic Solutions to Program Analysis Problems

Semantic Solutions to Program Analysis Problems Semantic Solutions to Program Analysis Problems Sam Tobin-Hochstadt and David Van Horn PLDI FIT 2011 A talk in three parts. 1. A provocative claim. (The thought) 2. A idea about modular program analysis.

More information

Normalisation by evaluation

Normalisation by evaluation Normalisation by evaluation Sam Lindley Laboratory for Foundations of Computer Science The University of Edinburgh Sam.Lindley@ed.ac.uk August 11th, 2016 Normalisation and embedded domain specific languages

More information

Advanced topic: Space complexity

Advanced topic: Space complexity Advanced topic: Space complexity CSCI 3130 Formal Languages and Automata Theory Siu On CHAN Chinese University of Hong Kong Fall 2016 1/28 Review: time complexity We have looked at how long it takes to

More information

CIS 500 Software Foundations Final Exam Answer key December 20, 2004

CIS 500 Software Foundations Final Exam Answer key December 20, 2004 CIS 500 Software Foundations Final Exam Answer key December 20, 2004 True/False questions For each of the following statements, circle T if the sentence is true or F otherwise. 1. (10 points) (a) T F The

More information

KU Leuven Department of Computer Science

KU Leuven Department of Computer Science Reasoning about Obect Capabilities with Logical Relations and Effect Parametricity Technical Report including Proofs and Details Dominique Devriese Lars Birkedal Frank Piessens Report CW 690, January 2016

More information

(call/cc (lambda (k) (set! start-k k)))

(call/cc (lambda (k) (set! start-k k))) (call/cc (lambda (k) (set! start-k k))) 1 Adding Delimited and Composable Control to a Production Programming Environment Matthew Flatt University of Utah Gang Yu Institute of Software, Chinese Academy

More information

Step-Indexed Logical Relations for Probability

Step-Indexed Logical Relations for Probability Step-Indexed Logical Relations for Probability Aleš Bizjak and Lars Birkedal Aarhus University {abizjak,birkedal}@cs.au.dk Abstract. It is well-known that constructing models of higher-order probabilistic

More information

A Multiple-Conclusion Specification Logic

A Multiple-Conclusion Specification Logic A Multiple-Conclusion Specification Logic Alwen Tiu Australian National University ANU Logic Summer School Lecture 3, December 14, 2007 Alwen Tiu (ANU) Intuitionistic and Linear Logic (5) LSS07 1 / 18

More information

The Correctness of Launchbury s Natural Semantics for Lazy Evaluation

The Correctness of Launchbury s Natural Semantics for Lazy Evaluation The Correctness of Launchbury s Natural Semantics for Lazy Evaluation arxiv:1405.3099v1 [cs.pl] 13 May 2014 Joachim Breitner Programming Paradigms Group Karlsruhe Institute of Technology, Germany breitner@kit.edu

More information

Mechanics of Static Analysis

Mechanics of Static Analysis Escuela 03 III / 1 Mechanics of Static Analysis David Schmidt Kansas State University www.cis.ksu.edu/~schmidt Escuela 03 III / 2 Outline 1. Small-step semantics: trace generation 2. State generation and

More information

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus Course 2D1453, 200607 Advanced Formal Methods Lecture 3: Simply Typed Lambda calculus Mads Dam KTH/CSC Some material from B. Pierce: TAPL + some from G. Klein, NICTA Typing λterms The uptyped λcalculus

More information

Trust in the λ-calculus

Trust in the λ-calculus J. Functional Programming, 3(2):75-85, 1997. c Cambridge University Press 1 Trust in the λ-calculus P. ØRBÆK AND J. PALSBERG BRICS, Centre of the Danish National Research Foundation, Dept. of Computer

More information

An introduction to classical realizability

An introduction to classical realizability Q E I U G I C An introduction to classical realizability Alexandre Miquel O P. D E. L Ō A U D E L A R January 27th, 2017 EJCIM 17 Lyon The Curry-Howard correspondence The dictionary: Proof theory Functional

More information

Meta-reasoning in the concurrent logical framework CLF

Meta-reasoning in the concurrent logical framework CLF Meta-reasoning in the concurrent logical framework CLF Jorge Luis Sacchini (joint work with Iliano Cervesato) Carnegie Mellon University Qatar campus Nagoya University, 27 June 2014 Jorge Luis Sacchini

More information

Threesomes, With and Without Blame

Threesomes, With and Without Blame hreesomes, With and Without Blame Jeremy G. Siek 1 and Philip Wadler 2 1 University of Colorado at Boulder 2 University of Edinburgh Abstract. he blame calculus of Wadler and Findler gives a high-level

More information

EXTRACTING COST RECURRENCES FROM SEQUENTIAL AND PARALLEL FUNCTIONAL PROGRAMS

EXTRACTING COST RECURRENCES FROM SEQUENTIAL AND PARALLEL FUNCTIONAL PROGRAMS Wesleyan University EXTRACTING COST RECURRENCES FROM SEQUENTIAL AND PARALLEL FUNCTIONAL PROGRAMS By Justin Raymond Faculty Advisor: Norman Danner A Dissertation submitted to the Faculty of Wesleyan University

More information

CS 6110 Lecture 21 The Fixed-Point Theorem 8 March 2013 Lecturer: Andrew Myers. 1 Complete partial orders (CPOs) 2 Least fixed points of functions

CS 6110 Lecture 21 The Fixed-Point Theorem 8 March 2013 Lecturer: Andrew Myers. 1 Complete partial orders (CPOs) 2 Least fixed points of functions CS 6110 Lecture 21 The Fixed-Point Theorem 8 March 2013 Lecturer: Andrew Myers We saw that the semantics of the while command are a fixed point. We also saw that intuitively, the semantics are the limit

More information

1 Introduction. 2 Recap The Typed λ-calculus λ. 3 Simple Data Structures

1 Introduction. 2 Recap The Typed λ-calculus λ. 3 Simple Data Structures CS 6110 S18 Lecture 21 Products, Sums, and Other Datatypes 1 Introduction In this lecture, we add constructs to the typed λ-calculus that allow working with more complicated data structures, such as pairs,

More information

Meta-Reasoning in a Concurrent Logical Framework

Meta-Reasoning in a Concurrent Logical Framework Meta-Reasoning in a Concurrent Logical Framework Iliano Cervesato and Jorge Luis Sacchini Carnegie Mellon University Chalmers University, 16 Oct 2013 Iliano Cervesato and Jorge Luis Sacchini Meta-Reasoning

More information

Operational reasoning for functions with local state

Operational reasoning for functions with local state Operational reasoning for functions with local state Andrew Pitts and Ian Stark Abstract Languages such as ML or Lisp permit the use of recursively defined function expressions with locally declared storage

More information

On the Correctness and Efficiency of the Krivine Machine

On the Correctness and Efficiency of the Krivine Machine On the Correctness and Efficiency of the Krivine Machine Mitchell Wand Northeastern University Daniel P. Friedman Indiana University February 12, 2003 Abstract We provide a short derivation of the Krivine

More information

Non deterministic classical logic: the λµ ++ -calculus

Non deterministic classical logic: the λµ ++ -calculus Paru dans : Mathematical Logic Quarterly, 48, pp. 357-366, 2002 Non deterministic classical logic: the λµ ++ -calculus Karim NOUR LAMA - Equipe de Logique, Université de Savoie 73376 Le Bourget du Lac

More information

Simply Typed Lambda-Calculi (II)

Simply Typed Lambda-Calculi (II) THEORY AND PRACTICE OF FUNCTIONAL PROGRAMMING Simply Typed Lambda-Calculi (II) Dr. ZHANG Yu Institute of Software, Chinese Academy of Sciences Fall term, 2011 GUCAS, Beijing Introduction PCF Programming

More information

Classical First-Order Logic

Classical First-Order Logic Classical First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) First-Order Logic (Classical) MFES 2008/09

More information

CIS 500 Software Foundations Final Exam. Answer key. December 20, 2006

CIS 500 Software Foundations Final Exam. Answer key. December 20, 2006 CIS 500 Software Foundations Final Exam Answer key December 20, 2006 Instructions This is a closed-book exam. You have 120 minutes to answer all of the questions. The entire exam is worth 120 points. Questions

More information

Internship Report Game Semantics and Normalization by Evaluation for Brouwer Ordinals

Internship Report Game Semantics and Normalization by Evaluation for Brouwer Ordinals Internship Report Game Semantics and Normalization by Evaluation for Brouwer Ordinals Léo Exibard August 28, 2015 Abstract P. Clairambault and P. Dybjer developed a Normalization by Evaluation (NbE) algorithm

More information

Lambda-Calculus (I) 2nd Asian-Pacific Summer School on Formal Methods Tsinghua University, August 23, 2010

Lambda-Calculus (I) 2nd Asian-Pacific Summer School on Formal Methods Tsinghua University, August 23, 2010 Lambda-Calculus (I) jean-jacques.levy@inria.fr 2nd Asian-Pacific Summer School on Formal Methods Tsinghua University, August 23, 2010 Plan computation models lambda-notation bound variables conversion

More information

Fine-grained Detection of Privilege Escalation Attacks on Browser Extensions

Fine-grained Detection of Privilege Escalation Attacks on Browser Extensions Fine-grained Detection of Privilege Escalation Attacks on Browser Extensions Stefano Calzavara 1, Michele Bugliesi 1, Silvia Crafa 2, and Enrico Steffinlongo 1 1 Università Ca Foscari Venezia 2 University

More information

A fully abstract semantics for a nondeterministic functional language with monadic types

A fully abstract semantics for a nondeterministic functional language with monadic types A fully abstract semantics for a nondeterministic functional language with monadic types Alan Jeffrey 1 School of Cognitive and Computing Sciences University of Sussex, Brighton BN1 9QH, UK alanje@cogs.susx.ac.uk

More information

Towards Operations on Operational Semantics

Towards Operations on Operational Semantics Towards Operations on Operational Semantics Mauro Jaskelioff mjj@cs.nott.ac.uk School of Computer Science & IT 22 nd British Colloquium for Theoretical Computer Science The Context We need semantics to

More information

CIS 500 Software Foundations Midterm II Answer key November 17, 2004

CIS 500 Software Foundations Midterm II Answer key November 17, 2004 CIS 500 Software Foundations Midterm II Answer key November 17, 2004 Simply typed lambda-calculus The following questions refer to the simply typed lambda-calculus with booleans and error. The syntax,

More information

Reinvestigation of Symmetric Lambda Calculus

Reinvestigation of Symmetric Lambda Calculus Reinvestigation of Symmetric Lambda Calculus Yayoi Ueda Kenichi Asai Ochanomizu University Abstract This paper presents a symmetric lambda calculus (SLC) in which both the duality between callby-value

More information

Probabilistic Applicative Bisimulation and Call-by-Value Lam

Probabilistic Applicative Bisimulation and Call-by-Value Lam Probabilistic Applicative and Call-by-Value Lambda Calculi Joint work with Ugo Dal Lago ENS Lyon February 9, 2014 Probabilistic Applicative and Call-by-Value Lam Introduction Fundamental question: when

More information

Sharing in the weak lambda-calculus (2)

Sharing in the weak lambda-calculus (2) Sharing in the weak lambda-calculus (2) Jean-Jacques Lévy INRIA Joint work with Tomasz Blanc and Luc aranget Happy birthday Henk! Happy birthday Henk! Happy birthday Henk! History Sharing in the lambda-calculus

More information

Model Checking with CTL. Presented by Jason Simas

Model Checking with CTL. Presented by Jason Simas Model Checking with CTL Presented by Jason Simas Model Checking with CTL Based Upon: Logic in Computer Science. Huth and Ryan. 2000. (148-215) Model Checking. Clarke, Grumberg and Peled. 1999. (1-26) Content

More information

Limits Involving Infinity (Horizontal and Vertical Asymptotes Revisited)

Limits Involving Infinity (Horizontal and Vertical Asymptotes Revisited) Limits Involving Infinity (Horizontal and Vertical Asymptotes Revisited) Limits as Approaches Infinity At times you ll need to know the behavior of a function or an epression as the inputs get increasingly

More information

Graph lambda theories

Graph lambda theories Under consideration for publication in Math. Struct. in Comp. Science Graph lambda theories A N T O N I O B U C C I A R E L L I 1 and A N T O N I N O S A L I B R A 2 1 Equipe PPS (case 7014), Université

More information

Theories of Programming Languages Assignment 5

Theories of Programming Languages Assignment 5 Theories of Programming Languages Assignment 5 December 17, 2012 1. Lambda-Calculus (see Fig. 1 for initions of = β, normal order evaluation and eager evaluation). (a) Let Ω = ((λx. x x) (λx. x x)), and

More information

Type-Driven Gradual Security with References: Complete Definitions and Proofs

Type-Driven Gradual Security with References: Complete Definitions and Proofs Type-Driven Gradual Security with References: Complete Definitions and Proofs Technical Report TR/DCC-208-4 MATÍAS TORO, PLEIAD Laboratory, Computer Science Department (DCC), University of Chile RONALD

More information

c 2008 Charles McEwen Ellison III

c 2008 Charles McEwen Ellison III c 2008 Charles McEwen Ellison III A REWRITING LOGIC APPROACH TO DEFINING TYPE SYSTEMS BY CHARLES MCEWEN ELLISON III B.S., North Carolina State University, 2004 B.S., North Carolina State University, 2004

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

Type Systems. Lecture 9: Classical Logic. Neel Krishnaswami University of Cambridge

Type Systems. Lecture 9: Classical Logic. Neel Krishnaswami University of Cambridge Type Systems Lecture 9: Classical Logic Neel Krishnaswami University of Cambridge Where We Are We have seen the Curry Howard correspondence: Intuitionistic propositional logic Simply-typed lambda calculus

More information

Focusing on Binding and Computation

Focusing on Binding and Computation Focusing on Binding and Computation Dan Licata Joint work with Noam Zeilberger and Robert Harper Carnegie Mellon University 1 Programming with Proofs Represent syntax, judgements, and proofs Reason about

More information

A Monadic Analysis of Information Flow Security with Mutable State

A Monadic Analysis of Information Flow Security with Mutable State A Monadic Analysis of Information Flow Security with Mutable State Karl Crary Aleksey Kliger Frank Pfenning July 2003 CMU-CS-03-164 School of Computer Science Carnegie Mellon University Pittsburgh, PA

More information

On space efficiency of Krivine s abstract machine and Hyland-Ong games

On space efficiency of Krivine s abstract machine and Hyland-Ong games 13/02/08, LIPN p.1/28 On space efficiency of Krivine s abstract machine and Hyland-Ong games Kazushige Terui terui@nii.ac.jp National Institute of Informatics, Tokyo Laboratoire d Informatics de Paris

More information

Staged Notational Definitions

Staged Notational Definitions Staged Notational Definitions Walid Taha 1 and Patricia Johann 2 1 Department of Computer Science, Rice University, taha@cs.rice.edu 2 Department of Computer Science, Rutgers University, pjohann@crab.rutgers.edu

More information

Convex Analysis and Economic Theory AY Elementary properties of convex functions

Convex Analysis and Economic Theory AY Elementary properties of convex functions Division of the Humanities and Social Sciences Ec 181 KC Border Convex Analysis and Economic Theory AY 2018 2019 Topic 6: Convex functions I 6.1 Elementary properties of convex functions We may occasionally

More information

Monad Transformers as Monoid Transformers

Monad Transformers as Monoid Transformers Monad Transformers as Monoid Transformers Mauro Jaskelioff CIFASIS/Universidad Nacional de Rosario, Argentina Eugenio Moggi 1 DISI, Università di Genova, Italy Abstract The incremental approach to modular

More information

Operational Semantics

Operational Semantics Operational Semantics Semantics and applications to verification Xavier Rival École Normale Supérieure Xavier Rival Operational Semantics 1 / 50 Program of this first lecture Operational semantics Mathematical

More information