Total (Co)Programming with Guarded Recursion

Size: px
Start display at page:

Download "Total (Co)Programming with Guarded Recursion"

Transcription

1 Total (Co)Programming with Guarded Recursion Andrea Vezzosi Department of Computer Science and Engineering Chalmers University of Technology, Gothenburg, Sweden Types for Proofs and Programs Annual Meeting 2015 Tallinn, Estonia 18 May 2015 Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden [1ex] 1 / 26 )

2 Guarded Recursion Guarded coinductive types Coinductive types Guarded fixed point operator as only source of recursion Recursive types as fixed points on the universe What about Induction? Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden [1ex] 2 / 26 )

3 Main Combinators A, later A, modality as an applicative functor: next : A A : (A B) A B Guarded fixpoint combinator: fix : ( A A) A fix f = f (next (fix f )) Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden [1ex] 3 / 26 )

4 Corecursion Example gstr A = A gstr A ghead : gstr A A ghead = fst gtail : gstr A gstr A gtail = snd map : (A B) gstr A gstr B map f = fix (λ map. λ xs. ghead xs, map gtail xs) Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden [1ex] 4 / 26 )

5 Recursion Example? glist A = + A glist A all : (A Bool) glist A Bool all p = fix (λ (all : (glist A Bool)). λ xs. case xs of [ ] True (x :: xs) p x? We need a way to call all with xs as argument and obtain Bool. Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden [1ex] 5 / 26 )

6 Recursion Example, take 2, with diamonds glist A = + A glist A extract : Bool Bool : (A B) A B all : (A Bool) glist A Bool all p = fix (λ (all : (glist A Bool)). λ xs. case xs of [ ] True (x :: xs) p x extract (all xs) Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden [1ex] 6 / 26 )

7 Problem: we lose next For A we cannot have next, e.g.: next : ( ) ( ) means if there is time left now, there will be time left later too Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden [1ex] 7 / 26 )

8 Semantics The standard model for Guarded Recursion is the topos of trees i.e. functors ω op Set A : N Set A (n m) : A m A n ( A) 0 = ( A) (suc n) = A n next 0 =! next suc n = A (n suc n) next uses the functoriality of A Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden [1ex] 8 / 26 )

9 Alternative Semantics: Relators A : N Set A (n m) : A m A n Set A (n n) = = A n Any functor A : ω op Set is also a relator: A (n m) a n a m = a n = A n A (n m) a m Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden [1ex] 9 / 26 )

10 ala Sized Types, : (Time Set) (Time Set) A i = j < i. A j A i = j < i. A j : i. ( j < i. A j B j ) ( j < i. A j ) j < i. B j f (j, a) = (j, f j a) Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 10 [1ex] / 26 )

11 ala Sized Types (contd.) fix : ( i. ( j < i. A j ) A i) i. A i unfold : ( i. S i + (A j < i. S j )) i. S i List A unfold f = fix λ i unfold s. case f i s of inl [ ] inr (a, (j, s )) a :: unfold j s Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 11 [1ex] / 26 )

12 Recursive Types through fixed points ˆ : U U gstr A = fix λ X. A ˆ X gstr A = fix λ i (X : j < i. U ). A j < i. X j Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 12 [1ex] / 26 )

13 Coinductive Types with gstr κ A = A κ gstr κ A Str A = κ. gstr κ A force : ( κ. κ A) = ( κ. A) tail : Str A Str A tail xs = force (λ κ. gtail (xs κ)) Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 13 [1ex] / 26 )

14 Coinductive Types with j < i gstr A i = A j < i. gstr A j Str A = i. gstr A i force : ( i. j < i. A j ) i. A i force f i = f (suc i) i guard : ( i. A i) i. j < i. A j guard f i j = f j guard (force f ) i j = f (suc j ) j Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 14 [1ex] / 26 )

15 Inductive Types with j < i gnat i = + j < i. A j Nat = i. gnat i force : ( i. j < i. A j ) i. A i force (i, j, a) = (j, a) guard : ( i. A i) i. j < i. A j guard (j, a) = (suc j, j, a) guard (force (i, j, a)) = suc j, j, a Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 15 [1ex] / 26 )

