Automata and Formal Languages - CM0081 Introduction to Agda

Size: px
Start display at page:

Download "Automata and Formal Languages - CM0081 Introduction to Agda"

Transcription

1 Automata and Formal Languages - CM0081 Introduction to Agda Andrés Sicard-Ramírez Universidad EAFIT Semester

2 Introduction Curry-Howard correspondence Dependent types Constructivism Martin-Löf s type theory Dependently typed functional programming language Agda Dependently typed interactive proof assistant 2/46

3 Constructive Logic Troelstra and van Dalen [1988, p. 8]: The preceding examples of non-constructive proofs show that the natural constructive reading of A or B and xa(x) as we can decide between A and B and we can construct an x such that A(x) respectively does not agree with all the laws of the classical logic. 3/46

4 Constructive Logic Natural deduction rules A A (Ax) 4/46

5 Constructive Logic Natural deduction rules A A (Ax) Γ, A B ( I) Γ A B Γ A Γ A B ( E) Γ B 5/46

6 Constructive Logic Natural deduction rules A A (Ax) Γ, A B ( I) Γ A B Γ A Γ A B ( E) Γ B Γ A Γ B ( I) Γ A B Γ A B ( E1 ) Γ A Γ A B ( E2 ) Γ B 6/46

7 Constructive Logic Natural deduction rules A A (Ax) Γ, A B ( I) Γ A B Γ A Γ A B ( E) Γ B Γ A Γ B ( I) Γ A B Γ A B ( E1 ) Γ A Γ A B ( E2 ) Γ B Γ A Γ A B ( I 1 ) Γ B Γ A B ( I 2 ) Γ, A C Γ, B C A B ( E) Γ C 7/46

8 Constructive Logic Natural deduction rules A A (Ax) Γ, A B ( I) Γ A B Γ A Γ A B ( E) Γ B Γ A Γ B ( I) Γ A B Γ A B ( E1 ) Γ A Γ A B ( E2 ) Γ B Γ A Γ A B ( I 1 ) Γ B Γ A B ( I 2 ) Γ, A C Γ, B C A B ( E) Γ C ( E) A 8/46

9 Constructive Logic Natural deduction rules A A (Ax) Γ, A B ( I) Γ A B Γ A Γ A B ( E) Γ B Γ A Γ B ( I) Γ A B Γ A B ( E1 ) Γ A Γ A B ( E2 ) Γ B Γ A Γ A B ( I 1 ) Γ B Γ A B ( I 2 ) Γ, A C Γ, B C A B ( E) Γ C Abbreviation: A A ( E) A 9/46

10 Constructive Logic Example (Ax) B A B A ( E2 ) B A A B A A B (Ax) B A B A ( E1 ) B A B ( I) 10/46

11 What is a Type? Example Mathematics f Z {True, False} f(x) =... Java int f(boolean b) {... } Haskell f Bool Int f b =... 11/46

12 What is a Type? Example V = v V (type variables) T = V C N 0 N 1 T T T T T + T (constant types) (the empty type) (the unit type) (function types) (product types) (disjoint union types) 12/46

13 What is a Type? A type is a set. 13/46

14 What is a Type? A type is a set. Types as ranges of significance of propositional functions [Russell 1908]. Types are domains of predicates. 14/46

15 What is a Type? A type is a set. Types as ranges of significance of propositional functions [Russell 1908]. Types are domains of predicates. Example. The mathematical induction principle P (0) ( x.p (x) P (succ(x))) x.p (x) make sense only when P is a predicate over natural numbers (i.e., P N {True, False}). 15/46

16 What is a Type? Hoare s Notes on Data Structuring [Hoare 1972, pp ] 16/46

17 What is a Type? Hoare s Notes on Data Structuring [Hoare 1972, pp ] Thus there is a high degree of commonality in the use of the concept of type by mathematicians, logicians and programmers. The salient characteristics of the concept of type may be summarised: 1. A type determines the class of values which may be assumed by a variable or expression. 2. Every value belongs to one and only one type. 3. The type of a value denoted by any constant, variable, or expression may be deduced from its form or context, without any knowledge of its value as computed at run time. Continued on next slide 17/46

18 What is a Type? Hoare s Notes on Data Structuring (continuation) 4. Each operator expects operands of some fixed type, and delivers a result of some fixed type (usually the same). Where the same symbol is applied to several different types (e.g. + for addition of integers as well as reals), this symbol may be regarded as ambiguous, denoting several different actual operators. The resolution of such systematic ambiguity can always be made at compile time. 5. The properties of the values of a type and of the primitive operations defined over them are specified by means of a set of axioms. Continued on next slide 18/46

19 What is a Type? Hoare s Notes on Data Structuring (continuation) 6. Type information is used in a high-level language both to prevent or detect meaningless constructions in a program, and to determine the method of representing and manipulating data on a computer. 7. The types in which we are interested are those already familiar to mathematicians; namely, Cartesian Products, Discriminated Unions, Sets, Functions, Sequences, and Recursive Structures. 19/46

