Operational Semantics Using the Partiality Monad

Size: px
Start display at page:

Download "Operational Semantics Using the Partiality Monad"

Transcription

1 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 results has received funding from the European Research Council under the European Union s Seventh Framework Programme (FP7/ )/ERC grant agreement n This presentation does not necessarily reflect the views of the ERC or the EU. The EU is not liable for any use of the presented information.

2 page.2 Total Definitional Interpreters Nils Anders Danielsson (Göteborg) Shonan Meeting 026: Coinduction for computation structures and programming languages The research leading to these results has received funding from the European Research Council under the European Union s Seventh Framework Programme (FP7/ )/ERC grant agreement n This presentation does not necessarily reflect the views of the ERC or the EU. The EU is not liable for any use of the presented information.

3 page.3 Outline Using partiality monad to: Define semantics of partial language: total definitional interpreter. Prove type soundness. Prove compiler correctness.

4 page.4 A partial language A language with two effects: non-termination and crashes. t = c x λx.t t t Represented using well-scoped de Bruijn indices: data Tm (n N) Set where con N Tm n var Fin n Tm n lam Tm (1 + n) Tm n app Tm n Tm n Tm n

5 page.5 A partial language A language with two effects: non-termination and crashes. t = c x λx.t t t Represented using well-scoped de Bruijn indices: data Tm (n N) Set where con N Tm n var Fin n Tm n lam Tm (1 + n) Tm n app Tm n Tm n Tm n

6 page.6 Environments and values Based on closures: Env N Set Env n = Vec Value n data Value Set where con N Value clo Tm (1 + n) Env n Value

7 page.7 Definitional interpreter Tm n Env n Value con i ρ = con i var x ρ = lookup x ρ lam t ρ = clo t ρ app t 1 t 2 ρ = t 1 ρ t 2 ρ Value Value Value clo t 1 ρ v 2 = t 1 (v 2 ρ)

8 page.8 Definitional interpreter Tm n Env n Value con i ρ = con i var x ρ = lookup x ρ lam t ρ = clo t ρ app t 1 t 2 ρ = t 1 ρ t 2 ρ Value Value Value clo t 1 ρ v 2 = t 1 (v 2 ρ)

9 page.9 Definitional interpreter Tm n Env n Value con i ρ = con i var x ρ = lookup x ρ lam t ρ = clo t ρ app t 1 t 2 ρ = t 1 ρ t 2 ρ Value Value Value clo t 1 ρ v 2 = t 1 (v 2 ρ)

10 page.10 Definitional interpreter Tm n Env n Value con i ρ = con i var x ρ = lookup x ρ lam t ρ = clo t ρ app t 1 t 2 ρ = t 1 ρ t 2 ρ Value Value Value clo t 1 ρ v 2 = t 1 (v 2 ρ)

11 page.11 Definitional interpreter Tm n Env n Value con i ρ = con i var x ρ = lookup x ρ lam t ρ = clo t ρ app t 1 t 2 ρ = t 1 ρ t 2 ρ Value Value Value clo t 1 ρ v 2 = t 1 (v 2 ρ)

12 page.12 Definitional interpreter Tm n Env n Value con i ρ = con i var x ρ = lookup x ρ lam t ρ = clo t ρ app t 1 t 2 ρ = t 1 ρ t 2 ρ Value Value Value clo t 1 ρ v 2 = t 1 (v 2 ρ)

13 page.13 Definitional interpreter Tm n Env n Value con i ρ = con i var x ρ = lookup x ρ lam t ρ = clo t ρ app t 1 t 2 ρ = t 1 ρ t 2 ρ Value Value Value clo t 1 ρ v 2 = t 1 (v 2 ρ) Does not work in Agda, Coq Call-by-value? Call-by-name?

14 page.14 Relational, big-step semantics Can define inductive big-step semantics: ρ t v Very similar to definitional interpreter, but we cannot run the semantics. Does not distinguish between non-termination and crashes.

15 page.15 Relational, big-step semantics Can add coinductive big-step semantics: ρ t Problem: Duplication of rules. Problem: Have we forgotten a rule?

16 page.16 Alternative Definitional interpreter + partiality monad functional, big-step semantics.

17 page.17 Partiality monad

18 page.18 Partiality monad codata (A Set) Set where now A A later A A Constructive partiality monad, not maybe monad or exception monad. A ν C. A + C.

19 page.19 Partiality monad codata (A Set) Set where now A A later A A Constructive partiality monad, not maybe monad or exception monad. A ν C. A + C.

20 page.20 Partiality monad codata (A Set) Set where now A A later A A Constructive partiality monad, not maybe monad or exception monad. A ν C. A + C.