16 i as a weak existential gnat i = + j < i. A j Nat = i. gnat i Want all zeros to be equal: (i, inl tt) = (j, inl tt) We cannot project times out: fst : ( i. A i) Time fst (i, a) = i i = fst (i, inl tt) = fst (j, inl tt) = j Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 16 [1ex] / 26 )

17 i as a weak existential P : ( i. A i) U f : ( i. (a : A i) P (i, a)) uncurry f : (x : i. A i) P x where U is a type theoretic universe such that Time / U Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 17 [1ex] / 26 )

18 Summary Ordered type Time : Type which supports well-founded induction A universe U : Type such that Time / U Parametric time quantifiers i. A i and i. A i Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 18 [1ex] / 26 )

19 Reflexive Graph Model of Martin Löf Type Theory Γ O : Set Γ R : Γ O Γ O Set Γ refl : (γ O : Γ O ) Γ R γ O γ O Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 19 [1ex] / 26 )

20 Time Time O = N Time R i j = Any two time values are related. Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 20 [1ex] / 26 )

21 Types depending on Time i : Time A : Type A O : N Set A R : (n m : N) A n A m Set A refl : (n : N) (a : A n) A R n n a a A R n n =? = AO Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 21 [1ex] / 26 )

22 Universe of Small Discrete Reflexive Graphs U O = {(A O, A R ) A O small set, A R = eqao } U R A B = {Rel Rel small proof irrelevant relation between A O and B O } U refl (A O, A R ) = A R Γ A : U Γ El A : Type (El A) R (Γ refl γ) = = ElAO Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 22 [1ex] / 26 )

23 Time dependency for discrete reflexive graphs Given A such that i / fv A i : Time t : El A t O : N (El A) O t R : (n m : N) t O n = ElAO t O m i. j < i. El (A j ) = i. El (A i) Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 23 [1ex] / 26 )

24 Discretization Given any small reflxive graph A we can form its free discrete reflexive graph A : U (El ( A)) O = A O / symmetric transitive closure of A R (El ( A)) R = =( A)O Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 24 [1ex] / 26 )

25 Discretization, Universal property (El ( A) El B) = (A El B) P : El ( A) U f : (a : A) P ( A)) El (P x) elim f : (x : El ( a) i. A i = (Σ (i : Time). A i) Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 25 [1ex] / 26 )

26 Future work How to internalize the parametricity properties of i and i? Very interested in the talks about parametricity in the following days! Cohesive Homotopy Type Theory has something like discretization How to preserve strong normalization? fix f i = f i (fix f ) = f i (λ j. fix f j ) = f i (λ j. f j (fix f )) =... Andrea Vezzosi ( Department of Computer Science Total (Co)Programming and Engineering Chalmers with Guarded University Recursion of Technology, Gothenburg, TYPES 2015 Sweden 26 [1ex] / 26 )

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

Free Groups. Joachim Breitner. April 17, 2016

Free Groups. Joachim Breitner. April 17, 2016 Free Groups Joachim Breitner April 17, 2016 Abstract Free Groups are, in a sense, the most generic kind of group. They are defined over a set of generators with no additional relations in between them.

More information

CMSC 631 Program Analysis and Understanding Fall Type Systems

CMSC 631 Program Analysis and Understanding Fall Type Systems Program Analysis and Understanding Fall 2017 Type Systems Type Systems A type system is a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according

More information

On the Syntax and Semantics of Quantitative Typing

On the Syntax and Semantics of Quantitative Typing On the Syntax and Semantics of Quantitative Typing Andreas Abel 1 1 Department of Computer Science and Engineering Chalmers and Gothenburg University, Sweden Workshop on Mixed Inductive-Coinductive Reasoning

More information

Internal Universes in Models of Homotopy Type Theory. Daniel R. Licata Ian Orton Andrew M. Pitts Bas Spitters