20 What is a Type? A type system is a tractable syntactic method for proving the absence of certain program behaviours by classifying phrases according to the kinds of values they compute. [Pierce 2002, p. 1] 20/46

21 What is a Type? A type system is a tractable syntactic method for proving the absence of certain program behaviours by classifying phrases according to the kinds of values they compute. [Pierce 2002, p. 1] A type is an approximation of a dynamic behaviour that can be derived from the form of an expression. [Kiselyov and Shan 2008, p. 8] 21/46

22 What is a Type? A type system is a tractable syntactic method for proving the absence of certain program behaviours by classifying phrases according to the kinds of values they compute. [Pierce 2002, p. 1] A type is an approximation of a dynamic behaviour that can be derived from the form of an expression. [Kiselyov and Shan 2008, p. 8] Related readings The Triumph of Types: Principia Mathematica s Impact on Computer Science [Constable 2010]. Against a Universal Definition of Type [Petricek 2015]. 22/46

23 What is a Type? BHK (Brouwer, Heyting, Kolmogorov) interpretation: A type is a set, a proposition, a problem and a specification. Type A Term a A Interpretation A is a set a is an element of the set A A A is a proposition A is a problem A is a specification a is a proof (construction) of the proposition A a is a method of solving the problem A a is a program than meets the specification A A is true A is solvable A is satisfiable See, e.g., [Martin-Löf 1984]. 23/46

24 Dependent Types Types that depend on elements of other types. 24/46

25 Dependent Types Types that depend on elements of other types. Example The type of vectors of length n: A 0 = 1, A n+1 = A A n, where 1 is the unit type and is the product type. 25/46

26 Dependent Types B(x): Dependent type for x A 26/46

27 Dependent Types B(x): Dependent type for x A Definition (Dependent function type (Pi types)) B(x) is the type of functions f with f a B(a) if a A. x A Note: If B(x) = B for all x A, then B(x) A B. (Agda notation: (x A) B) x A 27/46

28 Dependent Types Definition (Dependent sum type (Sigma types)) B(x) is the type of pairs (a, b) with a A and b B(a). x A Note: If B(x) = B for all x A, then B(x) A B. x A 28/46

29 The Propositions-as-Types Principle The Curry-Howard isomorphism or the Brouwer - Heyting - Kolmogorov - Schönfinkel - Curry - Meredith - Kleene - Feys - Gödel - Läuchli - Kreisel - Tait - Lawvere - Howard - de Bruijn - Scott - Martin-Löf - Girard - Reynolds - Stenlund - Constable - Coquand - Huet - - isomorphism [Sørensen and Urzyczyn 2006, p. viii]. 29/46

30 The Propositions-as-Types Principle Three correspondence s levels [Wadler 2015]: 1. Propositions as types for each proposition in the logic there is a corresponding type in the programming language and vice versa 30/46

31 The Propositions-as-Types Principle Three correspondence s levels [Wadler 2015]: 1. Propositions as types for each proposition in the logic there is a corresponding type in the programming language and vice versa 2. Proofs as programs for each proof of a given proposition, there is a program of the corresponding type and vice versa 31/46

32 The Propositions-as-Types Principle Three correspondence s levels [Wadler 2015]: 1. Propositions as types for each proposition in the logic there is a corresponding type in the programming language and vice versa 2. Proofs as programs for each proof of a given proposition, there is a program of the corresponding type and vice versa 3. Simplification of proofs as evaluation of programs for each way to simplify a proof there is a corresponding way to evaluate a program and vice versa 32/46

33 The Propositions-as-Types Principle (A proposition is true if the corresponding type is non-empty) Propositional Logic (false) (true) (implication) (conjunction) (disjunction) Dependently typed λ-calculus (empty type) (unit type) (function type) (product type) + disjoint sum type 33/46

34 The Propositions-as-Types Principle II (A proposition is true if the corresponding type is non-empty) First-Order Logic (false) (true) (implication) (conjunction) (disjunction) x.b(x) (universal quantifier) x.b(x) (existential quantifier) Dependently typed λ-calculus (empty type) (unit type) (function type) (product type) + (disjoint sum type) B(x) (dependent fn. type) x A B(x) (dependent sum type) x A 34/46

35 Applications of Dependent Types To carry useful information for programs optimisation. 35/46

36 Applications of Dependent Types To carry useful information for programs optimisation. To reduce the semantic gap between programs and their properties. 36/46

37 Applications of Dependent Types To carry useful information for programs optimisation. To reduce the semantic gap between programs and their properties. The propositions-as-types-principle: Computational interpretation of logical constants. 37/46

38 Applications of Dependent Types To carry useful information for programs optimisation. To reduce the semantic gap between programs and their properties. The propositions-as-types-principle: Computational interpretation of logical constants. Unified programing logics (programs, specification and satisfaction relation). 38/46

39 Dependently Typed Systems (See the Wikipedia article on dependent types for a more complete list) 39/46