21 page.21 Partiality monad codata (A Set) Set where now A A later A A never A never = later never >= A (A B ) B now x >= f = f x later x >= f = later (x >= f)

22 page.22 Partiality monad codata (A Set) Set where now A A later A A What is the right notion of equality for A? later (later (now 5)) now 5 later never never now 5 never Equality up to finite differences in the number of later constructors.

23 page.23 Total definitional interpreter

24 page.24 Definitional interpreter Tm n Env n Value con i ρ = con i var x ρ = lookup x ρ lam t ρ = clo t ρ app t 1 t 2 ρ = t 1 ρ t 2 ρ Value Value Value clo t 1 ρ v 2 = t 1 (v 2 ρ)

25 page.25 Definitional interpreter With Maybe monad: Tm n Env n Maybe Value con i ρ = return (con i) var x ρ = return (lookup x ρ) lam t ρ = return (clo t ρ) app t 1 t 2 ρ = t 1 ρ >= λ v 1 t 2 ρ >= λ v 2 v 1 v 2 Value Value Maybe Value clo t 1 ρ v 2 = t 1 (v 2 ρ) con i 1 v 2 = fail

26 page.26 Definitional interpreter With Maybe monad: Tm n Env n Maybe Value con i ρ = return (con i) var x ρ = return (lookup x ρ) lam t ρ = return (clo t ρ) app t 1 t 2 ρ = t 1 ρ >= λ v 1 t 2 ρ >= λ v 2 v 1 v 2 Value Value Maybe Value clo t 1 ρ v 2 = t 1 (v 2 ρ) con i 1 v 2 = fail

27 page.27 Total definitional interpreter With Maybe + : Tm n Env n (Maybe Value) con i ρ = return (con i) var x ρ = return (lookup x ρ) lam t ρ = return (clo t ρ) app t 1 t 2 ρ = t 1 ρ >= λ v 1 t 2 ρ >= λ v 2 v 1 v 2 Value Value (Maybe Value) clo t 1 ρ v 2 = later ( t 1 (v 2 ρ)) con i 1 v 2 = fail

28 page.28 Total definitional interpreter With Maybe + : Tm n Env n (Maybe Value) con i ρ = return (con i) var x ρ = return (lookup x ρ) lam t ρ = return (clo t ρ) app t 1 t 2 ρ = t 1 ρ >= λ v 1 t 2 ρ >= λ v 2 v 1 v 2 Value Value (Maybe Value) clo t 1 ρ v 2 = later ( t 1 (v 2 ρ)) con i 1 v 2 = fail

29 page.29 Total definitional interpreter Tm n Env n (Maybe Value) Type signature deterministic. Type signature computable. No duplication of rules. Impossible to forget a case. Classically equivalent to ρ t v plus ρ t.

30 page.30 Type soundness

31 page.31 Types Coinductive simple types (to allow non-termination): codata Ty Set where nat Ty Ty Ty Ty τ Ty τ = τ nat Typing relation: Γ t σ

32 page.32 Type soundness Statement of type soundness: [ ] t σ t [ ] fail Proof: Generalise, then nested corecursion/ structural recursion.

33 page.33 Compiler correctness

34 page.34 Virtual machine data State Set where data Result Set where continue State Result done VM-Value Result crash Result step State Result step = step = crash

35 page.35 Virtual machine Small-step, total, functional semantics: exec State (Maybe VM-Value) exec s = case step s of continue s later (exec s ) done v return v crash fail Type signature deterministic. Type signature computable. Possible to forget a case.

36 page.36 Compiler correctness Small-step, total, functional semantics: exec State (Maybe VM-Value) Compilers: comp comp v Tm 0 State Value VM-Value

37 page.37 Compiler correctness Small-step, total, functional semantics: exec State (Maybe VM-Value) Compilers: comp comp v Tm 0 State Value VM-Value Compiler correctness: (t Tm 0) exec (comp t) ( t [ ] >= λ v return (comp v v))

38 page.38 Conclusions Definitional interpreter + partiality monad functional, total, big-step semantics. Can mechanise (some) meta-theory. See paper for non-determinism, contextual equivalence, applicative bisimilarity.

39 page.39 Bonus slides

40 page.40 Operational semantics? Very close to usual, relational big-step operational semantics. Not compositional. Values contain closures.

41 page.41 Typing rules Γ con i nat Γ var x lookup x Γ σ Γ t τ Γ lam t σ τ Γ t 1 σ τ Γ t 2 σ Γ app t 1 t 2 τ

42 page.42 Applicative bisimilarity, part 1 data (Maybe Value) (Maybe Value) Set where now u MV v now u now v later (x y) later x later y later l x y later x y later r x y x later y data MV Maybe Value Maybe Value Set where just u V v just u MV just v nothing nothing MV nothing