Internal Universes in Models of Homotopy Type Theory. Daniel R. Licata Ian Orton Andrew M. Pitts Bas Spitters Internal Universes in Models of Homotopy Type Theory Daniel R. Licata Ian Orton Andrew M. Pitts Bas Spitters HoTT Voevodsky: Simplicial model of univalent type theory Coquand: Cubical model of univalent

More information

Syntax and semantics of a GPU kernel programming language

Syntax and semantics of a GPU kernel programming language Syntax and semantics of a GPU kernel programming language John Wickerson April 17, 2016 Abstract This document accompanies the article The Design and Implementation of a Verification Technique for GPU

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

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

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

Type Theory and Constructive Mathematics. Type Theory and Constructive Mathematics Thierry Coquand. University of Gothenburg

Type Theory and Constructive Mathematics. Type Theory and Constructive Mathematics Thierry Coquand. University of Gothenburg Type Theory and Constructive Mathematics Type Theory and Constructive Mathematics Thierry Coquand University of Gothenburg Content An introduction to Voevodsky s Univalent Foundations of Mathematics The

More information

Homotopy Type Theory Lecture Notes

Homotopy Type Theory Lecture Notes 15-819 Homotopy Type Theory Lecture Notes Nathan Fulton October 9 and 11, 2013 1 Contents These notes summarize and extend two lectures from Bob Harper s Homotopy Type Theory course. The cumulative hierarchy

More information

Monads and More: Part 4

Monads and More: Part 4 Monads and More: Part 4 Tarmo Uustalu, Tallinn Nottingham, 14-18 May 2007 Coeffectful computation and comonads For coeffectful notions of computation, we have a comonad (D, ε, δ) on the base category C

More information

Type Systems as a Foundation for Reliable Computing

Type Systems as a Foundation for Reliable Computing Type Systems as a Foundation for Reliable Computing Robert Harper Carnegie Mellon University Summer School on Reliable Computing University of Oregon July, 2005 References These lectures are based on the

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

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

Code Generation for a Simple First-Order Prover

Code Generation for a Simple First-Order Prover Code Generation for a Simple First-Order Prover Jørgen Villadsen, Anders Schlichtkrull, and Andreas Halkjær From DTU Compute, Technical University of Denmark, 2800 Kongens Lyngby, Denmark Abstract. We

More information

Primitive (Co)Recursion and Course-of-Value (Co)Iteration, Categorically

Primitive (Co)Recursion and Course-of-Value (Co)Iteration, Categorically INORMATICA, 1999 Vol. 10, No. 1, 1 0 Primitive (Co)Recursion and Course-of-Value (Co)Iteration, Categorically Tarmo Uustalu Dept. of Teleinformatics, Royal Inst. of Technology, Electrum 0, SE-1 0 Kista,

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

A type theory for productive coprogramming via guarded recursion

A type theory for productive coprogramming via guarded recursion A type theory for productive coprogramming via guarded recursion Rasmus Ejlers Møgelberg IT University of Copenhagen Denmark mogel@itu.dk Abstract To ensure consistency and decidability of type checking,

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

Introduction to type theory and homotopy theory

Introduction to type theory and homotopy theory Introduction to type theory and homotopy theory Michael Shulman January 24, 2012 1 / 47 Homotopy theory Homotopy type theory types have a homotopy theory Intensional type theory New perspectives on extensional

More information

1 / A bird s-eye view of type theory. 2 A bird s-eye view of homotopy theory. 3 Path spaces and identity types. 4 Homotopy type theory

1 / A bird s-eye view of type theory. 2 A bird s-eye view of homotopy theory. 3 Path spaces and identity types. 4 Homotopy type theory Introduction to type theory and homotopy theory Michael Shulman January 24, 2012 Homotopy theory Homotopy type theory types have a homotopy theory New perspectives on extensional vs. intensional Intensional

More information

Monads and More: Part 4

Monads and More: Part 4 Monads and More: Part 4 Tarmo Uustalu, Institute of Cybernetics, Tallinn University of Nottingham, 14 18 May 2007 University of Udine, 2 6 July 2007 Comonads Comonads are the dual of monads. A comonad

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

Isomorphism is equality