40 Dependently Typed Systems (See the Wikipedia article on dependent types for a more complete list) The ALF/Agda family (Gothenburg - Sweden) ALF Agda Alfa. Graphical interface for Agda AgdaLight. Experimental version of Agda Agda 2. Based on Martin-Löf type theory. Direct manipulation of proofs-objects. Backends to Haskell and JavaScript. Written in Haskell. 40/46

41 Dependently Typed Systems Cayenne (Gothenburg - Sweden). An Haskell-like language with dependent types. Written in Haskell. Coq (INRIA - France). Based on the Calculus of Inductive Constructions. Tactic-based. Extraction of programs to Objective Caml, Haskell and Scheme. Written in Objective Caml (with a bit of C). DML (USA). An extension of ML with a restricted form of dependent types. Written in Objective Caml. Epigram 2 (England). Based on a closed type theory. Direct manipulation of proofs-objects. The language is in development. NuPrl (Cornell - USA). Based on the Computational Type Theory. Tactic-based. Written in ML. 41/46

42 Further Reading Agda as a dependently typed proof assistant: Bove, A. and Dybjer, P. [2009]. Dependent Types at Work. In: Ler- Net ALFA Summer School Ed. by Bove, A., Soares Barbosa, L., Pardo, A. and Sousa Pinto, J. Vol Lecture Notes in Computer Science. Springer, pp doi: / _2. Agda as a dependently typed functional programming language: Norell, U. [2009]. Dependently Typed Programming in Agda. In: Advanced Functional Programming (AFP 2008). Ed. by Koopman, P., Plasmeijer, R. and Swierstra, D. Vol Lecture Notes in Computer Science. Springer, pp doi: / _5. 42/46

43 References Bove, A. and Dybjer, P. (2009). Dependent Types at Work. In: LerNet ALFA Summer School Ed. by Bove, A., Soares Barbosa, L., Pardo, A. and Sousa Pinto, J. Vol Lecture Notes in Computer Science. Springer, pp doi: / _2 (cit. on p. 42). Constable, R. L. (2010). The Triumph of Types: Principia Mathematica s Impact on Computer Science. Presented at the Principia Mathematica anniversary symposium (cit. on pp ). Hoare, C. A. R. (1972). Notes on Data Structuring. In: Structured Programming. Ed. by Dahl, O.-J., Disjkstra, E. W. and Hoare, C. A. R. Academic Press Inc., pp (cit. on pp. 16, 17). Kiselyov, O. and Shan, C. (2008). Interpreting Types as Abstract Values. Formosan Summer School on Logic, Language and Computacion (FLOLAC 2008) (cit. on pp ). Martin-Löf, P. (1984). Intuitionistic Type Theory. Bibliopolis (cit. on p. 23). 43/46

44 References Norell, U. (2009). Dependently Typed Programming in Agda. In: Advanced Functional Programming (AFP 2008). Ed. by Koopman, P., Plasmeijer, R. and Swierstra, D. Vol Lecture Notes in Computer Science. Springer, pp doi: / _5 (cit. on p. 42). Petricek, T. (2015). Against a Universal Definition of Type. In: Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward! 2015). ACM, pp doi: / (cit. on pp ). Pierce, B. C. (2002). Types and Programming Languages. MIT Press (cit. on pp ). Russell, B. (1908). Mathematical Logic as based on the Theory of Types. In: American Journal of Mathematics 30.3, pp doi: / (cit. on pp ). Sørensen, M.-H. and Urzyczyn, P. (2006). Lectures on the Curry-Howard Isomorphism. Vol Studies in Logic and the Foundations of Mathematics. Elsevier (cit. on p. 29). 44/46

45 References Troelstra, A. S. and van Dalen, D. (1988). Constructivism in Mathematics. An Introduction. Vol. I. North-Holland (cit. on p. 3). Wadler, P. (2015). Propositions as Types. In: Communications of the ACM 58.12, pp (cit. on pp ). 45/46

46 Demo

ABriefOverviewofAgda A Functional Language with Dependent Types

ABriefOverviewofAgda A Functional Language with Dependent Types ABriefOverviewofAgda A Functional Language with Dependent Types Ana Bove, Peter Dybjer, and Ulf Norell e-mail: {bove,peterd,ulfn}@chalmers.se Chalmers University of Technology, Gothenburg, Sweden Abstract.

More information

Lecture slides & distribution files:

Lecture slides & distribution files: Type Theory Lecture slides & distribution files: http://www.cs.rhul.ac.uk/home/zhaohui/ttlectures.html Zhaohui Luo Department of Computer Science Royal Holloway, University of London April 2011 2 Type

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

Martin-L f's Type Theory. B. Nordstr m, K. Petersson and J. M. Smith. Contents. 5.4 The set of functions (Cartesian product of a family of sets) 24

Martin-L f's Type Theory. B. Nordstr m, K. Petersson and J. M. Smith. Contents. 5.4 The set of functions (Cartesian product of a family of sets) 24 Martin-L f's Type Theory B. Nordstr m, K. Petersson and J. M. Smith Contents 1 Introduction : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 1 1.1 Dierent formulations of type theory : : : :

More information

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