43 page.43 Applicative bisimilarity, part 2 data V Value Value Set where con con i V con i clo ( v ( t 1 (v ρ 1 ) t 2 (v ρ 2 ))) clo t 1 ρ 1 V clo t 2 ρ 2 T Tm n Tm n Set t 1 T t 2 = ρ t 1 ρ t 2 ρ

Normalization by Evaluation in the Delay Monad A Case Study for Coinduction via Copatterns and Sized Types

Normalization by Evaluation in the Delay Monad A Case Study for Coinduction via Copatterns and Sized Types Normalization by Evaluation in the Delay Monad A Case Study for Coinduction via Copatterns and Sized Types Andreas Abel Department of Computer Science and Engineering Chalmers and Gothenburg University

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

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 P. 1 of 7 THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 December, 2016 Time: 2 hrs. Instructions The exam contains questions totaling 100 points. Answer all questions.

More information

Subtyping, Declaratively

Subtyping, Declaratively Subtyping, Declaratively An Exercise in Mixed Induction and Coinduction Nils Anders Danielsson and Thorsten Altenkirch University of Nottingham Abstract. It is natural to present subtyping for recursive

More information

Subtyping, Declaratively

Subtyping, Declaratively Subtyping, Declaratively An Exercise in Mixed Induction and Coinduction Nils Anders Danielsson and Thorsten Altenkirch University of Nottingham Abstract. It is natural to present subtyping for recursive

More information

From Operational Semantics to Abstract Machines

From Operational Semantics to Abstract Machines From Operational Semantics to Abstract Machines John Hannan Department of Computer Science, University of Copenhagen, Universitetsparken 1, DK-2100 Copenhagen East, Denmark. hannan@diku.dk Dale Miller

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

Internship report Testing judgements of type theory Chalmers Tekniska Högskola, Göteborg

Internship report Testing judgements of type theory Chalmers Tekniska Högskola, Göteborg Internship report Testing judgements of type theory Chalmers Tekniska Högskola, Göteborg Rodolphe Lepigre Université de Savoie, Chambéry rodolphe.lepigre@etu.univ-savoie.fr Under the supervision of Peter

More information

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 P. 1 of 7 THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 December, 2014 Time: 2 hrs. Instructions The exam contains questions totaling 100 points. Answer all questions.

More information

Coinductive big-step semantics and Hoare logics for nontermination

Coinductive big-step semantics and Hoare logics for nontermination Coinductive big-step semantics and Hoare logics for nontermination Tarmo Uustalu, Inst of Cybernetics, Tallinn joint work with Keiko Nakata COST Rich Models Toolkit meeting, Madrid, 17 18 October 2013

More information

The Lifting Lemma. Ralf Hinze

The Lifting Lemma. Ralf Hinze The Lifting Lemma Ralf Hinze Computing Laboratory, University of Oxford Wolfson Building, Parks Road, Oxford, OX1 3QD, England ralf.hinze@comlab.ox.ac.uk http://www.comlab.ox.ac.uk/ralf.hinze/ June 2009

More information

Strong Normalization for Guarded Types

Strong Normalization for Guarded Types Strong Normalization for Guarded Types Andreas Abel Andrea Vezzosi Department of Computer Science and Engineering Chalmers and Gothenburg University, Sweden PLS Seminar ITU, Copenhagen, Denmark 20 August

More information

Nunchaku: Flexible Model Finding for Higher-Order Logic

Nunchaku: Flexible Model Finding for Higher-Order Logic Nunchaku: Flexible Model Finding for Higher-Order Logic Simon Cruanes, Jasmin Blanchette, Andrew Reynolds Veridis, Inria Nancy https://cedeela.fr/~simon/ April 7th, 2016 1 / 21 Summary Introduction Nunchaku

More information

Normalisation by Evaluation for Dependent Types

Normalisation by Evaluation for Dependent Types Normalisation by Evaluation for Dependent Types Ambrus Kaposi Eötvös Loránd University, Budapest, Hungary (j.w.w. Thorsten Altenkirch, University of Nottingham) FSCD, Porto 24 June 2016 Introduction Goal:

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

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

Modular Bisimulation Theory for Computations and Values

Modular Bisimulation Theory for Computations and Values Modular Bisimulation Theory for Computations and Values Swansea University, UK FoSSaCS, Rome March 2013 Part of the project: PLanCompS http://www.plancomps.org EPSRC-funded, 2011-2015 {Swansea, Royal Holloway,

More information

Coinductive big-step operational semantics