Isomorphism is equality Isomorphism is equality Thierry Coquand, Nils Anders Danielsson University of Gothenburg and Chalmers University of Technology Abstract The setting of this work is dependent type theory extended with the

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

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

Diffeological Spaces and Denotational Semantics for Differential Programming

Diffeological Spaces and Denotational Semantics for Differential Programming Diffeological Spaces and Denotational Semantics for Differential Programming Ohad Kammar, Sam Staton, and Matthijs Vákár Domains 2018 Oxford 8 July 2018 What is differential programming? PL in which all

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

The equivalence axiom and univalent models of type theory.

The equivalence axiom and univalent models of type theory. The equivalence axiom and univalent models of type theory. (Talk at CMU on February 4, 2010) By Vladimir Voevodsky Abstract I will show how to define, in any type system with dependent sums, products and

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

Quotient inductive-inductive definitions

Quotient inductive-inductive definitions Quotient inductive-inductive definitions Gabe Dijkstra Thesis submitted to the University of Nottingham for the degree of Doctor of Philosophy April 2017 ii Abstract In this thesis we present a theory

More information

Elaborating dependent (co)pattern matching

Elaborating dependent (co)pattern matching 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 Elaborating dependent (co)pattern matching JESPER COCKX and ANDREAS

More information

Conceptual Connections of Circularity and Category Theory

Conceptual Connections of Circularity and Category Theory 1/64 Conceptual Connections of Circularity and Category Theory Larry Moss Indiana University, Bloomington ESSLLI 2012, Opole 2/64 The conceptual comparison chart Filling out the details is my goal for

More information

Diffeological Spaces and Denotational Semantics for Differential Programming

Diffeological Spaces and Denotational Semantics for Differential Programming Kammar, Staton, andvákár Diffeological Spaces and Denotational Semantics for Differential Programming Ohad Kammar, Sam Staton, and Matthijs Vákár MFPS 2018 Halifax 8 June 2018 What is differential programming?

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

Univalence from a Computer Science Point-of-View. Dan Licata Wesleyan University