Programming Proofs and Proving Programs. Nick Benton Microsoft Research, Cambridge Programming Proofs and Proving Programs Nick Benton Microsoft Research, Cambridge Coffee is does Greek 1. To draw a straight line from any point to any point. 2. To produce a finite straight line continuously

More information

On Agda JAIST/AIST WS CVS/AIST Yoshiki Kinoshita, Yoriyuki Yamagata. Agenda

On Agda JAIST/AIST WS CVS/AIST Yoshiki Kinoshita, Yoriyuki Yamagata. Agenda On Agda 2009.3.12 JAIST/AIST WS CVS/AIST Yoshiki Kinoshita, Yoriyuki Yamagata Agenda On Agda Agda as a programming language Agda as a proof system Further information. 2 1 Agenda On Agda Agda as a programming

More information

SJTU SUMMER 2014 SOFTWARE FOUNDATIONS. Dr. Michael Clarkson

SJTU SUMMER 2014 SOFTWARE FOUNDATIONS. Dr. Michael Clarkson SJTU SUMMER 2014 SOFTWARE FOUNDATIONS Dr. Michael Clarkson e Story Begins Gottlob Frege: a German mathematician who started in geometry but became interested in logic and foundations of arithmetic. 1879:

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

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

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

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

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

Automata and Formal Languages - CM0081 Introduction

Automata and Formal Languages - CM0081 Introduction Automata and Formal Languages - CM0081 Introduction Andrés Sicard-Ramírez Universidad EAFIT Semester 2018-2 Administrative Information Course Coordinator Andrés Sicard Ramírez Head of the Department of

More information

Mathematics for Computer Scientists 2 (G52MC2)

Mathematics for Computer Scientists 2 (G52MC2) Mathematics for Computer Scientists 2 (G52MC2) L03 : More Coq, Classical Logic School of Computer Science University of Nottingham October 8, 2009 The cut rule Sometimes we want to prove a goal Q via an

More information

CS3110 Spring 2017 Lecture 10 a Module for Rational Numbers

CS3110 Spring 2017 Lecture 10 a Module for Rational Numbers CS3110 Spring 2017 Lecture 10 a Module for Rational Numbers Robert Constable Abstract The notes and lecture start with a brief summary of the relationship between OCaml types, Coq types and logic that

More information

Intuitionistic Type Theory

Intuitionistic Type Theory Intuitionistic Type Theory Peter Dybjer Erik Palmgren May 6, 2015 Abstract Intuitionistic Type Theory (also Constructive Type Theory or Martin-Löf Type Theory) is a formal logical system and philosophical

More information

Conclusions and further reading

Conclusions and further reading Chapter 18 Conclusions and further reading We have not been exhaustive in the description of the Caml Light features. We only introduced general concepts in functional programming, and we have insisted

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

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

As Natural as 0, 1, 2. Philip Wadler University of Edinburgh As Natural as 0, 1, 2 Philip Wadler University of Edinburgh wadler@inf.ed.ac.uk Haskell Hindley-Milner types Java Girard-Reynolds types XML Operational semantics Part 0 Counting starts at zero Carle Carle

More information

Coq, a formal proof development environment combining logic and programming. Hugo Herbelin