Coinductive big-step operational semantics Coinductive big-step operational semantics Xavier Leroy a, Hervé Grall b a INRIA Paris-Rocquencourt Domaine de Voluceau, B.P. 105, 78153 Le Chesnay, France b École des Mines de Nantes La Chantrerie, 4,

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

Mathematical Synthesis of Equational Deduction Systems. Marcelo Fiore. Computer Laboratory University of Cambridge

Mathematical Synthesis of Equational Deduction Systems. Marcelo Fiore. Computer Laboratory University of Cambridge Mathematical Synthesis of Equational Deduction Systems Marcelo Fiore Computer Laboratory University of Cambridge TLCA 2009 3.VII.2009 Context concrete theories meta-theories Context concrete theories meta-theories

More information

Coalgebras and Codata in Agda

Coalgebras and Codata in Agda Coalgebras and Codata in Agda Anton Setzer Swansea University (Wales, UK) (Wessex Seminar, Bath, 3 March 2009) 1. The concept of codata. 2. Codata in Agda. 3. Weakly Final Coalgebras in Dependent Type

More information

The Curry-Howard Isomorphism

The Curry-Howard Isomorphism The Curry-Howard Isomorphism Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) The Curry-Howard Isomorphism MFES 2008/09

More information

Simply Typed Lambda Calculus

Simply Typed Lambda Calculus Simply Typed Lambda Calculus Mathias Vorreiter Pedersen November 13, 2015 1 Recalling the untyped lambda calculus 1.1 Syntax t ::= x λ x. t t t 1.2 Evaluation x x t t λx.t λx.t t 1 t 1 t 2 t 2 t 1 t 2

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

First Class Traversal Idioms with Nested Attribute Grammars

First Class Traversal Idioms with Nested Attribute Grammars First Class Traversal Idioms with Nested Attribute Grammars Arie Middelkoop Dept. of Information and Computing Sciences, Utrecht University P.O. Box 80.089, 3508 TB Utrecht, The Netherlands Web pages:

More information

Streams and Coalgebra Lecture 2

Streams and Coalgebra Lecture 2 Streams and Coalgebra Lecture 2 Helle Hvid Hansen and Jan Rutten Radboud University Nijmegen & CWI Amsterdam Representing Streams II, Lorentz Center, Leiden, January 2014 Tutorial Overview Lecture 1 (Hansen):

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

Subtyping and Intersection Types Revisited

Subtyping and Intersection Types Revisited Subtyping and Intersection Types Revisited Frank Pfenning Carnegie Mellon University International Conference on Functional Programming (ICFP 07) Freiburg, Germany, October 1-3, 2007 Joint work with Rowan

More information

F-in Coq: A Deep Embedding

F-in Coq: A Deep Embedding F-in Coq: A Deep Embedding Robert Atkey School of Informatics, University of Edinburgh 4th September 2009 What? Syntax and denotational semantics of System F. Parametric polymorphism. Goal: α.((α α) α)

More information

A Calculus of Definitions

A Calculus of Definitions A Calculus of Definitions June 13, 2017 1 Type theory We describe how to implement a core type theory. This is very close to a functional programming language with λ abstraction and data types defined

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

Proofs and computations

Proofs and computations (j.w.w. Kenji Miyamoto) Mathematisches Institut, LMU, München Leeds University, 7. March 2012 Formalization and extraction One can extract from a (constructive) proof of a formula with computational content

More information

A Denotational Approach to Measuring Complexity in Functional Programs

A Denotational Approach to Measuring Complexity in Functional Programs A Denotational Approach to Measuring Complexity in Functional Programs Kathryn Van Stone June 2003 CMU-CS-03-150 School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213 Thesis Committee:

More information

Program Testing and Constructive Validity

Program Testing and Constructive Validity Program Testing and Constructive Validity Peter Dybjer Chalmers University of Technology, Göteborg, Sweden Philosophy and Foundations of Mathematics: Epistemological and Ontological Aspects - to Per Martin-Löf

More information

Groups and higher groups in homotopy type theory

Groups and higher groups in homotopy type theory Groups and higher groups in homotopy type theory Ulrik Buchholtz TU Darmstadt Arbeitstagung Bern-München, December 14, 2017 1 Groups 2 Higher Groups 3 Nominal Types 4 Formalizing type theory 5 Conclusion

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

Logic for Computational Effects: work in progress

Logic for Computational Effects: work in progress 1 Logic for Computational Effects: work in progress Gordon Plotkin and John Power School of Informatics University of Edinburgh King s Buildings Mayfield Road Edinburgh EH9 3JZ Scotland gdp@inf.ed.ac.uk,

More information

Indexed Induction-Recursion

Indexed Induction-Recursion Indexed Induction-Recursion Peter Dybjer a, a Department of Computer Science and Engineering, Chalmers University of Technology, 412 96 Göteborg, Sweden Email: peterd@cs.chalmers.se, http://www.cs.chalmers.se/

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

