a brief introduction to (dependent) type theory

Size: px
Start display at page:

Download "a brief introduction to (dependent) type theory"

Transcription

1 a brief introduction to (dependent) type theory Cory Knapp January 14, 2015 University of Birmingham

2 what is type theory?

3 What is type theory? formal language of terms with types x : A x has type A

4 What is type theory? formal language of terms with types x : A x has type A Idealized (functional) language type datatype. x : A x is a program (or value) of type A. 2

5 What is type theory? formal language of terms with types x : A x has type A Idealized (functional) language type datatype. x : A x is a program (or value) of type A. (+) :: Int -> Int -> Int map (+1) [1,2,3] :: [Int] 2

6 What is type theory? formal language of terms with types x : A x has type A 2

7 What is type theory? formal language of terms with types x : A x has type A Logic with book-keeping x : A A is a proposition and x is a proof of A. 2

8 What is type theory? formal language of terms with types x : A x has type A Logic with book-keeping x : A A is a proposition and x is a proof of A. λ(x : A). x : A A Given a proof x of A, we can find a proof x of A 2

9 What is type theory? formal language of terms with types x : A x has type A 2

10 What is type theory? formal language of terms with types x : A x has type A Alternative to set theory x : A A is a set and x A 2

11 What is type theory? formal language of terms with types x : A x has type A Alternative to set theory x : A A is a set and x A 0 : N 0 N 2

12 What is type theory? formal language of terms with types x : A x has type A 2

13 Contexts Everything happens in a context environment implicitly bound identifiers. 3