Coq, a formal proof development environment combining logic and programming. Hugo Herbelin Coq, a formal proof development environment combining logic and programming Hugo Herbelin 1 Coq in a nutshell (http://coq.inria.fr) A logical formalism that embeds an executable typed programming language:

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

LOGIC AND DISCRETE MATHEMATICS

LOGIC AND DISCRETE MATHEMATICS LOGIC AND DISCRETE MATHEMATICS A Computer Science Perspective WINFRIED KARL GRASSMANN Department of Computer Science University of Saskatchewan JEAN-PAUL TREMBLAY Department of Computer Science University

More information

Universes. Universes for Data. Peter Morris. University of Nottingham. November 12, 2009

Universes. Universes for Data. Peter Morris. University of Nottingham. November 12, 2009 for Data Peter Morris University of Nottingham November 12, 2009 Introduction Outline 1 Introduction What is DTP? Data Types in DTP Schemas for Inductive Families 2 of Data Inductive Types Inductive Families

More information

Classical logic, truth tables. Types, Propositions and Problems. Heyting. Brouwer. Conjunction A B A & B T T T T F F F T F F F F.

Classical logic, truth tables. Types, Propositions and Problems. Heyting. Brouwer. Conjunction A B A & B T T T T F F F T F F F F. lassical logic, truth tables Types, Propositions and Problems an introduction to type theoretical ideas engt Nordström omputing Science, halmers and University of Göteborg Types Summer School, Hisingen,

More information

Proofs are Programs. Prof. Clarkson Fall Today s music: Proof by Paul Simon

Proofs are Programs. Prof. Clarkson Fall Today s music: Proof by Paul Simon Proofs are Programs Prof. Clarkson Fall 2017 Today s music: Proof by Paul Simon Review Previously in 3110: Functional programming in Coq Logic in Coq Today: A fundamental idea that goes by many names...

More information

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

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics 400 lecture note #4 [Ch 6] Set Theory 1. Basic Concepts and Definitions 1) Basics Element: ; A is a set consisting of elements x which is in a/another set S such that P(x) is true. Empty set: notated {

More information

Proofs-Programs correspondance and Security

Proofs-Programs correspondance and Security Proofs-Programs correspondance and Security Jean-Baptiste Joinet Université de Lyon & Centre Cavaillès, École Normale Supérieure, Paris Third Cybersecurity Japanese-French meeting Formal methods session

More information

Programming Languages Third Edition

Programming Languages Third Edition Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand

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

Proofs are Programs. Prof. Clarkson Fall Today s music: Two Sides to Every Story by Dyan Cannon and Willie Nelson

Proofs are Programs. Prof. Clarkson Fall Today s music: Two Sides to Every Story by Dyan Cannon and Willie Nelson Proofs are Programs Prof. Clarkson Fall 2016 Today s music: Two Sides to Every Story by Dyan Cannon and Willie Nelson Review Currently in 3110: Advanced topics Futures Monads Today: An idea that goes by

More information

Com S 541. Programming Languages I

Com S 541. Programming Languages I Programming Languages I Lecturer: TA: Markus Lumpe Department of Computer Science 113 Atanasoff Hall http://www.cs.iastate.edu/~lumpe/coms541.html TR 12:40-2, W 5 Pramod Bhanu Rama Rao Office hours: TR

More information

Types Summer School Gothenburg Sweden August Dogma oftype Theory. Everything has a type

Types Summer School Gothenburg Sweden August Dogma oftype Theory. Everything has a type Types Summer School Gothenburg Sweden August 2005 Formalising Mathematics in Type Theory Herman Geuvers Radboud University Nijmegen, NL Dogma oftype Theory Everything has a type M:A Types are a bit like

More information

Constructive Type Theory and Interactive Theorem Proving. Peter Dybjer Chalmers Tekniska Högskola Göteborg, Sweden

Constructive Type Theory and Interactive Theorem Proving. Peter Dybjer Chalmers Tekniska Högskola Göteborg, Sweden Constructive Type Theory and Interactive Theorem Proving Peter Dybjer Chalmers Tekniska Högskola Göteborg, Sweden JSSST Sendai, 15 September 2005 Interactive theorem provers - proof assis Examples: Classical

More information

Logical Verification Course Notes. Femke van Raamsdonk Vrije Universiteit Amsterdam

Logical Verification Course Notes. Femke van Raamsdonk Vrije Universiteit Amsterdam Logical Verification Course Notes Femke van Raamsdonk femke@csvunl Vrije Universiteit Amsterdam autumn 2008 Contents 1 1st-order propositional logic 3 11 Formulas 3 12 Natural deduction for intuitionistic

More information

Provably Correct Software

Provably Correct Software Provably Correct Software Max Schäfer Institute of Information Science/Academia Sinica September 17, 2007 1 / 48 The Need for Provably Correct Software BUT bugs are annoying, embarrassing, and cost gazillions

More information

A Prolog-based Proof Tool for Type Theory TA λ and Implicational Intuitionistic-Logic

A Prolog-based Proof Tool for Type Theory TA λ and Implicational Intuitionistic-Logic for Type Theory TA λ and Implicational Intuitionistic-Logic L. Yohanes Stefanus University of Indonesia Depok 16424, Indonesia yohanes@cs.ui.ac.id and Ario Santoso Technische Universität Dresden Dresden

More information

JOURNAL OF OBJECT TECHNOLOGY

JOURNAL OF OBJECT TECHNOLOGY JOURNAL OF OBJECT TECHNOLOGY Online at www.jot.fm. Published by ETH Zurich, Chair of Software Engineering JOT, 2002 Vol. 1, No. 2, July-August 2002 The Theory of Classification Part 2: The Scratch-Built

More information

Implementing Mathematics

Implementing Mathematics Implementing Mathematics with The Nuprl Proof Development System Draft of 18 October 1985 By the PRL Group: R. L. Constable S. F. Allen H. M. Bromley W. R. Cleaveland J. F. Cremer R. W. Harper D. J. Howe

More information

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

The Formal Semantics of Programming Languages An Introduction. Glynn Winskel. The MIT Press Cambridge, Massachusetts London, England The Formal Semantics of Programming Languages An Introduction Glynn Winskel The MIT Press Cambridge, Massachusetts London, England Series foreword Preface xiii xv 1 Basic set theory 1 1.1 Logical notation

More information

CS3110 Spring 2017 Lecture 7 Specifications using types continued

CS3110 Spring 2017 Lecture 7 Specifications using types continued CS3110 Spring 2017 Lecture 7 Specifications using types continued Robert Constable 1 Lecture Plan 1. Repeating schedule of remaining five problem sets and prelim. 2. Fixing OCaml specification and code

More information

Alonzo a Compiler for Agda

Alonzo a Compiler for Agda Alonzo a Compiler for Agda Marcin Benke Institute of Informatics, Warsaw University, ben@mimuw.edu.pl 1 Introduction Agda [Norell, 2007] is an interactive system for developing constructive proofs in a

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

Programming with Dependent Types Interactive programs and Coalgebras

Programming with Dependent Types Interactive programs and Coalgebras Programming with Dependent Types Interactive programs and Coalgebras Anton Setzer Swansea University, Swansea, UK 14 August 2012 1/ 50 A Brief Introduction into ML Type Theory Interactive Programs in Dependent

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

CS3110 Spring 2017 Lecture 9 Inductive proofs of specifications

CS3110 Spring 2017 Lecture 9 Inductive proofs of specifications CS3110 Spring 2017 Lecture 9 Inductive proofs of specifications Robert Constable 1 Lecture Plan 1. Repeating schedule of remaining five problem sets and prelim. 2. Comments on tautologies and the Coq logic.

More information

Formalizing the Halting Problem in a Constructive Type Theory

Formalizing the Halting Problem in a Constructive Type Theory Formalizing the Halting Problem in a Constructive Type Theory Kristofer Johannisson Department of Computing Science, Chalmers University of Technology, SE-412 96 Göteborg, Sweden. krijo@cs.chalmers.se

More information

Chapter 3: Propositional Languages

Chapter 3: Propositional Languages Chapter 3: Propositional Languages We define here a general notion of a propositional language. We show how to obtain, as specific cases, various languages for propositional classical logic and some non-classical

More information

Introductory logic and sets for Computer scientists

Introductory logic and sets for Computer scientists Introductory logic and sets for Computer scientists Nimal Nissanke University of Reading ADDISON WESLEY LONGMAN Harlow, England II Reading, Massachusetts Menlo Park, California New York Don Mills, Ontario

More information

An Annotated Language

An Annotated Language Hoare Logic An Annotated Language State and Semantics Expressions are interpreted as functions from states to the corresponding domain of interpretation Operators have the obvious interpretation Free of

More information

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

Computer Science 190 (Autumn Term, 2010) Semantics of Programming Languages Computer Science 190 (Autumn Term, 2010) Semantics of Programming Languages Course instructor: Harry Mairson (mairson@brandeis.edu), Volen 257, phone (781) 736-2724. Office hours Monday and Wednesday,

More information

Computation Club: Gödel s theorem

Computation Club: Gödel s theorem Computation Club: Gödel s theorem The big picture mathematicians do a lot of reasoning and write a lot of proofs formal systems try to capture the ideas of reasoning and proof in a purely mechanical set

More information

Towards Reasoning about State Transformer Monads in Agda. Master of Science Thesis in Computer Science: Algorithm, Language and Logic.

Towards Reasoning about State Transformer Monads in Agda. Master of Science Thesis in Computer Science: Algorithm, Language and Logic. Towards Reasoning about State Transformer Monads in Agda Master of Science Thesis in Computer Science: Algorithm, Language and Logic Viet Ha Bui Department of Computer Science and Engineering CHALMERS

More information

CSC 501 Semantics of Programming Languages

CSC 501 Semantics of Programming Languages CSC 501 Semantics of Programming Languages Subtitle: An Introduction to Formal Methods. Instructor: Dr. Lutz Hamel Email: hamel@cs.uri.edu Office: Tyler, Rm 251 Books There are no required books in this

More information

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Fall CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Final exam The final exam is Saturday December 16 11:30am-2:30pm. Lecture A will take the exam in Lecture B will take the exam

More information

CS3110 Spring 2017 Lecture 8 Specifications continued

CS3110 Spring 2017 Lecture 8 Specifications continued CS3110 Spring 2017 Lecture 8 Specifications continued Robert Constable 1 Lecture Plan 1. Repeating schedule of remaining five problem sets and prelim. 2. Examples of logical specifications and the evolution

More information

CIS 500: SOFTWARE FOUNDATIONS

CIS 500: SOFTWARE FOUNDATIONS Lecture 1 CIS 500: SOFTWARE FOUNDATIONS Steve Fall, 2013 Administrivia Instructor: Steve Office hours: Wednesday 3:30-5:00 & by appointment Levine 511 TAs: Dmitri Garbuzov Office hours: TBA Jennifer Paykin

More information

Introduction to Coq Proof Assistant

Introduction to Coq Proof Assistant Introduction to Coq Proof Assistant Qian Hu, M.Sc McMaster University March 3, 2010 Presentation Outline Overview Computer Assistance in Proofs Proof Assistant Coq Introduction The Coq Proof Assistant

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

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Winter CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Final exam The final exam is Saturday March 18 8am-11am. Lecture A will take the exam in GH 242 Lecture B will take the exam

More information

Propositional Calculus. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Propositional Calculus. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus

More information

Formal Predicate Calculus. Michael Meyling

Formal Predicate Calculus. Michael Meyling Formal Predicate Calculus Michael Meyling May 24, 2013 2 The source for this document can be found here: http://www.qedeq.org/0_04_07/doc/math/qedeq_formal_logic_v1.xml Copyright by the authors. All rights

More information

Typed Lambda Calculus for Syntacticians

Typed Lambda Calculus for Syntacticians Department of Linguistics Ohio State University January 12, 2012 The Two Sides of Typed Lambda Calculus A typed lambda calculus (TLC) can be viewed in two complementary ways: model-theoretically, as a

More information

INDEPENDENT POSTULATES FOR THE "INFORMAL" PART OF PRINCIPIA MATHEMATICA*

INDEPENDENT POSTULATES FOR THE INFORMAL PART OF PRINCIPIA MATHEMATICA* 9- "INFORMAL" PART OF PRINCIPIA 7 INDEPENDENT POSTULATES FOR THE "INFORMAL" PART OF PRINCIPIA MATHEMATICA* BY E. V. HUNTINGTON. Introduction. It has long been recognized that Section A of Whitehead and

More information

Partiality and Recursion in Interactive Theorem Provers An Overview

Partiality and Recursion in Interactive Theorem Provers An Overview Under consideration for publication in Math. Struct. in Comp. Science Partiality and Recursion in Interactive Theorem Provers An Overview A N A B O V E 1, A L E X A N D E R K R A U S S 2, and M A T T H

More information

Lecture 8: Summary of Haskell course + Type Level Programming

Lecture 8: Summary of Haskell course + Type Level Programming Lecture 8: Summary of Haskell course + Type Level Programming Søren Haagerup Department of Mathematics and Computer Science University of Southern Denmark, Odense October 31, 2017 Principles from Haskell

More information

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

Type Checking and Inference Are Equivalent in Lambda Calculi with Existential Types Type Checking and Inference Are Equivalent in Lambda Calculi with Existential Types Yuki Kato and Koji Nakazawa Graduate School of Informatics, Kyoto University, Kyoto 606-8501, Japan Abstract. This paper

More information

Logic and its Applications

Logic and its Applications Logic and its Applications Edmund Burke and Eric Foxley PRENTICE HALL London New York Toronto Sydney Tokyo Singapore Madrid Mexico City Munich Contents Preface xiii Propositional logic 1 1.1 Informal introduction

More information

Programs with infinite loops: from primitive recursive predicates to the arithmetic hierarchy

Programs with infinite loops: from primitive recursive predicates to the arithmetic hierarchy Programs with infinite loops: from primitive recursive predicates to the arithmetic hierarchy ((quite) preliminary) Armando B. Matos September 11, 2014 Abstract Infinite time Turing machines have been

More information

4.8 Dependent Types 97

4.8 Dependent Types 97 4.8 Dependent Types 97 4.8 Dependent Types We have encountered a number of constructors for propositions and types. Generally, propositions are constructed from simpler propositions, and types are constructed

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

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

Programming with Universes, Generically

Programming with Universes, Generically Programming with Universes, Generically Andres Löh Well-Typed LLP 24 January 2012 An introduction to Agda Agda Functional programming language Static types Dependent types Pure (explicit effects) Total

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

Linear Clause Generation by Tableaux and DAGs

Linear Clause Generation by Tableaux and DAGs kovasznai 2007/8/10 11:27 page 109 #1 5/1 (2007), 109 118 tmcs@inf.unideb.hu http://tmcs.math.klte.hu Linear Clause Generation by Tableaux and DAGs Gergely Kovásznai Abstract. Clause generation is a preliminary

More information

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214 Theorem proving PVS theorem prover Abhik Roychoudhury National University of Singapore Both specification and implementation can be formalized in a suitable logic. Proof rules for proving statements in

More information

arxiv: v6 [math.lo] 9 Mar 2018

arxiv: v6 [math.lo] 9 Mar 2018 1 Functionals and hardware STANISLAW AMBROSZKIEWICZ, Institute of Computer Science, Polish Academy of Sciences, Jana Kazimierza 5, PL-01-248 Warsaw, Poland arxiv:1501.03043v6 [math.lo] 9 Mar 2018 Functionals

More information

Propositional Calculus: Boolean Functions and Expressions. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Propositional Calculus: Boolean Functions and Expressions. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson Propositional Calculus: Boolean Functions and Expressions CS 270: Mathematical Foundations of Computer Science Jeremy Johnson Propositional Calculus Objective: To provide students with the concepts and

More information

Combining Programming with Theorem Proving

Combining Programming with Theorem Proving Combining Programming with Theorem Proving Chiyan Chen and Hongwei Xi Boston University Programming with Theorem Proving p.1/27 Motivation for the Research To support advanced type systems for practical

More information

CIS 500: SOFTWARE FOUNDATIONS

CIS 500: SOFTWARE FOUNDATIONS Lecture 1 CIS 500: SOFTWARE FOUNDATIONS Stephanie Weirich Fall, 2014 Administrivia Instructor: Stephanie Weirich Office hours: Tomorrow 10-12, TBA in general Levine 510 TAs: Arthur Azevedo de Amorim Office

More information

Summary of Course Coverage

Summary of Course Coverage CS-227, Discrete Structures I Spring 2006 Semester Summary of Course Coverage 1) Propositional Calculus a) Negation (logical NOT) b) Conjunction (logical AND) c) Disjunction (logical inclusive-or) d) Inequalities