Normalisation by Evaluation for Dependent Types

Normalisation by Evaluation for Dependent Types Normalisation by Evaluation for Dependent Types Thorsten Altenkirch 1 and Ambrus Kaposi 1 1 School for Computer Science, University of Nottingham Nottingham, United Kingdom {txa auk}@cs.nott.ac.uk Abstract

More information

The lambda calculus with constructors

The lambda calculus with constructors The lambda calculus with constructors Categorical semantic and Continuations Barbara Petit Focus - Univ. Bologna CaCos 2012 Barbara Petit (Focus - Univ. Bologna) The lambda calculus with constructors 1

More information

Copatterns Programming Infinite Objects by Observations

Copatterns Programming Infinite Objects by Observations Copatterns Programming Infinite Objects by Observations Andreas Abel Department of Computer Science Ludwig-Maximilians-University Munich Mathematical Logic Seminar Ludwig-Maximilians-University Munich

More information

λ-calculus and types

λ-calculus and types λ-calculus and types Lecture notes Midland Graduate School / APPSEM Spring School 2004 Thorsten Altenkirch School of Computer Science and Information Technology, Nottingham University txa@cs.nott.ac.uk

More information

Higher Order Containers

Higher Order Containers Higher Order Containers Thorsten Altenkirch 1, Paul Levy 2, and Sam Staton 3 1 University of Nottingham 2 University of Birmingham 3 University of Cambridge Abstract. Containers are a semantic way to talk

More information

CSCI 490 problem set 6

CSCI 490 problem set 6 CSCI 490 problem set 6 Due Tuesday, March 1 Revision 1: compiled Tuesday 23 rd February, 2016 at 21:21 Rubric For full credit, your solutions should demonstrate a proficient understanding of the following

More information

arxiv: v1 [cs.lo] 23 Jan 2019

arxiv: v1 [cs.lo] 23 Jan 2019 THE SIZE-CHANGE PRINCIPLE FOR MIXED INDUCTIVE AND COINDUCTIVE TYPES PIERRE HYVERNAT arxiv:1901.07820v1 [cs.lo] 23 Jan 2019 Université Grenoble Alpes, Université Savoie Mont Blanc, CNRS, LAMA, 73000 Chambéry,

More information

NORMALISATION BY EVALUATION FOR TYPE THEORY, IN TYPE THEORY

NORMALISATION BY EVALUATION FOR TYPE THEORY, IN TYPE THEORY Logical Methods in Computer Science Vol. 134:1)2017, pp. 1 26 https://lmcs.episciences.org/ Submitted Dec. 09, 2016 Published Oct. 23, 2017 NORMALISATION BY EVALUATION FOR TYPE THEORY, IN TYPE THEORY THORSTEN

More information

Tutorial on Semantics Part I

Tutorial on Semantics Part I Tutorial on Semantics Part I Basic Concepts Prakash Panangaden 1 1 School of Computer Science McGill University on sabbatical leave at Department of Computer Science Oxford University Fields Institute,

More information

The syntactic guard condition of Coq

The syntactic guard condition of Coq The syntactic guard condition of Coq Bruno Barras February 2, 2010 Overview 1 Theory Basic criterion Extensions 2 Algorithm Efficiency 3 Discussion 4 Attic A short history of the syntactic guard criterion

More information

Indexed Containers. Thorsten Altenkirch Peter Morris University of Nottingham Abstract. 1 Introduction

Indexed Containers. Thorsten Altenkirch Peter Morris University of Nottingham Abstract. 1 Introduction Indexed Containers Thorsten Altenkirch Peter Morris University of Nottingham {txa,pwm}@cs.nott.ac.uk Abstract We show that the syntactically rich notion of inductive families can be reduced to a core type

More information

A New Look At Generalized Rewriting in Type Theory

A New Look At Generalized Rewriting in Type Theory A New Look At Generalized Rewriting in Type Theory Matthieu Sozeau Harvard University TYPES 09 May 13th 2009 Aussois, France Generalized Rewriting Equational reasoning x = y - x + 1 ==> y + 1 Logical reasoning

More information

Monadic Refinements for Relational Cost Analysis (Appendix)

Monadic Refinements for Relational Cost Analysis (Appendix) Monadic Refinements for Relational Cost Analysis (Appendix) Ivan Radiček Gilles Barthe Marco Gaboardi Deepak Garg Florian Zuleger Structure of the Appendix In the appendix we give material that was omitted

More information

Roy L. Crole. Operational Semantics Abstract Machines and Correctness. University of Leicester, UK