Univalence from a Computer Science Point-of-View. Dan Licata Wesleyan University Univalence from a Computer Science Point-of-View Dan Licata Wesleyan University 1 Martin-Löf type theory [70s-80s] 2 Proofs are programs 3 cubicaltt [Cohen,Coquand, Huber,Mörtberg] 4 cubicaltt [Cohen,Coquand,

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

From parametric polymorphism to models of polymorphic FPC

From parametric polymorphism to models of polymorphic FPC Under consideration for publication in Math. Struct. in Comp. Science From parametric polymorphism to models of polymorphic FPC Rasmus Ejlers Møgelberg IT University of Copenhagen Rued Langgaards Vej 7

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

Examples for program extraction in Higher-Order Logic

Examples for program extraction in Higher-Order Logic Examples for program extraction in Higher-Order Logic Stefan Berghofer October 10, 2011 Contents 1 Auxiliary lemmas used in program extraction examples 1 2 Quotient and remainder 2 3 Greatest common divisor

More information

Basic Propositional Logic. Inductive Theory of the Natural Numbers. Conjunction. Equivalence. Negation and Inequivalence. Implication.

Basic Propositional Logic. Inductive Theory of the Natural Numbers. Conjunction. Equivalence. Negation and Inequivalence. Implication. McMaster University COMPSCI&SFWRENG 2DM3 Dept. of Computing and Software Theorem List 4 Dr. W. Kahl 2017-12-09 The names listed here are precisely the names used in the preloaded material you are already

More information

Imperative Insertion Sort

Imperative Insertion Sort Imperative Insertion Sort Christian Sternagel April 17, 2016 Contents 1 Looping Constructs for Imperative HOL 1 1.1 While Loops............................ 1 1.2 For Loops.............................

More information

Cubical Type Theory. Dan Licata Wesleyan University Guillaume Brunerie Université de Nice Sophia Antipolis

Cubical Type Theory. Dan Licata Wesleyan University Guillaume Brunerie Université de Nice Sophia Antipolis Cubical Type Theory Dan Licata Wesleyan University Guillaume Brunerie Université de Nice Sophia Antipolis Higher inductive types loop base 2 Higher inductive types loop base base : Circle loop : base =

More information

redtt cartesian cubical proof assistant Carlo Angiuli Evan Cavallo Favonia Robert Harper Anders Mörtberg Jon Sterling

redtt cartesian cubical proof assistant Carlo Angiuli Evan Cavallo Favonia Robert Harper Anders Mörtberg Jon Sterling redtt cartesian cubical proof assistant Carlo Angiuli Evan Cavallo Favonia Robert Harper Anders Mörtberg Jon Sterling homotopy type theory dependent type-theoretic language for higher dimensional mathematics.

More information

Higher toposes Internal logic Modalities Sub- -toposes Formalization. Modalities in HoTT. Egbert Rijke, Mike Shulman, Bas Spitters 1706.

Higher toposes Internal logic Modalities Sub- -toposes Formalization. Modalities in HoTT. Egbert Rijke, Mike Shulman, Bas Spitters 1706. Modalities in HoTT Egbert Rijke, Mike Shulman, Bas Spitters 1706.07526 Outline 1 Higher toposes 2 Internal logic 3 Modalities 4 Sub- -toposes 5 Formalization Two generalizations of Sets Groupoids: To keep

More information

Imperative Insertion Sort

Imperative Insertion Sort Imperative Insertion Sort Christian Sternagel October 11, 2017 Contents 1 Looping Constructs for Imperative HOL 1 1.1 While Loops............................ 1 1.2 For Loops.............................

More information

Topology for functional programming

Topology for functional programming Topology for functional programming Martín Escardó University of Birmingham, England EWSCS, Palmse, Estonia, 26 Feb 2 Mar 2012 Computational fact Function types A B with A infinite don t have decidable

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

Setoids and universes

Setoids and universes U.U.D.M. Report 2008:42 Setoids and universes K. O. Wilander Department of Mathematics Uppsala University SETOIDS AND UNIVERSES K.O. WILANDER Abstract. Setoids commonly take the place of sets when formalising

More information

Representations of Boolean Functions in Constructive Type Theory

Representations of Boolean Functions in Constructive Type Theory Saarland University Faculty of Natural Sciences and Technology I Department of Computer Science Bachelor s Program in Computer Science Bachelor s Thesis Representations of Boolean Functions in Constructive

More information

Generic Accumulations for Program Calculation

Generic Accumulations for Program Calculation Generic Accumulations for Program Calculation Mauro Jaskelioff Facultad de Cs. Exactas, Ingeniería y Agrimensura Universidad Nacional de Rosario Rosario - Argentina mauro@fceia.unr.edu.ar December 2004

More information

CMSC 336: Type Systems for Programming Languages Lecture 10: Polymorphism Acar & Ahmed 19 February 2008

CMSC 336: Type Systems for Programming Languages Lecture 10: Polymorphism Acar & Ahmed 19 February 2008 CMSC 336: Type Systems for Programming Languages Lecture 10: Polymorphism Acar & Ahmed 19 February 2008 Contents 1 Polymorphism 1 2 Polymorphic λ-calculus: Syntax 1 3 Static Semantics 2 4 Dynamic Semantics

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

The Curry Howard Correspondence between Temporal Logic and Functional Reactive Programming

The Curry Howard Correspondence between Temporal Logic and Functional Reactive Programming The Curry Howard Correspondence between Temporal Logic and Functional Reactive Programming Wolfgang Jeltsch Brandenburgische Technische Universität Cottbus Cottbus, Germany Teooriapäevad Nelijärvel Nelijärve,

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

On Martin s Conjecture

On Martin s Conjecture On Martin s Conjecture Theodore A. Slaman University of California, Berkeley April 2001 1 The Hierarchy of Definability We are all familiar with the hierarchies of definability which appear in recursion

More information

Lattices and Orders in Isabelle/HOL

Lattices and Orders in Isabelle/HOL Lattices and Orders in Isabelle/HOL Markus Wenzel TU München October 8, 2017 Abstract We consider abstract structures of orders and lattices. Many fundamental concepts of lattice theory are developed,

More information

Formalisation in Constructive Type Theory of Barendregt s Variable Convention for Generic Structures with Binders

Formalisation in Constructive Type Theory of Barendregt s Variable Convention for Generic Structures with Binders Formalisation in Constructive Type Theory of Barendregt s Variable Convention for Generic Structures with Binders Ernesto Copello 1 Nora Szasz 2 Álvaro Tasistro 2 1 Department of Computer Science The University

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

HOL: Well-founded and Primitive Recursion

HOL: Well-founded and Primitive Recursion Dipl.-Inf. Achim D. Brucker Dr. Burkhart Wolff Computer-supported Modeling and Reasoning http://www.infsec.ethz.ch/ education/permanent/csmr/ (rev. 16814) Submission date: HOL: Well-founded and Primitive

More information

First Order Predicate Logic (FOL) Formulas

First Order Predicate Logic (FOL) Formulas 1 First Order Predicate Logic (FOL) Formulas Let Σ = (S, Ω) be a signature. P L(Σ) is the smallest set with (i) t = u P L(Σ), (ii) (iii) (iv) if X set of variables for Σ, s S, t, u T Σ(X),s (ϕ 1 ϕ 2 )

More information

Let s see how things unfold: reconciling the infinite with the intensional

Let s see how things unfold: reconciling the infinite with the intensional Let s see how things unfold: reconciling the infinite with the intensional (extended abstract) Conor McBride University of Strathclyde 1 Introduction Coinductive types model infinite structures unfolded

More information

2.7.1 Foundations of Proof Systems

2.7.1 Foundations of Proof Systems 2.7.1 Foundations of Proof Systems Exam 2017-2018 1 Warming up... Question 1 Give a proof in natural deduction of the following proposition : ( f = (g = h)) = (( f = g) = ( f = h)). Solution. f (g h);

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

Kleene realizability and negative translations

Kleene realizability and negative translations Q E I U G I C Kleene realizability and negative translations Alexandre Miquel O P. D E. L Ō A U D E L A R April 21th, IMERL Plan 1 Kleene realizability 2 Gödel-Gentzen negative translation 3 Lafont-Reus-Streicher

More information

Univalent Categories. A formalization of category theory in Cubical Agda. Frederik Hanghøj Iversen. Master s thesis in Computer Science

Univalent Categories. A formalization of category theory in Cubical Agda. Frederik Hanghøj Iversen. Master s thesis in Computer Science Univalent Categories A formalization of category theory in Cubical Agda Frederik Hanghøj Iversen Master s thesis in Computer Science Master s thesis 2018 Univalent Categories A formalization of category

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

MFPS LICS Special Session Honouring Dana Scott. Symmetric Scott. Andrew Pitts. Computer Laboratory MFPS/LICS /14

MFPS LICS Special Session Honouring Dana Scott. Symmetric Scott. Andrew Pitts. Computer Laboratory MFPS/LICS /14 MFPS/LICS 2013 1/14 MFPS LICS Special Session Honouring Dana Scott Symmetric Scott Andrew Pitts Computer Laboratory 80 years of Dana Scott MFPS/LICS 2013 2/14 automata theory set theory sheaves & logic

More information

Formalized Limits and Colimits of Setoids

Formalized Limits and Colimits of Setoids ISSN: 1401-5617 Formalized Limits and Colimits of Setoids Jesper Carlström Research Reports in Mathematics Number 9, 2003 Department of Mathematics Stockholm University Electronic versions of this document

More information

Logical Preliminaries

Logical Preliminaries Logical Preliminaries Johannes C. Flieger Scheme UK March 2003 Abstract Survey of intuitionistic and classical propositional logic; introduction to the computational interpretation of intuitionistic logic

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

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

Well Founded Relations and Recursion

Well Founded Relations and Recursion Well Founded Relations and Recursion Roger Bishop Jones Abstract Fixed points, well founded relations and a recursion theorem. http://www.rbjones.com/rbjpub/pp/doc/t005.pdf Created 2004/07/15 Last Modified

More information

Lambda calculus. (Advanced Functional Programming) Jeremy Yallop. January Computer Laboratory University of Cambridge 1/ 29

Lambda calculus. (Advanced Functional Programming) Jeremy Yallop. January Computer Laboratory University of Cambridge 1/ 29 1/ 29 Lambda calculus (Advanced Functional Programming) Jeremy Yallop Computer Laboratory University of Cambridge January 2015 Course outline 2/ 29 3/ 29 Books OCaml from the very beginning John Whitington

More information

Witnessing (Co)datatypes

Witnessing (Co)datatypes Witnessing (Co)datatypes Jasmin Christian Blanchette 1,2, Andrei Popescu 3, and Dmitriy Traytel 4 1 Inria Nancy & LORIA, Villers-lès-Nancy, France 2 Max-Planck-Institut für Informatik, Saarbrücken, Germany

More information

The Semantic Structure of Quasi-Borel Spaces

The Semantic Structure of Quasi-Borel Spaces H O T F E E U D N I I N V E B R U S R I T Y H G Heunen, Kammar, Moss, Ścibior, Staton, Vákár, and Yang Chris Heunen, Ohad Kammar, Sean K. Moss, Adam Ścibior, Sam Staton, Matthijs Vákár, and Hongseok Yang

More information

arxiv: v1 [cs.lo] 23 Jan 2018

arxiv: v1 [cs.lo] 23 Jan 2018 Internal Universes in Models of Homotopy Type Theory Daniel R. Licata, Ian Orton, Andrew M. Pitts and Bas Spitters Abstract arxiv:1801.07664v1 [cs.lo] 23 Jan 2018 We show that universes of fibrations in

More information

Equality and dependent type theory. CIRM, May 31

Equality and dependent type theory. CIRM, May 31 CIRM, May 31 The Axiom of Univalence, a type-theoretic view point In type theory, we reduce proof-checking to type-checking Hence we want type-checking to be decidable This holds as soon as we have the

More information

Termination and Productivity Checking with Continuous Types

Termination and Productivity Checking with Continuous Types Termination and Productivity Checking with Continuous Types Andreas Abel Department of Computer Science, University of Munich Oettingenstr. 67, 80538 München, Germany abel@informatik.uni-muenchen.de Abstract.

More information

A categorical structure of realizers for the Minimalist Foundation

A categorical structure of realizers for the Minimalist Foundation A categorical structure of realizers for the Minimalist Foundation S.Maschio (joint work with M.E.Maietti) Department of Mathematics University of Padua TACL 2015 Ischia The Minimalist Foundation Many

More information

1. The Method of Coalgebra

1. The Method of Coalgebra 1. The Method of Coalgebra Jan Rutten CWI Amsterdam & Radboud University Nijmegen IMS, Singapore - 15 September 2016 Overview of Lecture one 1. Category theory (where coalgebra comes from) 2. Algebras

More information

Between proof theory and model theory Three traditions in logic: Syntactic (formal deduction)

Between proof theory and model theory Three traditions in logic: Syntactic (formal deduction) Overview Between proof theory and model theory Three traditions in logic: Syntactic (formal deduction) Jeremy Avigad Department of Philosophy Carnegie Mellon University avigad@cmu.edu http://andrew.cmu.edu/

More information

The Mother of All Paradoxes

The Mother of All Paradoxes The Mother of All Paradoxes Volker Halbach Truth and Intensionality Amsterdam 3rd December 2016 A theory of expressions The symbols of L are: 1. infinitely many variable symbols v 0, v 1, v 2, v 3,...

More information

Foundations of Programming Languages. Paul Downen

Foundations of Programming Languages. Paul Downen Foundations of Programming Languages Paul Downen July 3 8, 2018 2 Contents 1 Static and Dynamic Semantics of a Little Language 7 1.1 Syntax................................. 7 1.2 Static Scope..............................

More information

Proof Methods for Corecursive Programs. 1. Introduction. Jeremy Gibbons. Graham Hutton

Proof Methods for Corecursive Programs. 1. Introduction. Jeremy Gibbons. Graham Hutton Fundamenta Informaticae XX (2005) 1 14 1 IOS Press Proof Methods for Corecursive Programs Jeremy Gibbons Oxford University Computing Laboratory, UK Graham Hutton School of Computer Science and IT, University

More information

1 Language, Reduction Relation, and Types

1 Language, Reduction Relation, and Types ADsafety: Type-Based Verification of JavaScript Sandboxing, auxiliary proofs. 1 Language, Reduction Relation, and Types s := constant strings n := numbers a := v err v := s n null undefined func (x:t )

More information

A Model of Guarded Recursion via Generalised Equilogical Spaces

A Model of Guarded Recursion via Generalised Equilogical Spaces A Model of Guarded Recursion via Generalised Equilogical Spaces Aleš Bizjak, Lars Birkedal Department of Computer Science Aarhus University Abstract We present a new model, called GuardedEqu, of guarded

More information

Discrete Mathematics Review

Discrete Mathematics Review CS 1813 Discrete Mathematics Discrete Mathematics Review or Yes, the Final Will Be Comprehensive 1 Truth Tables for Logical Operators P Q P Q False False False P Q False P Q False P Q True P Q True P True

More information

Minimal logic for computable functionals

Minimal logic for computable functionals Minimal logic for computable functionals Helmut Schwichtenberg Mathematisches Institut der Universität München Contents 1. Partial continuous functionals 2. Total and structure-total functionals 3. Terms;

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

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

The L Machines are very high-level, in two senses:

The L Machines are very high-level, in two senses: What is a Computer? State of the machine. CMPSCI 630: Programming Languages An Abstract Machine for Control Spring 2009 (with thanks to Robert Harper) Internal registers, memory, etc. Initial and final

More information

Dependent type theory

Dependent type theory Dependent type theory Γ, ::= () Γ, x : A Contexts t, u, A, B ::= x λx. t t u (x : A) B Π-types (t, u) t.1 t.2 (x : A) B Σ-types We write A B for the non-dependent product type and A B for the non-dependent

More information

Structural Foundations for Abstract Mathematics

Structural Foundations for Abstract Mathematics May 5, 2013 What no foundation can give us: Certainty What foundations need not give us: Ontological reduction What set theory gives us: Common language in which all mathematics can be encoded:,,,... Dispute

More information

4.4 Contracting Proofs to Programs

4.4 Contracting Proofs to Programs 4.4 Contracting Proofs to Programs 75 We close this section with the formal version of the proof above. Note the use of the conversion rule conv. [ x : nat; [ ~ 0 = 0; 0 = 0; F; s(pred(0)) = 0 ]; ~ 0 =

More information

Canonicity for 2-Dimensional Type Theory

Canonicity for 2-Dimensional Type Theory Canonicity for 2-Dimensional Type Theory Daniel R. Licata Robert Harper Carnegie Mellon University {drl,rwh}@cs.cmu.edu Abstract Higher-dimensional dependent type theory enriches conventional one-dimensional

More information

Experience implementing a performant category-theory library in Coq

Experience implementing a performant category-theory library in Coq Experience implementing a performant category-theory library in Coq Jason Gross, Adam Chlipala, David I. Spivak Massachusetts Institute of Technology How should theorem provers work? 2 How theorem provers

More information

Higher Inductive Types: The circle and friends, axiomatically

Higher Inductive Types: The circle and friends, axiomatically Higher Inductive Types: The circle and friends, axiomatically Peter LeFanu Lumsdaine Dalhousie University Halifax, Nova Scotia Foundational Methods in Computer Science Kananaskis, June 2011 DTT Dependent

More information

Formalization of quantum protocols using Coq

Formalization of quantum protocols using Coq Formalization of quantum protocols using Coq Jaap Boender Rajagopal Nagarajan Florian Kammüller July 17, 2015 Motivation for Interactive Theorem Proving (ITP) Automated Reasoning High Expressivity Trade

More information