More information

CS3110 Spring 2017 Lecture 12: DRAFT: Constructive Real Numbers continued

CS3110 Spring 2017 Lecture 12: DRAFT: Constructive Real Numbers continued CS3110 Spring 2017 Lecture 12: DRAFT: Constructive Real Numbers continued Robert Constable Reminder: Prelim in class next Tuesday. It will not cover the real numbers beyond lecture 11 and comments on lecture

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

Faith, Evolution, and Programming Languages. Philip Wadler University of Edinburgh

Faith, Evolution, and Programming Languages. Philip Wadler University of Edinburgh Faith, Evolution, and Programming Languages Philip Wadler University of Edinburgh Evolution Multiculturalism Part I Church: The origins of faith Gerhard Gentzen (1909 1945) Gerhard Gentzen (1935) Natural

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

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS What is discrete? Sets (Rosen, Chapter 2) TOPICS Discrete math Set Definition Set Operations Tuples Consisting of distinct or unconnected elements, not continuous (calculus) Helps us in Computer Science

More information

A Modern Perspective on Type Theory

A Modern Perspective on Type Theory A Modern Perspective on Type Theory APPLIED LOGIC SERIES VOLUME 29 Managing Editor Dov M. Gabbay, Department of Computer Science, King s College, London, U.K. Co-Editor Jon Barwise Editorial Assistant