Roy L. Crole. Operational Semantics Abstract Machines and Correctness. University of Leicester, UK Midlands Graduate School, University of Birmingham, April 2008 1 Operational Semantics Abstract Machines and Correctness Roy L. Crole University of Leicester, UK Midlands Graduate School, University of

More information

Equivalence of Regular Expressions and FSMs

Equivalence of Regular Expressions and FSMs Equivalence of Regular Expressions and FSMs Greg Plaxton Theory in Programming Practice, Spring 2005 Department of Computer Science University of Texas at Austin Regular Language Recall that a language

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

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

Monads for Relations. Jeremy G. Siek University of Colorado at Boulder SPLS, June Jeremy Siek Monads for Relations 1 / 20 Monads for Relations Jeremy G. Siek University of Colorado at Boulder SPLS, June 2010 Jeremy Siek Monads for Relations 1 / 20 Natural (Big-Step) Semantics for CBV Lambda ρ e v Env Expr Value ρ x ρ x ρ

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

The Continuity of Monadic Stream Functions

The Continuity of Monadic Stream Functions 1 The Continuity of Monadic Stream Functions Venanzio Capretta and Jonathan Fowler School of Computer Science University of Nottingham, UK Email : {venanziocapretta,jonathanfowler}@nottinghamacuk Abstract

More information

Automated Reasoning Lecture 17: Inductive Proof (in Isabelle)

Automated Reasoning Lecture 17: Inductive Proof (in Isabelle) Automated Reasoning Lecture 17: Inductive Proof (in Isabelle) Jacques Fleuriot jdf@inf.ed.ac.uk Recap Previously: Unification and Rewriting This time: Proof by Induction (in Isabelle) Proof by Mathematical

More information

Foundations of Computation. Ana Bove

Foundations of Computation. Ana Bove Foundations of Computation Ana Bove Programming Logic (ProgLog) Group February 13th 2018 Outline of the talk: What we do in ProgLog Origines of computer science Courses in the area Warming-up Exercise

More information

Functional Big-step Semantics

Functional Big-step Semantics Functional Big-step Semantics FM talk, 11 Mar 2015 Magnus Myréen Books Big-step semantics are defined as inductively defined relation. Functions are better! me Context: CakeML verified compiler Old compiler:

More information

The Continuity of Monadic Stream Functions

The Continuity of Monadic Stream Functions 1 The Continuity of Monadic Stream Functions Venanzio Capretta and Jonathan Fowler School of Computer Science University of Nottingham, UK Email : {venanziocapretta,jonathanfowler}@nottinghamacuk Abstract

More information

Order Sorted Algebra. Japan Advanced Institute of Science and Technology. March 8, 2008

Order Sorted Algebra. Japan Advanced Institute of Science and Technology. March 8, 2008 Order Sorted Algebra Daniel Găină Japan Advanced Institute of Science and Technology March 8, 2008 Introduction There are many examples where all items of one sort are necessarily also items of some other

More information

Bisimulation and coinduction in higher-order languages

Bisimulation and coinduction in higher-order languages Bisimulation and coinduction in higher-order languages Davide Sangiorgi Focus Team, University of Bologna/INRIA ICE, Florence, June 2013 Bisimulation Behavioural equality One of the most important contributions

More information

Deterministic Finite Automaton (DFA)

Deterministic Finite Automaton (DFA) 1 Lecture Overview Deterministic Finite Automata (DFA) o accepting a string o defining a language Nondeterministic Finite Automata (NFA) o converting to DFA (subset construction) o constructed from a regular

More information

Towards a general framework for metareasoning on HOAS encodings

Towards a general framework for metareasoning on HOAS encodings Towards a general framework for metareasoning on HOAS encodings 1 Project TOSCA TASK HOAS LF Slide 1 Towards a general framework for metareasoning on HOAS encodings Anna Bucalo, Martin Hofmann, Furio Honsell,

More information

Simply Typed Lambda Calculus

Simply Typed Lambda Calculus Simply Typed Lambda Calculus Language (ver1) Lambda calculus with boolean values t ::= x variable x : T.t abstraction tt application true false boolean values if ttt conditional expression Values v ::=

More information

Weak ω-groupoids in Type Theory

Weak ω-groupoids in Type Theory Weak ω-groupoids in Type Theory Based on joint work with Ondrej Rypacek Thorsten Altenkirch Functional Programming Laboratory School of Computer Science University of Nottingham April 2, 2012 Thorsten

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

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

Notes from Yesterday s Discussion. Big Picture. CIS 500 Software Foundations Fall November 1. Some lessons.

Notes from Yesterday s  Discussion. Big Picture. CIS 500 Software Foundations Fall November 1. Some lessons. CIS 500 Software Foundations Fall 2006 Notes from Yesterday s Email Discussion November 1 Some lessons This is generally a crunch-time in the semester Slow down a little and give people a chance to catch