14 Contexts Everything happens in a context environment implicitly bound identifiers. Object foo(int x, int y){ //... int z = x + y; //... } x : int, y : int z : int 3

15 Contexts Everything happens in a context environment implicitly bound identifiers. Object foo(int x, int y){ //... int z = x + y; //... } x : int, y : int z : int 3

16 Contexts Everything happens in a context environment implicitly bound identifiers. Object foo(int x, int y){ //... int z = x + y; //... } x : int, y : int z : int 3

17 Rules and judgments Judgment = Result 4

18 Rules and judgments Judgment = Result Typing judgments 4

19 Rules and judgments Judgment = Result Typing judgments Γ A : Type Γ x : A 4

20 Rules and judgments Judgment = Result Typing judgments Γ A : Type Γ x : A Equality judgments 4

21 Rules and judgments Judgment = Result Typing judgments Γ A : Type Γ x : A Equality judgments Γ A B : Type Γ x y : A 4

22 Rules and judgments Judgment = Result Rule = Step Typing judgments Γ A : Type Γ x : A Equality judgments Γ A B : Type Γ x y : A 4

23 Rules and judgments Judgment = Result Rule = Step Typing judgments Γ A : Type Γ x : A Equality judgments Γ A B : Type Γ x y : A formally: J 1... J n RULE J 4

24 Rules and judgments Judgment = Result Rule = Step Typing judgments Γ A : Type Γ x : A Equality judgments Γ A B : Type Γ x y : A formally: conditional J 1... J n RULE J Γ b : bool Γ c 1 : C Γ c 2 : C Γ if b then c 1 else c 2 : C 4

25 Rules and judgments Judgment = Result Rule = Step Typing judgments Γ A : Type Γ x : A Equality judgments Γ A B : Type Γ x y : A formally: conditional J 1... J n RULE J Γ b : bool Γ c 1 : C Γ c 2 : C Γ if b then c 1 else c 2 : C Type isn t a type (but we can pretend) 4

26 simple types

27 Defining types Types are defined by rules Formation rules When does the type exist? 6

28 Defining types Types are defined by rules Formation rules When does the type exist? Γ A : Type Γ B : Type Γ A B : Type function type 6

29 Defining types Types are defined by rules Formation rules When does the type exist? Introduction rules What are the basic terms? 6

30 Defining types Types are defined by rules Formation rules When does the type exist? Introduction rules What are the basic terms? Γ B : Type Γ, x : A b : B Γ λx.b : A B lambda abstraction 6

31 Defining types Types are defined by rules Formation rules When does the type exist? Introduction rules What are the basic terms? Elimination rules What is the basic way to use a term? 6

32 Defining types Types are defined by rules Formation rules When does the type exist? Introduction rules What are the basic terms? Elimination rules What is the basic way to use a term? Γ m : A Γ f : A B Γ f(m) : B application 6

33 Defining types Types are defined by rules Formation rules When does the type exist? Introduction rules What are the basic terms? Elimination rules What is the basic way to use a term? Computation rules How do we reduce expressions? 6

34 Defining types Types are defined by rules Formation rules When does the type exist? Introduction rules What are the basic terms? Elimination rules What is the basic way to use a term? Computation rules How do we reduce expressions? Γ B : Type Γ, x : A b : B Γ m : A Γ (λx.b)(m) b[x/m] : B substitution 6

35 Inductive types 7

36 Inductive types Introduction rules Constructors 7

37 Inductive types Introduction rules Constructors Elimination/Computation rules Pattern-matching 7

38 Inductive types Introduction rules Constructors Elimination/Computation rules Pattern-matching data List = Cons Int List Empty sum :: List -> Int sum (Cons i l) = i + sum l sum Empty = 0 7

39 Inductive types Introduction rules Constructors Elimination/Computation rules Pattern-matching data List = Cons Int List Empty sum :: List -> Int sum (Cons i l) = i + sum l sum Empty = 0 7

40 Inductive types Introduction rules Constructors Elimination/Computation rules Pattern-matching data List = Cons Int List Empty sum :: List -> Int sum (Cons i l) = i + sum l sum Empty = 0 7

41 Inductive types Introduction rules Constructors Elimination/Computation rules Pattern-matching data List = Cons Int List Empty sum :: List -> Int sum (Cons i l) = i + sum l sum Empty = 0 7

42 Inductive types Introduction rules Constructors Elimination/Computation rules Pattern-matching data List = Cons Int List Empty sum :: List -> Int sum (Cons i l) = i + sum l sum Empty = 0 7

43 The simple types A B (a, b) Pair A B 8

44 The simple types A B (a, b) Pair A B A + B inla; inrb Inl A Inr B 8

45 The simple types A B (a, b) Pair A B A + B inla; inrb Inl A Inr B empty no constructors! 8

46 The simple types A B (a, b) Pair A B A + B inla; inrb Inl A Inr B empty no constructors! unit () 8

47 The simple types A B (a, b) Pair A B A + B inla; inrb Inl A Inr B empty no constructors! unit () others? Bool, Int, Nat, well-founded trees... 8

48 Interpretation Types Sets Propositions 9

49 Interpretation Types A B Sets A B Propositions A B 9

50 Interpretation Types A B A + B Sets A B A B Propositions A B A B 9

51 Interpretation Types A B A + B A B Sets A B A B B A Propositions A B A B B A 9

52 Interpretation Types A B A + B A B unit Sets A B A B B A { } Propositions A B A B B A 9

53 Interpretation Types A B A + B A B unit empty Sets A B A B B A { } Propositions A B A B B A 9

54 Interpretation Types A B A + B A B unit empty Sets A B A B B A { } Propositions A B A B B A What about quantifiers? 9

55 dependent types

56 Dependent types Γ, x : A B : Type 11

57 Dependent types Γ, x : A B : Type B depends on x : A 11

58 Dependent types Γ, x : A B : Type B depends on x : A Vectors of length n : nat. Days of month m : Months. 11

59 Dependent types Γ, x : A B : Type B depends on x : A Vectors of length n : nat. Days of month m : Months. λ-abstraction: Γ λx.b : A Type A type family 11

60 Dependent products dependent functions 12

61 Dependent products dependent functions Output type depends on input. 12

62 Dependent products dependent functions Output type depends on input. lastday(january) : daysof(january) lastday(april) : daysof(april) 12

63 Dependent products dependent functions Output type depends on input. lastday(january) : daysof(january) lastday(april) : daysof(april) x:a B dependent product 12

64 Dependent products dependent functions Output type depends on input. lastday(january) : daysof(january) lastday(april) : daysof(april) x:a B lastday : m:month daysof(m) dependent product 12

65 Dependent elimination Dependent functions are generalized functions generalize elimination 13

66 Dependent elimination Dependent functions are generalized functions generalize elimination C : A B Type f : p:a B C(p) f((a, b)) := something 13

67 Dependent elimination Dependent functions are generalized functions generalize elimination C : A B Type f : p:a B C(p) f((a, b)) := something Induction principle 13

68 Dependent sums dependent pair second coordinate depends on first 14

69 Dependent sums dependent pair second coordinate depends on first red-black tree: binary tree T with color assignment f : color(t) 14

70 Dependent sums dependent pair second coordinate depends on first red-black tree: binary tree T with color assignment f : color(t) (T, f) 14

71 Dependent sums dependent pair second coordinate depends on first red-black tree: binary tree T with color assignment f : color(t) (T, f) x:a B dependent sum 14

72 Dependent sums dependent pair second coordinate depends on first red-black tree: binary tree T with color assignment f : color(t) (T, f) x:a B RBTree := T:BinTree color(t) dependent sum 14

73 Interpretation Types Sets Propositions 15

74 Interpretation Types B : A Type Sets {B a a A} Propositions predicate B on A 15

75 Interpretation Types B : A Type x:a B(x) Sets {B a a A} x:a B(x) Propositions predicate B on A x A(B(x)) 15

76 Interpretation Types B : A Type x:a B(x) x:a B(x) Sets {B a a A} x:a B(x) x:a B(x) Propositions predicate B on A x A(B(x)) x A(B(x)) 15

77 Equality Propositions are types x = y is a proposition. Identity types 16

78 Equality Propositions are types x = y is a proposition. Identity types Inductive family = A : A A Type 16

79 Equality Propositions are types x = y is a proposition. Identity types Inductive family = A : A A Type Constructor refl a : a = A a 16

80 Equality Propositions are types x = y is a proposition. Identity types Inductive family = A : A A Type Constructor refl a : a = A a Eliminate by pattern-match on refl 16

81 Equality Propositions are types x = y is a proposition. Identity types Inductive family = A : A A Type Constructor refl a : a = A a Eliminate by pattern-match on refl sym : x,y:x(x = y y = x) sym x,x (refl x ) = refl x 16

82 Two notions of equality Is the same as =? 17

83 Two notions of equality Is the same as =? Extensional 17

84 Two notions of equality Is the same as =? Extensional Intensional 17

85 Two notions of equality Is the same as =? Extensional Too rigid Intensional 17

86 Two notions of equality Is the same as =? Extensional Too rigid Intensional Too flexible 17

87 Two notions of equality Is the same as =? Extensional Too rigid Intensional Too flexible Can we find a middle ground? 17

88 homotopy type theory

89 Homotopy interpretation Type theory: formal language for homotopy theory Voevdsky (2006); Awodey & Warren (2007) 19

90 Homotopy interpretation Type theory: formal language for homotopy theory Voevdsky (2006); Awodey & Warren (2007) types are spaces terms are points equalities are paths 19

91 Homotopy interpretation Type theory: formal language for homotopy theory Voevdsky (2006); Awodey & Warren (2007) types are spaces terms are points equalities are paths homotopy theory Use paths to characterize spaces Natural interpretations 19

92 univalence homotopy theory Equivalent spaces are identified A B if there is an invertible function A B 20

93 univalence homotopy theory Equivalent spaces are identified A B if there is an invertible function A B Univalence Axiom (A B) (A = Type B) 20

94 Higher Inductive types Paths are part of a space. 21

95 Higher Inductive types Paths are part of the definition of a space. 21

96 Higher Inductive types Paths are part of the definition of a space. Allow path constructors. 21

97 Higher Inductive types Paths are part of the definition of a space. Allow path constructors. Higher-inductive types 21

98 Higher Inductive types Paths are part of the definition of a space. Allow path constructors. Higher-inductive types Point constructors x : A 21

99 Higher Inductive types Paths are part of the definition of a space. Allow path constructors. Higher-inductive types Point constructors x : A path constructors p : x = A y 21

100 Higher Inductive types Paths are part of the definition of a space. Allow path constructors. Higher-inductive types Point constructors x : A path constructors p : x = A y Quotients, pushouts, suspensions, more. 21

101 More Information homotopytypetheory.org Blog, book, articles. github.com/hott Computer implementations Questions?

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

The three faces of homotopy type theory. Type theory and category theory. Minicourse plan. Typing judgments. Michael Shulman. The three faces of homotopy type theory Type theory and category theory Michael Shulman 1 A programming language. 2 A foundation for mathematics based on homotopy theory. 3 A calculus for (, 1)-category

More information

MLW. Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky. March 26, Radboud University Nijmegen

MLW. Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky. March 26, Radboud University Nijmegen 1 MLW Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky Radboud University Nijmegen March 26, 2012 inductive types 2 3 inductive types = types consisting of closed terms built from constructors

More information

Mathematics for Computer Scientists 2 (G52MC2)

Mathematics for Computer Scientists 2 (G52MC2) Mathematics for Computer Scientists 2 (G52MC2) L07 : Operations on sets School of Computer Science University of Nottingham October 29, 2009 Enumerations We construct finite sets by enumerating a list

More information

An introduction to Homotopy Type Theory

An introduction to Homotopy Type Theory An introduction to Homotopy Type Theory Nicola Gambino University of Palermo Leicester, March 15th, 2013 Outline of the talk Part I: Type theory Part II: Homotopy type theory Part III: Voevodsky s Univalent

More information

Identity in Homotopy Type Theory, Part I: The Justification of Path Induction

Identity in Homotopy Type Theory, Part I: The Justification of Path Induction Identity in Homotopy Type Theory, Part I: The Justification of Path Induction Friday 24 th October, 2014 Abstract Homotopy type theory (HoTT) is a new branch of mathematics that connects algebraic topology

More information

Univalent fibrations in type theory and topology

Univalent fibrations in type theory and topology Univalent fibrations in type theory and topology Dan Christensen University of Western Ontario Wayne State University, April 11, 2016 Outline: Background on type theory Equivalence and univalence A characterization

More information

From natural numbers to the lambda calculus

From natural numbers to the lambda calculus From natural numbers to the lambda calculus Benedikt Ahrens joint work with Ralph Matthes and Anders Mörtberg Outline 1 About UniMath 2 Signatures and associated syntax Outline 1 About UniMath 2 Signatures

More information

Computational Higher-Dimensional Type Theory

Computational Higher-Dimensional Type Theory 1 Computational Higher-Dimensional Type Theory Carlo Angiuli 1 Robert Harper 1 Todd Wilson 2 1 Carnegie Mellon University 2 California State University, Fresno January 20, 2017 Homotopy Type Theory (HoTT)

More information

Using Agda to Explore Path-Oriented Models of Type Theory

Using Agda to Explore Path-Oriented Models of Type Theory 1/22 Using Agda to Explore Path-Oriented Models of Type Theory Andrew Pitts joint work with Ian Orton Computer Laboratory Outline 2/22 The mathematical problem find new models of Homotopy Type Theory Why

More information

Topic 3: Propositions as types

Topic 3: Propositions as types Topic 3: Propositions as types May 18, 2014 Propositions as types We have seen that the main mathematical objects in a type theory are types. But remember that in conventional foundations, as based on

More information

What is type theory? 3 Before we go on, let us remember Vladimir Voevodsky, whose idea this winter. 4 So, what is type theory?

What is type theory? 3 Before we go on, let us remember Vladimir Voevodsky, whose idea this winter. 4 So, what is type theory? Spartan Type Theory Andrej Bauer University of Ljubljana 1 Welcome everyone. I am honored to have the opportunity to speak here. I was asked to do an introduction to type theory in one hour for people

More information

Recent Work in Homotopy Type Theory

Recent Work in Homotopy Type Theory Recent Work in Homotopy Type Theory Steve Awodey Carnegie Mellon University AMS Baltimore January 2014 Introduction Homotopy Type Theory is a newly discovered connection between logic and topology, based

More information

Basic Foundations of Isabelle/HOL

Basic Foundations of Isabelle/HOL Basic Foundations of Isabelle/HOL Peter Wullinger May 16th 2007 1 / 29 1 Introduction into Isabelle s HOL Why Type Theory Basic Type Syntax 2 More HOL Typed λ Calculus HOL Rules 3 Example proof 2 / 29

More information

CSE-321 Programming Languages 2011 Final

CSE-321 Programming Languages 2011 Final Name: Hemos ID: CSE-321 Programming Languages 2011 Final Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 15 15 10 17 18 25 100 There are six problems on 18 pages in this exam, including one extracredit

More information

Introduction to Homotopy Type Theory

Introduction to Homotopy Type Theory Introduction to Homotopy Type Theory Lecture notes for a course at EWSCS 2017 Thorsten Altenkirch March 5, 2017 1 What is this course about? To explain what Homotopy Type Theory is, I will first talk about

More information

Inductive datatypes in HOL. lessons learned in Formal-Logic Engineering

Inductive datatypes in HOL. lessons learned in Formal-Logic Engineering Inductive datatypes in HOL lessons learned in Formal-Logic Engineering Stefan Berghofer and Markus Wenzel Institut für Informatik TU München = Isabelle λ β HOL α 1 Introduction Applications of inductive

More information

HOL DEFINING HIGHER ORDER LOGIC LAST TIME ON HOL CONTENT. Slide 3. Slide 1. Slide 4. Slide 2 WHAT IS HIGHER ORDER LOGIC? 2 LAST TIME ON HOL 1

HOL DEFINING HIGHER ORDER LOGIC LAST TIME ON HOL CONTENT. Slide 3. Slide 1. Slide 4. Slide 2 WHAT IS HIGHER ORDER LOGIC? 2 LAST TIME ON HOL 1 LAST TIME ON HOL Proof rules for propositional and predicate logic Safe and unsafe rules NICTA Advanced Course Forward Proof Slide 1 Theorem Proving Principles, Techniques, Applications Slide 3 The Epsilon

More information

CS 4110 Programming Languages & Logics. Lecture 28 Recursive Types

CS 4110 Programming Languages & Logics. Lecture 28 Recursive Types CS 4110 Programming Languages & Logics Lecture 28 Recursive Types 7 November 2014 Announcements 2 Foster office hours 11-12pm Guest lecture by Fran on Monday Recursive Types 3 Many languages support recursive

More information

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

A NEW PROOF-ASSISTANT THAT REVISITS HOMOTOPY TYPE THEORY THE THEORETICAL FOUNDATIONS OF COQ USING NICOLAS TABAREAU COQHOTT A NEW PROOF-ASSISTANT THAT REVISITS THE THEORETICAL FOUNDATIONS OF COQ USING HOMOTOPY TYPE THEORY NICOLAS TABAREAU The CoqHoTT project Design and implement a brand-new proof assistant by revisiting

More information

Does Homotopy Type Theory Provide a Foundation for Mathematics?

Does Homotopy Type Theory Provide a Foundation for Mathematics? Does Homotopy Type Theory Provide a Foundation for Mathematics? Tuesday 11 th November, 2014 Abstract Homotopy Type Theory (HoTT) is a putative new foundation for mathematics grounded in constructive intensional

More information

(Effectul) Game Semantics for Dependent Types

(Effectul) Game Semantics for Dependent Types Eindhoven, 3 April 2016 Overview Game theoretic models of dependent type theory (DTT): get faithful model of (total) DTT with Σ-, Π-, intensional Id-types and finite inductive type families; fully complete

More information

Categorical models of type theory

Categorical models of type theory 1 / 59 Categorical models of type theory Michael Shulman February 28, 2012 2 / 59 Outline 1 Type theory and category theory 2 Categorical type constructors 3 Dependent types and display maps 4 Fibrations

More information

Game Semantics for Dependent Types

Game Semantics for Dependent Types Bath, 20 ctober, 2015 verview Game theoretic model of dependent type theory (DTT): refines model in domains and (total) continuous functions; call-by-name evaluation; faithful model of (total) DTT with

More information

Automated Reasoning. Natural Deduction in First-Order Logic

Automated Reasoning. Natural Deduction in First-Order Logic Automated Reasoning Natural Deduction in First-Order Logic Jacques Fleuriot Automated Reasoning Lecture 4, page 1 Problem Consider the following problem: Every person has a heart. George Bush is a person.

More information

Constructing the Propositional Truncation using Non-recursive HITs

Constructing the Propositional Truncation using Non-recursive HITs Constructing the Propositional Truncation using Non-recursive HITs Floris van Doorn Carnegie Mellon University January 19, 2016 Floris van Doorn (CMU) Constructing Propositional Truncation January 19,

More information

Representability of Homotopy Groups in Type Theory

Representability of Homotopy Groups in Type Theory Representability of Homotopy Groups in Type Theory Brandon Shapiro Constructive Type Theory The emerging field of homotopy type theory is built around the idea that in intensive type theory types can be

More information

λ calculus is inconsistent

λ calculus is inconsistent Content Rough timeline COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Gerwin Klein, June Andronick, Toby Murray λ Intro & motivation, getting started [1] Foundations & Principles

More information

An Introduction to Programming and Proving in Agda (incomplete draft)

An Introduction to Programming and Proving in Agda (incomplete draft) An Introduction to Programming and Proving in Agda (incomplete draft) Peter Dybjer January 29, 2018 1 A first Agda module Your first Agda-file is called BoolModule.agda. Its contents are module BoolModule

More information

Calculus of Inductive Constructions

Calculus of Inductive Constructions Calculus of Inductive Constructions Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) Calculus of Inductive Constructions

More information

Martin-Löf s Type Theory

Martin-Löf s Type Theory Martin-Löf s Type Theory B. Nordström, K. Petersson and J. M. Smith 1 Contents 1 Introduction.............................. 1 1.1 Different formulations of type theory............. 3 1.2 Implementations........................

More information

CSE-321 Programming Languages 2012 Midterm

CSE-321 Programming Languages 2012 Midterm Name: Hemos ID: CSE-321 Programming Languages 2012 Midterm Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 14 15 29 20 7 15 100 There are six problems on 24 pages in this exam. The maximum score

More information

Cubical Homotopy Type Theory

Cubical Homotopy Type Theory Cubical Homotopy Type Theory Steve Awodey Carnegie Mellon University Logic Colloquium and CLMPS August 2015 Outline I. Basic ideas of Homotopy Type Theory. II. The univalence axiom. III. Higher inductive

More information

COMP 4161 NICTA Advanced Course. Advanced Topics in Software Verification. Toby Murray, June Andronick, Gerwin Klein

COMP 4161 NICTA Advanced Course. Advanced Topics in Software Verification. Toby Murray, June Andronick, Gerwin Klein COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Toby Murray, June Andronick, Gerwin Klein λ 1 Last time... λ calculus syntax free variables, substitution β reduction α and η conversion

More information

Denotational Semantics. Domain Theory

Denotational Semantics. Domain Theory Denotational Semantics and Domain Theory 1 / 51 Outline Denotational Semantics Basic Domain Theory Introduction and history Primitive and lifted domains Sum and product domains Function domains Meaning

More information

A BRIEF INTRODUCTION TO TYPE THEORY AND THE UNIVALENCE AXIOM

A BRIEF INTRODUCTION TO TYPE THEORY AND THE UNIVALENCE AXIOM A BRIEF INTRODUCTION TO TYPE THEORY AND THE UNIVALENCE AXIOM JACKSON MACOR Abstract. In this paper, we will introduce the basic concepts and notation of modern type theory in an informal manner. We will

More information

CSE-321 Programming Languages 2010 Midterm

CSE-321 Programming Languages 2010 Midterm Name: Hemos ID: CSE-321 Programming Languages 2010 Midterm Score Prob 1 Prob 2 Prob 3 Prob 4 Total Max 15 30 35 20 100 1 1 SML Programming [15 pts] Question 1. [5 pts] Give a tail recursive implementation

More information

Computational Higher Type Theory

Computational Higher Type Theory Computational Higher Type Theory Robert Harper Computer Science Department Carnegie Mellon University HoTT Workshop 2016 Leeds, UK Thanks Joint work with Carlo Angiuli (CMU) and Todd Wilson (CSUF). Thanks

More information

Topic 1: What is HoTT and why?

Topic 1: What is HoTT and why? Topic 1: What is HoTT and why? May 5, 2014 Introduction Homotopy type theory (HoTT) is a newly emerging field of mathematics which is currently being developed as a foundation of mathematics which is in

More information

Dependencies by case or by function?

Dependencies by case or by function? Dependencies by case or by function? Andres Löh 5 September 2004 Generic equality in Dependency-style Generic functions are defined by pattern matching on a type argument: equal Int = (= =) equal Unit

More information

Introduction to dependent types in Coq

Introduction to dependent types in Coq October 24, 2008 basic use of the Coq system In Coq, you can play with simple values and functions. The basic command is called Check, to verify if an expression is well-formed and learn what is its type.

More information

Embedding logics in Dedukti

Embedding logics in Dedukti 1 INRIA, 2 Ecole Polytechnique, 3 ENSIIE/Cedric Embedding logics in Dedukti Ali Assaf 12, Guillaume Burel 3 April 12, 2013 Ali Assaf, Guillaume Burel: Embedding logics in Dedukti, 1 Outline Introduction

More information

Axiom 3 Z(pos(Z) X(X intersection of Z P(X)))

Axiom 3 Z(pos(Z) X(X intersection of Z P(X))) In this section, we are going to prove the equivalence between Axiom 3 ( the conjunction of any collection of positive properties is positive ) and Proposition 3 ( it is possible that God exists ). First,

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Operational Semantics CMSC 330 Summer 2018 1 Formal Semantics of a Prog. Lang. Mathematical description of the meaning of programs written in that language

More information

Programming Languages Lecture 14: Sum, Product, Recursive Types

Programming Languages Lecture 14: Sum, Product, Recursive Types CSE 230: Winter 200 Principles of Programming Languages Lecture 4: Sum, Product, Recursive Types The end is nigh HW 3 No HW 4 (= Final) Project (Meeting + Talk) Ranjit Jhala UC San Diego Recap Goal: Relate

More information

Subsets in type theory

Subsets in type theory Subsets in type theory Bengt Nordström bengt@cs.chalmers.se ChungAng University on leave from Chalmers University, Göteborg, Sweden Subsets in type theory p.1/24 An example: Linear search Write a program

More information

Programming Languages

Programming Languages CSE 230: Winter 2008 Principles of Programming Languages Ocaml/HW #3 Q-A Session Push deadline = Mar 10 Session Mon 3pm? Lecture 15: Type Systems Ranjit Jhala UC San Diego Why Typed Languages? Development

More information

Less naive type theory

Less naive type theory Institute of Informatics Warsaw University 26 May 2007 Plan 1 Syntax of lambda calculus Why typed lambda calculi? 2 3 Syntax of lambda calculus Why typed lambda calculi? origins in 1930s (Church, Curry)

More information

Exercise 1 (2+2+2 points)

Exercise 1 (2+2+2 points) 1 Exercise 1 (2+2+2 points) The following data structure represents binary trees only containing values in the inner nodes: data Tree a = Leaf Node (Tree a) a (Tree a) 1 Consider the tree t of integers

More information

CMPSCI 250: Introduction to Computation. Lecture #1: Things, Sets and Strings David Mix Barrington 22 January 2014

CMPSCI 250: Introduction to Computation. Lecture #1: Things, Sets and Strings David Mix Barrington 22 January 2014 CMPSCI 250: Introduction to Computation Lecture #1: Things, Sets and Strings David Mix Barrington 22 January 2014 Things, Sets, and Strings The Mathematical Method Administrative Stuff The Objects of Mathematics

More information

GADTs. GADTs in Haskell

GADTs. GADTs in Haskell GADTs GADTs in Haskell ADT vs GADT Algebraic Datatype Data List a = Nil Cons a (List a) Data Tree a b = Tip a Node (Tree a b) b Fork (Tree a b) (Tree a b) Note that types than can be expressed as an ADT

More information

Structural polymorphism in Generic Haskell

Structural polymorphism in Generic Haskell Structural polymorphism in Generic Haskell Andres Löh andres@cs.uu.nl 5 February 2005 Overview About Haskell Genericity and other types of polymorphism Examples of generic functions Generic Haskell Overview

More information

4.5 Pure Linear Functional Programming

4.5 Pure Linear Functional Programming 4.5 Pure Linear Functional Programming 99 4.5 Pure Linear Functional Programming The linear λ-calculus developed in the preceding sections can serve as the basis for a programming language. The step from

More information

Preuves Interactives et Applications

Preuves Interactives et Applications Preuves Interactives et Applications Christine Paulin & Burkhart Wolff http://www.lri.fr/ paulin/preuvesinteractives Université Paris-Saclay HOL and its Specification Constructs 10/12/16 B. Wolff - M2

More information

CSE505, Fall 2012, Midterm Examination October 30, 2012

CSE505, Fall 2012, Midterm Examination October 30, 2012 CSE505, Fall 2012, Midterm Examination October 30, 2012 Rules: The exam is closed-book, closed-notes, except for one side of one 8.5x11in piece of paper. Please stop promptly at Noon. You can rip apart

More information

Advances in Programming Languages

Advances in Programming Languages Advances in Programming Languages Lecture 4: Higher Polymorphism Ian Stark School of Informatics The University of Edinburgh Friday 30 September 2016 Semester 1 Week 2 https://blog.inf.ed.ac.uk/apl16 Topic:

More information

Typed Lambda Calculus and Exception Handling

Typed Lambda Calculus and Exception Handling Typed Lambda Calculus and Exception Handling Dan Zingaro zingard@mcmaster.ca McMaster University Typed Lambda Calculus and Exception Handling p. 1/2 Untyped Lambda Calculus Goal is to introduce typing

More information

Explicit Recursion in Generic Haskell

Explicit Recursion in Generic Haskell Explicit Recursion in Generic Haskell Andres Löh Universiteit Utrecht andres@cs.uu.nl 26th March 2003 This is joint work with Dave Clarke and Johan Jeuring. Overview What is Generic Haskell? The difference

More information

Certified Programming with Dependent Types

Certified Programming with Dependent Types 1/30 Certified Programming with Dependent Types Inductive Predicates Niels van der Weide March 7, 2017 2/30 Last Time We discussed inductive types Print nat. (* Inductive nat : Set := O : nat S : nat nat*)

More information

CS 4110 Programming Languages & Logics. Lecture 27 Recursive Types

CS 4110 Programming Languages & Logics. Lecture 27 Recursive Types CS 4110 Programming Languages & Logics Lecture 27 Recursive Types 4 November 2016 Announcements 2 My office hours are at the normal time today but canceled on Monday Guest lecture by Seung Hee Han on Monday

More information

Dependent Type Theory

Dependent Type Theory Lecture 1 MGS - Leicester 2009 References B. Nordstöm, K. Petersson, and J. M. Smith Martin-Löf s Type Theory Handbook of Logic in Computer Science, Vol. 5 Oxford University Press, 2001. B. Nordström,

More information

Proofs for free. Parametricity for dependent types. JEAN-PHILIPPE BERNARDY and PATRIK JANSSON

Proofs for free. Parametricity for dependent types. JEAN-PHILIPPE BERNARDY and PATRIK JANSSON JFP 22 (2): 107 152, 2012. c Cambridge University Press 2012 doi:10.1017/s0956796812000056 First published online 30 March 2012 107 Proofs for free Parametricity for dependent types JEAN-PHILIPPE BERNARDY

More information

A Model of Type Theory in Simplicial Sets

A Model of Type Theory in Simplicial Sets A Model of Type Theory in Simplicial Sets A brief introduction to Voevodsky s Homotopy Type Theory T. Streicher Fachbereich 4 Mathematik, TU Darmstadt Schlossgartenstr. 7, D-64289 Darmstadt streicher@mathematik.tu-darmstadt.de

More information

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

Comp 411 Principles of Programming Languages Lecture 7 Meta-interpreters. Corky Cartwright January 26, 2018 Comp 411 Principles of Programming Languages Lecture 7 Meta-interpreters Corky Cartwright January 26, 2018 Denotational Semantics The primary alternative to syntactic semantics is denotational semantics.

More information

Theorem Proving Principles, Techniques, Applications Recursion

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

More information

GADTs. Wouter Swierstra and Alejandro Serrano. Advanced functional programming - Lecture 7. [Faculty of Science Information and Computing Sciences]

GADTs. Wouter Swierstra and Alejandro Serrano. Advanced functional programming - Lecture 7. [Faculty of Science Information and Computing Sciences] GADTs Advanced functional programming - Lecture 7 Wouter Swierstra and Alejandro Serrano 1 Today s lecture Generalized algebraic data types (GADTs) 2 A datatype data Tree a = Leaf Node (Tree a) a (Tree

More information

A Canonical 1 Locally Named Representation of Binding. α -equivalence is identity. Randy Pollack. Masahiko Sato. LFCS, University of Edinburgh

A Canonical 1 Locally Named Representation of Binding. α -equivalence is identity. Randy Pollack. Masahiko Sato. LFCS, University of Edinburgh A Canonical 1 Locally Named Representation of Binding Randy Pollack LFCS, University of Edinburgh Masahiko Sato Graduate School of Informatics, Kyoto University Version of December 7, 2009 1 α -equivalence

More information

Type Theory in Type Theory using Quotient Inductive Types

Type Theory in Type Theory using Quotient Inductive Types Type Theory in Type Theory using Quotient Inductive Types Thorsten Altenkirch University of Nottingham {txa,auk}@cs.nott.ac.uk Ambrus Kaposi Abstract We present an internal formalisation of dependent type

More information

CS 6110 S14 Lecture 1 Introduction 24 January 2014

CS 6110 S14 Lecture 1 Introduction 24 January 2014 CS 6110 S14 Lecture 1 Introduction 24 January 2014 1 Introduction What is a program? Is it just something that tells the computer what to do? Yes, but there is much more to it than that. The basic expressions

More information

Inductive Definitions, continued

Inductive Definitions, continued 1 / 27 Inductive Definitions, continued Assia Mahboubi Jan 7th, 2016 2 / 27 Last lecture Introduction to Coq s inductive types: Introduction, elimination and computation rules; Twofold implementation :

More information

GADTs. Alejandro Serrano. AFP Summer School. [Faculty of Science Information and Computing Sciences]

GADTs. Alejandro Serrano. AFP Summer School. [Faculty of Science Information and Computing Sciences] GADTs AFP Summer School Alejandro Serrano 1 Today s lecture Generalized algebraic data types (GADTs) 2 A datatype data Tree a = Leaf Node (Tree a) a (Tree a) This definition introduces: 3 A datatype data

More information

Goal. CS152: Programming Languages. Lecture 15 Parametric Polymorphism. What the Library Likes. What The Client Likes. Start simpler.

Goal. CS152: Programming Languages. Lecture 15 Parametric Polymorphism. What the Library Likes. What The Client Likes. Start simpler. Goal Understand what this interface means and why it matters: CS152: Programming Languages Lecture 15 Parametric Polymorphism Dan Grossman Spring 2011 type a mylist; val mt_list : a mylist val cons : a

More information

Natural Numbers. We will use natural numbers to illustrate several ideas that will apply to Haskell data types in general.

Natural Numbers. We will use natural numbers to illustrate several ideas that will apply to Haskell data types in general. Natural Numbers We will use natural numbers to illustrate several ideas that will apply to Haskell data types in general. For the moment we will ignore that fact that each type in Haskell includes possible

More information

Semantic Subtyping with an SMT Solver

Semantic Subtyping with an SMT Solver Semantic Subtyping with an SMT Solver Cătălin Hrițcu, Saarland University, Saarbrücken, Germany Joint work with Andy Gordon, Gavin Bierman, and Dave Langworthy (all from Microsoft) Refinement Types + Type-test

More information

Higher-Order Logic. Specification and Verification with Higher-Order Logic

Higher-Order Logic. Specification and Verification with Higher-Order Logic Higher-Order Logic Specification and Verification with Higher-Order Logic Arnd Poetzsch-Heffter (Slides by Jens Brandt) Software Technology Group Fachbereich Informatik Technische Universität Kaiserslautern

More information

Types and Programming Languages. Lecture 5. Extensions of simple types

Types and Programming Languages. Lecture 5. Extensions of simple types Types and Programming Languages Lecture 5. Extensions of simple types Xiaojuan Cai cxj@sjtu.edu.cn BASICS Lab, Shanghai Jiao Tong University Fall, 2016 Coming soon Simply typed λ-calculus has enough structure

More information

GADTs. Wouter Swierstra. Advanced functional programming - Lecture 7. Faculty of Science Information and Computing Sciences

GADTs. Wouter Swierstra. Advanced functional programming - Lecture 7. Faculty of Science Information and Computing Sciences GADTs Advanced functional programming - Lecture 7 Wouter Swierstra 1 Today s lecture Generalized algebraic data types (GADTs) 2 A datatype data Tree a = Leaf Node (Tree a) a (Tree a) This definition introduces:

More information

Type Theory. Lecture 2: Dependent Types. Andreas Abel. Department of Computer Science and Engineering Chalmers and Gothenburg University

Type Theory. Lecture 2: Dependent Types. Andreas Abel. Department of Computer Science and Engineering Chalmers and Gothenburg University Type Theory Lecture 2: Dependent Types Andreas Abel Department of Computer Science and Engineering Chalmers and Gothenburg University Type Theory Course CM0859 (2017-1) Universidad EAFIT, Medellin, Colombia

More information

Programming in homotopy type theory and erasing propositions Gabe Dijkstra

Programming in homotopy type theory and erasing propositions Gabe Dijkstra Programming in homotopy type theory and erasing propositions Gabe Dijkstra M.Sc. thesis ICA-3354881 [Supervisors] Wouter Swierstra and Johan Jeuring August 26, 2013 Department of Computing Science Abstract

More information

We defined congruence rules that determine the order of evaluation, using the following evaluation

We defined congruence rules that determine the order of evaluation, using the following evaluation CS 4110 Programming Languages and Logics Lectures #21: Advanced Types 1 Overview In this lecture we will extend the simply-typed λ-calculus with several features we saw earlier in the course, including

More information

Lambda Calculi With Polymorphism

Lambda Calculi With Polymorphism Resources: The slides of this lecture were derived from [Järvi], with permission of the original author, by copy & x = 1 let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn

More information

Introduction to the Lambda Calculus. Chris Lomont

Introduction to the Lambda Calculus. Chris Lomont Introduction to the Lambda Calculus Chris Lomont 2010 2011 2012 www.lomont.org Leibniz (1646-1716) Create a universal language in which all possible problems can be stated Find a decision method to solve

More information

The Prototype Verification System PVS

The Prototype Verification System PVS The Prototype Verification System PVS Wolfgang Schreiner Wolfgang.Schreiner@risc.uni-linz.ac.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.uni-linz.ac.at

More information

Integration of SMT Solvers with ITPs There and Back Again

Integration of SMT Solvers with ITPs There and Back Again Integration of SMT Solvers with ITPs There and Back Again Sascha Böhme and University of Sheffield 7 May 2010 1 2 Features: SMT-LIB vs. Yices Translation Techniques Caveats 3 4 Motivation Motivation System

More information

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011 CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e

More information

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER 2012 2013 MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS Time allowed TWO hours Candidates may complete the front

More information

Part III Chapter 15: Subtyping

Part III Chapter 15: Subtyping Part III Chapter 15: Subtyping Subsumption Subtype relation Properties of subtyping and typing Subtyping and other features Intersection and union types Subtyping Motivation With the usual typing rule

More information

Overview. A Compact Introduction to Isabelle/HOL. Tobias Nipkow. System Architecture. Overview of Isabelle/HOL

Overview. A Compact Introduction to Isabelle/HOL. Tobias Nipkow. System Architecture. Overview of Isabelle/HOL Overview A Compact Introduction to Isabelle/HOL Tobias Nipkow TU München 1. Introduction 2. Datatypes 3. Logic 4. Sets p.1 p.2 System Architecture Overview of Isabelle/HOL ProofGeneral Isabelle/HOL Isabelle

More information

Recursive Types. Chapter 7

Recursive Types. Chapter 7 Chapter 7 Recursive Types By adding special rules for natural numbers to λ, we obtained system T. We may now want to have separate rules for other data structures: lists, binary trees, streams. We can

More information

Naïve Computational Type Theory

Naïve Computational Type Theory Naïve Computational Type Theory Robert L. Constable February 11, 2003 Preface The basic concepts of type theory are fundamental to computer science, logic and mathematics. Indeed, the language of type

More information

What s in Main. Tobias Nipkow. December 5, Abstract

What s in Main. Tobias Nipkow. December 5, Abstract What s in Main Tobias Nipkow December 5, 2013 Abstract This document lists the main types, functions and syntax provided by theory Main. It is meant as a quick overview of what is available. For infix

More information

Knowledge Representation and Reasoning Logics for Artificial Intelligence

Knowledge Representation and Reasoning Logics for Artificial Intelligence Knowledge Representation and Reasoning Logics for Artificial Intelligence Stuart C. Shapiro Department of Computer Science and Engineering and Center for Cognitive Science University at Buffalo, The State

More information

Type families and data kinds

Type families and data kinds Type families and data kinds AFP Summer School Wouter Swierstra 1 Today How do GADTs work? Kinds beyond * Programming with types 2 Calling functions on vectors Given two vectors xs : Vec a n and ys : Vec

More information

Mechanized metatheory revisited

Mechanized metatheory revisited Mechanized metatheory revisited Dale Miller Inria Saclay & LIX, École Polytechnique Palaiseau, France TYPES 2016, Novi Sad 25 May 2016 Theory vs Metatheory When formalizing programming languages, we often

More information

Lambda Calculi With Polymorphism

Lambda Calculi With Polymorphism Resources: The slides of this lecture were derived from [Järvi], with permission of the original author, by copy & x = 1 let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn

More information

From signatures to monads in UniMath

From signatures to monads in UniMath From signatures to monads in UniMath Benedikt Ahrens, Ralph Matthes, Anders Mörtberg To cite this version: Benedikt Ahrens, Ralph Matthes, Anders Mörtberg. From signatures to monads in UniMath. 2016.

More information

Part III. Chapter 15: Subtyping

Part III. Chapter 15: Subtyping Part III Chapter 15: Subtyping Subsumption Subtype relation Properties of subtyping and typing Subtyping and other features Intersection and union types Subtyping Motivation With the usual typing rule

More information

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

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

More information

CMSC 336: Type Systems for Programming Languages Lecture 5: Simply Typed Lambda Calculus Acar & Ahmed January 24, 2008

CMSC 336: Type Systems for Programming Languages Lecture 5: Simply Typed Lambda Calculus Acar & Ahmed January 24, 2008 CMSC 336: Type Systems for Programming Languages Lecture 5: Simply Typed Lambda Calculus Acar & Ahmed January 24, 2008 Contents 1 Solution to the Exercise 1 1.1 Semantics for lambda calculus.......................

More information

A LISP Interpreter in ML

A LISP Interpreter in ML UNIVERSITY OF OSLO Department of Informatics A LISP Interpreter in ML Mandatory Assignment 1 INF3110 September 21, 2009 Contents 1 1 Introduction The purpose of this assignment is to write an interpreter,

More information

CSE-321 Programming Languages 2010 Final

CSE-321 Programming Languages 2010 Final Name: Hemos ID: CSE-321 Programming Languages 2010 Final Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 18 28 16 12 36 40 150 There are six problems on 16 pages, including two work sheets, in

More information