More information

CSCI-GA Scripting Languages

CSCI-GA Scripting Languages CSCI-GA.3033.003 Scripting Languages 12/02/2013 OCaml 1 Acknowledgement The material on these slides is based on notes provided by Dexter Kozen. 2 About OCaml A functional programming language All computation

More information

n λxy.x n y, [inc] [add] [mul] [exp] λn.λxy.x(nxy) λmn.m[inc]0 λmn.m([add]n)0 λmn.n([mul]m)1

n λxy.x n y, [inc] [add] [mul] [exp] λn.λxy.x(nxy) λmn.m[inc]0 λmn.m([add]n)0 λmn.n([mul]m)1 LAMBDA CALCULUS 1. Background λ-calculus is a formal system with a variety of applications in mathematics, logic, and computer science. It examines the concept of functions as processes, rather than the

More information

More Untyped Lambda Calculus & Simply Typed Lambda Calculus

More Untyped Lambda Calculus & Simply Typed Lambda Calculus Concepts in Programming Languages Recitation 6: More Untyped Lambda Calculus & Simply Typed Lambda Calculus Oded Padon & Mooly Sagiv (original slides by Kathleen Fisher, John Mitchell, Shachar Itzhaky,

More information

Lisp History. Lisp and Prolog Background. Lisp Use. Lisp Availability

Lisp History. Lisp and Prolog Background. Lisp Use. Lisp Availability Lisp and Prolog Background Thank you to Prof. Roosen-Runge and Prof. Gotshalks for the slides that I will be using throughout the course. Lisp History Lisp - invented (about 1958) by the logician and AI

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

1.3. Conditional expressions To express case distinctions like

1.3. Conditional expressions To express case distinctions like Introduction Much of the theory developed in the underlying course Logic II can be implemented in a proof assistant. In the present setting this is interesting, since we can then machine extract from a

More information

Typed Lambda Calculus

Typed Lambda Calculus Department of Linguistics Ohio State University Sept. 8, 2016 The Two Sides of A typed lambda calculus (TLC) can be viewed in two complementary ways: model-theoretically, as a system of notation for functions

More information

Presented By : Abhinav Aggarwal CSI-IDD, V th yr Indian Institute of Technology Roorkee. Joint work with: Prof. Padam Kumar

Presented By : Abhinav Aggarwal CSI-IDD, V th yr Indian Institute of Technology Roorkee. Joint work with: Prof. Padam Kumar Presented By : Abhinav Aggarwal CSI-IDD, V th yr Indian Institute of Technology Roorkee Joint work with: Prof. Padam Kumar A Seminar Presentation on Recursiveness, Computability and The Halting Problem

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

COSC252: Programming Languages: Semantic Specification. Jeremy Bolton, PhD Adjunct Professor

COSC252: Programming Languages: Semantic Specification. Jeremy Bolton, PhD Adjunct Professor COSC252: Programming Languages: Semantic Specification Jeremy Bolton, PhD Adjunct Professor Outline I. What happens after syntactic analysis (parsing)? II. Attribute Grammars: bridging the gap III. Semantic

More information

Losp for Predicate Calculus

Losp for Predicate Calculus Losp for Predicate Calculus William Bricken June 1985 Contents 1 Extension to Predicate Calculus 1 1.1 Representation of Terms....................... 1 1.2 The Theory of Equality.......................

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

Types, Categories & Logic

Types, Categories & Logic Preliminary program for a seminar on Types, Categories & Logic Hanno Becker, habecker@math.uni-bonn.de Overview. Type theories are formal calculi that allow for the study of aspects of functional programming,

More information