More information

Reasoning with Higher-Order Abstract Syntax and Contexts: A Comparison

Reasoning with Higher-Order Abstract Syntax and Contexts: A Comparison 1 Reasoning with Higher-Order Abstract Syntax and Contexts: A Comparison Amy Felty University of Ottawa July 13, 2010 Joint work with Brigitte Pientka, McGill University 2 Comparing Systems We focus on

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

Operationally-Based Theories of Program Equivalence

Operationally-Based Theories of Program Equivalence Operationally-Based Theories of Program Equivalence Andrew Pitts Contents 1 Introduction : : : : : : : : : : : : : : : : : : : : : : : : : : : : 241 2 Contextual Equivalence : : : : : : : : : : : : : :

More information

Bicubical Directed Type Theory

Bicubical Directed Type Theory Bicubical Directed Type Theory Matthew Weaver General Examination May 7th, 2018 Advised by Andrew Appel and Dan Licata Bicubical Directed Type Theory Bicubical directed type theory is a constructive model

More information

Parametric Polymorphism and Operational Improvement

Parametric Polymorphism and Operational Improvement Parametric Polymorphism and Operational Improvement JENNIFER HACKETT, University of Nottingham, UK GRAHAM HUTTON, University of Nottingham, UK Parametricity, in both operational and denotational forms,

More information

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw Applied Logic Lecture 1 - Propositional logic Marcin Szczuka Institute of Informatics, The University of Warsaw Monographic lecture, Spring semester 2017/2018 Marcin Szczuka (MIMUW) Applied Logic 2018

More information

Technical Report No Proofs Accompanying Fast and Loose Reasoning is Morally Correct NILS ANDERS DANIELSSON

Technical Report No Proofs Accompanying Fast and Loose Reasoning is Morally Correct NILS ANDERS DANIELSSON Technical Report No. 07-15 Proofs Accompanying Fast and Loose Reasoning is Morally Correct NILS ANDERS DANIELSSON Department of Computer Science and Engineering Division of Computing Science CHALMERS UNIVERSITY

More information

Semantic Labelling for Proving Termination of Combinatory Reduction Systems. Makoto Hamana

Semantic Labelling for Proving Termination of Combinatory Reduction Systems. Makoto Hamana Semantic Labelling for Proving Termination of Combinatory Reduction Systems Makoto Hamana Department of Computer Science, Gunma University, Japan WFLP 09 June, 2009. 1 2 Intro: Termination Proof by RPO

More information

Towards Correctness of Program Transformations Through Unification and Critical Pair Computation

Towards Correctness of Program Transformations Through Unification and Critical Pair Computation Towards Correctness of Program Transformations Through Unification and Critical Pair Computation Conrad Rau and Manfred Schmidt-Schauß Institut für Informatik Johann Wolfgang Goethe-Universität Postfach

More information

Specification of Core Agda Subtitle

Specification of Core Agda Subtitle 1 Specification of Core Agda Subtitle THE AGDA SPECIFICATION TEAM, Institution1 FIRST2 LAST2, Institution2a and Institution2b This document specifies the abstract syntax, evaluation rules, and typing rules

More information

On Coinduction and Quantum Lambda Calculi

On Coinduction and Quantum Lambda Calculi On Coinduction and Quantum Lambda Calculi Yuxin Deng East China Normal University (Joint work with Yuan Feng and Ugo Dal Lago) To appear at CONCUR 15 1 Outline Motivation A quantum λ-calculus Coinductive

More information

Lecture 4: Effect Handlers

Lecture 4: Effect Handlers Gordon Laboratory for the Foundations of Computer Science, School of Informatics, University of Edinburgh Beihang University October, 2015 Outline Effect Deconstructors 1 Effect Deconstructors 2 Outline

More information

Wolfgang Jeltsch. Seminar talk at the Institute of Cybernetics Tallinn, Estonia

Wolfgang Jeltsch. Seminar talk at the Institute of Cybernetics Tallinn, Estonia in in Brandenburgische Technische Universität Cottbus Cottbus, Germany Seminar talk at the Institute of Cybernetics Tallinn, Estonia February 10, 2011 in in in trueness of a proposition depends on time

More information

Theory of Computer Science. Theory of Computer Science. D7.1 Introduction. D7.2 Turing Machines as Words. D7.3 Special Halting Problem

Theory of Computer Science. Theory of Computer Science. D7.1 Introduction. D7.2 Turing Machines as Words. D7.3 Special Halting Problem Theory of Computer Science May 2, 2018 D7. Halting Problem and Reductions Theory of Computer Science D7. Halting Problem and Reductions Gabriele Röger University of Basel May 2, 2018 D7.1 Introduction

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

Formalising the Completeness Theorem of Classical Propositional Logic in Agda (Proof Pearl)

Formalising the Completeness Theorem of Classical Propositional Logic in Agda (Proof Pearl) Formalising the Completeness Theorem of Classical Propositional Logic in Agda (Proof Pearl) Leran Cai, Ambrus Kaposi, and Thorsten Altenkirch University of Nottingham {psylc5, psxak8, psztxa}@nottingham.ac.uk

More information

ON FIRST-ORDER CONS-FREE TERM REWRITING AND PTIME

ON FIRST-ORDER CONS-FREE TERM REWRITING AND PTIME ON FIRST-ORDER CONS-FREE TERM REWRITING AND PTIME CYNTHIA KOP Department of Computer Science, Copenhagen University e-mail address: kop@diku.dk Abstract. In this paper, we prove that (first-order) cons-free

More information

Denoting computation

Denoting computation A jog from Scott Domains to Hypercoherence Spaces 13/12/2006 Outline Motivation 1 Motivation 2 What Does Denotational Semantic Mean? Trivial examples Basic things to know 3 Scott domains di-domains 4 Event

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

Pola: a language for PTIME Programming. Mike Burrell, Robin Cockett, Brian Redmond LCC 2009

Pola: a language for PTIME Programming. Mike Burrell, Robin Cockett, Brian Redmond LCC 2009 Pola: a language for PTIME Programming Mike Burrell, Robin Cockett, Brian Redmond LCC 2009 Pola overview Allows for general inductive data types And coinductive as well! Breaks variables into two separate

More information

Formal SOS-Proofs for the Lambda-Calculus

Formal SOS-Proofs for the Lambda-Calculus LSFA 8 Formal SOS-Proofs for the Lambda-Calculus Christian Urban 1 and Julien Narboux TU Munich, Germany University of Strasbourg, France Abstract We describe in this paper formalisations for the properties

More information

Modeling and Analysis of Communicating Systems

Modeling and Analysis of Communicating Systems Modeling and Analysis of Communicating Systems Lecture 5: Sequential Processes Jeroen Keiren and Mohammad Mousavi j.j.a.keiren@vu.nl and m.r.mousavi@hh.se Halmstad University March 2015 Outline Motivation

More information

Type Soundness for Path Polymorphism

Type Soundness for Path Polymorphism Type Soundness for Path Polymorphism Andrés Ezequiel Viso 1,2 joint work with Eduardo Bonelli 1,3 and Mauricio Ayala-Rincón 4 1 CONICET, Argentina 2 Departamento de Computación, FCEyN, UBA, Argentina 3

More information

Constructive Formalization of Regular Languages

Constructive Formalization of Regular Languages Constructive Formalization of Regular Languages Jan-Oliver Kaiser Advisors: Christian Doczkal, Gert Smolka Supervisor: Gert Smolka UdS November 7, 2012 Jan-Oliver Kaiser (UdS) Constr. Formalization of

More information

Introduction to Turing Machines. Reading: Chapters 8 & 9

Introduction to Turing Machines. Reading: Chapters 8 & 9 Introduction to Turing Machines Reading: Chapters 8 & 9 1 Turing Machines (TM) Generalize the class of CFLs: Recursively Enumerable Languages Recursive Languages Context-Free Languages Regular Languages

More information

RANK HIERARCHIES FOR GENERALIZED QUANTIFIERS

RANK HIERARCHIES FOR GENERALIZED QUANTIFIERS RANK HIERARCHIES FOR GENERALIZED QUANTIFIERS H. JEROME KEISLER AND WAFIK BOULOS LOTFALLAH Abstract. We show that for each n and m, there is an existential first order sentence which is NOT logically equivalent

More information

HORSes: format, termination and confluence

HORSes: format, termination and confluence HORSes: format, termination and confluence Jean-Pierre Jouannaud INRIA-LIAMA and singhua Software Chair Joint on-going work with Jianqi Li School of Software, singhua University Project CoqLF NList Cross-discipline

More information

A note on coinduction and weak bisimilarity for while programs

A note on coinduction and weak bisimilarity for while programs Centrum voor Wiskunde en Informatica A note on coinduction and weak bisimilarity for while programs J.J.M.M. Rutten Software Engineering (SEN) SEN-R9826 October 31, 1998 Report SEN-R9826 ISSN 1386-369X

More information

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P.

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P. First-Order Logic Syntax The alphabet of a first-order language is organised into the following categories. Logical connectives:,,,,, and. Auxiliary symbols:.,,, ( and ). Variables: we assume a countable

More information