Semantic Subtyping. Alain Frisch (ENS Paris) Giuseppe Castagna (ENS Paris) Véronique Benzaken (LRI U Paris Sud)

Size: px
Start display at page:

Download "Semantic Subtyping. Alain Frisch (ENS Paris) Giuseppe Castagna (ENS Paris) Véronique Benzaken (LRI U Paris Sud)"

Transcription

1 Semantic Subtyping Alain Frisch (ENS Paris) Giuseppe Castagna (ENS Paris) Véronique Benzaken (LRI U Paris Sud) Semantic Subtyping - Groupe de travail BD LRI p.1/28

2 CDuce A functional language adapted to XML applications: Types are pervasives in Duce: Soundness of transformations Informative error messages Type-driven semantics, pattern matching Type-driven compilation and optimization This talk: theoretical foundation of Duce type system. Most of the technical difficulties in the subtyping relation, which is kept simple by using a semantic approach. Semantic Subtyping - Groupe de travail BD LRI p.2/28

3 Semantic and syntactic subtyping How to define a subtyping relation? Syntactic approach: a formal system (axioms,rules) Semantic approach: start with a denotational model of the language interpret types as subsets of the model define subtyping as inclusion of denotations derive a subtyping algorithm Semantic Subtyping - Groupe de travail BD LRI p.3/28

4 Advantages of semantic subtyping subtyping is complete w.r.t the intuitive interpretation when does not hold, it is possible to exhibit an element of the model in the interpretation of and not of ( error message) modularization of proofs: use the semantic interpretation, not the rules of the subtyping algorithm properties for free : transitivity of,... Whenever possible, avoid ad hoc rules, formulas and algorithms: derive them from computations. Semantic Subtyping - Groupe de travail BD LRI p.4/28

5 XDuce (H. Hosoya, B. Pierce, J. Vouillon) XDuce: a typed programming language for XML applications value = XML document (tree) type = regular tree language subtyping = inclusion of languages A powerful pattern-matching operation Type-driven semantics Recursive patterns to extract information in the middle of a document Exact propagation of the type from the matched expression to binding variables Semantic Subtyping - Groupe de travail BD LRI p.5/28

6 Semantic subtyping in XDuce Semantic subtyping: easy because no first class function, so typing of values does not depend on subtyping! Start from the typing judgment Interpretation Subtyping Semantic Subtyping - Groupe de travail BD LRI p.6/28

7 XDuce + higher-order Duce Integrate XDuce features to a general higher order functional language Extend XDuce semantic approach? But: typing of values now depends on subtyping! Classical semantic approach? Define an untyped denotational model But: semantics depends on typing! Semantic Subtyping - Groupe de travail BD LRI p.7/28

8 Circularities Type system PM on types Subtyping Typing values PM semantics Semantic Subtyping - Groupe de travail BD LRI p.8/28

9 Circularities Type system PM on types Subtyping Typing values PM semantics Model Semantic Subtyping - Groupe de travail BD LRI p.8/28

10 Circularities Type system PM on types Subtyping Typing values PM semantics Model Semantic Subtyping - Groupe de travail BD LRI p.8/28

11 Circularities Type system PM on types Subtyping Typing values PM semantics Model Semantic Subtyping - Groupe de travail BD LRI p.8/28

12 Types Semantic Subtyping - Groupe de travail BD LRI p.9/28

13 Type algebra Types: Constructors: basic, product, arrow types. Semantic Subtyping - Groupe de travail BD LRI p.10/28

14 Type algebra Types: Constructors: basic, product, arrow types. Arbitrary finite boolean combinations. Semantic Subtyping - Groupe de travail BD LRI p.10/28

15 Type algebra Types: Constructors: basic, product, arrow types. Arbitrary finite boolean combinations. Guarded recursive types. Semantic Subtyping - Groupe de travail BD LRI p.10/28

16 Subtyping and models by: We want to define : is subset of a structure For each type, prod fun with: basic prod must satisfy natural conditions: _ The interpretation function prod Semantic Subtyping - Groupe de travail BD LRI p.11/28

17 Model condition for arrows A condition on motivated by: Intuition: extensive view of functions (=binary relations) Derived from simple set-theoretic computations Makes the safety proof work The type system induces a model of values (Turns out to hold in the revelance logic B+; M. Dezani) Semantic Subtyping - Groupe de travail BD LRI p.12/28

18 Is there at least one model!? Yes, this one: basic It is universal (largest subtyping relation). For this model, we derive an algorithm to compute. Semantic Subtyping - Groupe de travail BD LRI p.13/28

19 The language Semantic Subtyping - Groupe de travail BD LRI p.14/28

20 The language: syntax variable abstraction application constant pair pattern matching... Semantic Subtyping - Groupe de travail BD LRI p.15/28

21 Type system Semantic Subtyping - Groupe de travail BD LRI p.16/28...

22 Type system with... Need it for subject reduction but can discard it for typechecking. Semantic Subtyping - Groupe de travail BD LRI p.16/28

23 Results Classical syntactical results, such as admissibility of conjunction rule and subsumption elimination. Subject reduction for a small step semantics. A new interpretation of types as sets of values: This is indeed a model. It induces the same subtyping relation as the bootstrap model. This holds because of overloaded functions! Semantic Subtyping - Groupe de travail BD LRI p.17/28

24 The circle is now complete ) ( Semantic Subtyping - Groupe de travail BD LRI p.18/28

25 Subtyping algorithm As any coinductive relation, the subtyping algorithm can be expressed in an abstract way through a notion of simulation. A simulation is a subset of all types closed under rules like: The largest simulation is exactly the set of empty types. This abstract presentation separates implementation issues (such as caching) and the theoretical study of the algorithm. Semantic Subtyping - Groupe de travail BD LRI p.19/28

26 Using set-theoretic semantics Simple set-theoretic facts yield a number of optimizations for the subtyping algorithm, avoiding exponential explosion in many cases. E.g.: whenever Semantic Subtyping - Groupe de travail BD LRI p.20/28

27 Patterns Semantic Subtyping - Groupe de travail BD LRI p.21/28

28 Patterns capture type constraint conjunction alternative pair constant recursive pattern Result of matching : (failure) or a substitution Var. Semantic Subtyping - Groupe de travail BD LRI p.22/28

29 Pattern-matching: static semantics The pattern accepts a type characterized by: If by: Thm: it exists + algorithm and Var, type of the result for characterized Thm: it exists + algorithm Semantic Subtyping - Groupe de travail BD LRI p.23/28

30 Type system: pattern matching ) ( Semantic Subtyping - Groupe de travail BD LRI p.24/28

31 Type system: pattern matching ) ( Exhaustivity checking : set of values matched by Semantic Subtyping - Groupe de travail BD LRI p.24/28

32 Type system: pattern matching ) ( Exhaustivity checking : set of values matched by Dispatching Semantic Subtyping - Groupe de travail BD LRI p.24/28

33 Type system: pattern matching ) ( Exhaustivity checking : set of values matched by Dispatching Matching : typing environment for variables bound in Semantic Subtyping - Groupe de travail BD LRI p.24/28

34 Type system: pattern matching ) ( Exhaustivity checking : set of values matched by Dispatching Matching : typing environment for variables bound in Result Discard useless branches Semantic Subtyping - Groupe de travail BD LRI p.24/28

35 Typing patterns: an example Lists à la Lisp (head,tail) + terminator. Consider the following pattern and types: : If Otherwise: Then: If : Semantic Subtyping - Groupe de travail BD LRI p.25/28

36 Pattern algorithms (1) Semantic Subtyping - Groupe de travail BD LRI p.26/28

37 Pattern algorithms (2) Var if Var Var if Var Var if Var Var if if if Semantic Subtyping - Groupe de travail BD LRI p.27/28

38 Compiling pattern matching Naive solution: backtracking. Less naive, but untractable: bottom-up tree automata. Adopted solution: hybrid top-down/bottom-up automata, which avoid backtracking, and take profit of static type information. Complex algorithm: set-theoretic semantics of types and patterns helps a lot here! Semantic Subtyping - Groupe de travail BD LRI p.28/28

Recognizing regular tree languages with static information

Recognizing regular tree languages with static information Recognizing regular tree languages with static information Alain Frisch (ENS Paris) PLAN-X 2004 p.1/22 Motivation Efficient compilation of patterns in XDuce/CDuce/... E.g.: type A = [ A* ] type B =

More information

REGULAR TREE LANGUAGE RECOGNITION WITH STATIC INFORMATION

REGULAR TREE LANGUAGE RECOGNITION WITH STATIC INFORMATION REGULAR TREE LANGUAGE RECOGNITION WITH STATIC INFORMATION Alain Frisch École Normale Supérieure Alain.Frisch@ens.fr Abstract This paper presents our compilation strategy to produce efficient code for pattern

More information

An update on XML types

An update on XML types An update on XML types Alain Frisch INRIA Rocquencourt (Cristal project) Links Meeting - Apr. 2005 Plan XML types 1 XML types 2 3 2/24 Plan XML types 1 XML types 2 3 3/24 Claim It is worth studying new

More information

Programming Languages for XML Ou Au delà des standards

Programming Languages for XML Ou Au delà des standards Programming Languages for XML Ou Au delà des standards Véronique Benzaken benzakenlri.fr LRI (UMR 823 CNRS) and Université de Paris Sud Introduction Information on the web What you are not able to do with

More information

Greedy regular expression matching

Greedy regular expression matching Greedy regular expression matching Alain Frisch (ENS Paris) Luca Cardelli (MSR Cambridge) PLAN-X 2004 p.1/16 The matching problem Problem = project the structure of a regular expression on a flat sequence.

More information

Semantic Subtyping for Objects and Classes

Semantic Subtyping for Objects and Classes Semantic Subtyping for Objects and Classes Ornela Dardha Daniele Gorla Daniele Varacca Abstract In this paper we propose an integration of structural subtyping with boolean connectives and semantic subtyping

More information

Type-based Optimization for Regular Patterns

Type-based Optimization for Regular Patterns Type-based Optimization for Regular Patterns Michael Y. Levin Benjamin C. Pierce Department of Computer and Information Science University of Pennsylvania {milevin,bcpierce}@cis.upenn.edu University of

More information

Subsumption. Principle of safe substitution

Subsumption. Principle of safe substitution Recap on Subtyping Subsumption Some types are better than others, in the sense that a value of one can always safely be used where a value of the other is expected. Which can be formalized as by introducing:

More information

CDuce. Véronique Benzaken, Giuseppe Castagna, Alain Frisch. PSD Workshop,

CDuce. Véronique Benzaken, Giuseppe Castagna, Alain Frisch. PSD Workshop, http://www.cduce.org/ PSD Workshop, 2004-02 Programming with XML Level 0: textual representation of XML documents AWK, sed, Perl Level 1: abstract view provided by a parser SAX, DOM Level 2: untyped XML-specific

More information

Formal Systems and their Applications

Formal Systems and their Applications Formal Systems and their Applications Dave Clarke (Dave.Clarke@cs.kuleuven.be) Acknowledgment: these slides are based in part on slides from Benjamin Pierce and Frank Piessens 1 Course Overview Introduction

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

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

Semantic Subtyping for Objects and Classes

Semantic Subtyping for Objects and Classes Semantic Subtyping for Objects and Classes Ornela Dardha 1 Daniele Gorla 2 Daniele Varacca 3 1 Dip. Scienze dell Informazione, Università di Bologna (Italy) 2 Dip. di Informatica, Sapienza Università di

More information

Copyright 2013 IFIP International Federation for Information Processing

Copyright 2013 IFIP International Federation for Information Processing Dardha, O., Gorla, D., and Varacca, D. (2013) Semantic Subtyping for Objects and Classes. In: Formal Techniques for Distributed Systems - Joint IFIP WG 6.1 International Conference, FMOODS/FORTE 2013,

More information

Semantic subtyping: challenges, perspectives, and open problems

Semantic subtyping: challenges, perspectives, and open problems In ICTCS 05, Lecture Notes in Computer Science,????:??-??, c Springer, 2005. Semantic subtyping: challenges, perspectives, and open problems Giuseppe Castagna CNRS, École Normale Supérieure de Paris, France

More information

A Typed Lambda Calculus for Input Sanitation

A Typed Lambda Calculus for Input Sanitation A Typed Lambda Calculus for Input Sanitation Nathan Fulton Carthage College nfulton@carthage.edu April 11, 2013 Abstract Programmers often wish to validate or sanitize user input. One common approach to

More information

Advances in Programming Languages

Advances in Programming Languages T O Y H Advances in Programming Languages APL17: XML processing with CDuce David Aspinall (see final slide for the credits and pointers to sources) School of Informatics The University of Edinburgh Friday

More information

Programming Languages Lecture 15: Recursive Types & Subtyping

Programming Languages Lecture 15: Recursive Types & Subtyping CSE 230: Winter 2008 Principles of Programming Languages Lecture 15: Recursive Types & Subtyping Ranjit Jhala UC San Diego News? Formalize first-order type systems Simple types (integers and booleans)

More information

Type Systems. Pierce Ch. 3, 8, 11, 15 CSE

Type Systems. Pierce Ch. 3, 8, 11, 15 CSE Type Systems Pierce Ch. 3, 8, 11, 15 CSE 6341 1 A Simple Language ::= true false if then else 0 succ pred iszero Simple untyped expressions Natural numbers encoded as succ succ

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

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic 3.4 Deduction and Evaluation: Tools 3.4.1 Conditional-Equational Logic The general definition of a formal specification from above was based on the existence of a precisely defined semantics for the syntax

More information

LTCS Report. Concept Descriptions with Set Constraints and Cardinality Constraints. Franz Baader. LTCS-Report 17-02

LTCS Report. Concept Descriptions with Set Constraints and Cardinality Constraints. Franz Baader. LTCS-Report 17-02 Technische Universität Dresden Institute for Theoretical Computer Science Chair for Automata Theory LTCS Report Concept Descriptions with Set Constraints and Cardinality Constraints Franz Baader LTCS-Report

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

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics via Syntax. f (4) = if define f (x) =2 x + 55. 1 Semantics via Syntax The specification of a programming language starts with its syntax. As every programmer knows, the syntax of a language comes in the shape of a variant of a BNF (Backus-Naur Form)

More information

Polymorphism and XDuce-style patterns

Polymorphism and XDuce-style patterns Polymorphism and XDuce-style patterns Jérôme Vouillon CNRS and Université Paris 7 Jerome.Vouillon@pps.jussieu.fr Abstract We present an extension of XDuce, a programming language dedicated to the processing

More information

Timed Automata: Semantics, Algorithms and Tools

Timed Automata: Semantics, Algorithms and Tools Timed Automata: Semantics, Algorithms and Tools Johan Bengtsson and Wang Yi Uppsala University Email: {johanb,yi}@it.uu.se Abstract. This chapter is to provide a tutorial and pointers to results and related

More information

Lecture Notes on Program Equivalence

Lecture Notes on Program Equivalence Lecture Notes on Program Equivalence 15-312: Foundations of Programming Languages Frank Pfenning Lecture 24 November 30, 2004 When are two programs equal? Without much reflection one might say that two

More information

Subtyping. Lecture 13 CS 565 3/27/06

Subtyping. Lecture 13 CS 565 3/27/06 Subtyping Lecture 13 CS 565 3/27/06 Polymorphism Different varieties of polymorphism: Parametric (ML) type variables are abstract, and used to encode the fact that the same term can be used in many different

More information

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 2. true / false ML can be compiled. 3. true / false FORTRAN can reasonably be considered

More information

Distributed Systems Programming (F21DS1) Formal Verification

Distributed Systems Programming (F21DS1) Formal Verification Distributed Systems Programming (F21DS1) Formal Verification Andrew Ireland Department of Computer Science School of Mathematical and Computer Sciences Heriot-Watt University Edinburgh Overview Focus on

More information

Formal languages and computation models

Formal languages and computation models Formal languages and computation models Guy Perrier Bibliography John E. Hopcroft, Rajeev Motwani, Jeffrey D. Ullman - Introduction to Automata Theory, Languages, and Computation - Addison Wesley, 2006.

More information

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Foundations of AI 9. Predicate Logic Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller 09/1 Contents Motivation

More information

Lecture 2. Decidability and Verification

Lecture 2. Decidability and Verification Lecture 2. Decidability and Verification model temporal property Model Checker yes error-trace Advantages Automated formal verification, Effective debugging tool Moderate industrial success In-house groups:

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Fall 2016 Lecture 7a Andrew Tolmach Portland State University 1994-2016 Values and Types We divide the universe of values according to types A type is a set of values and a

More information

Dependent Object Types - A foundation for Scala s type system

Dependent Object Types - A foundation for Scala s type system Dependent Object Types - A foundation for Scala s type system Draft of September 9, 2012 Do Not Distrubute Martin Odersky, Geoffrey Alan Washburn EPFL Abstract. 1 Introduction This paper presents a proposal

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

COS 320. Compiling Techniques

COS 320. Compiling Techniques Topic 5: Types COS 320 Compiling Techniques Princeton University Spring 2016 Lennart Beringer 1 Types: potential benefits (I) 2 For programmers: help to eliminate common programming mistakes, particularly

More information

A Coalgebraic Foundation for Coinductive Union Types

A Coalgebraic Foundation for Coinductive Union Types A Coalgebraic Foundation for Coinductive Union Types M. Bonsangue 1,2, J. Rot 1,2,, D. Ancona 3, F. de Boer 2,1, and J. Rutten 2,4 1 LIACS Leiden University 2 Formal Methods Centrum Wiskunde en Informatica

More information

Lecture Notes on Aggregate Data Structures

Lecture Notes on Aggregate Data Structures Lecture Notes on Aggregate Data Structures 15-312: Foundations of Programming Languages Frank Pfenning Lecture 8 September 23, 2004 In this lecture we discuss various language extensions which make MinML

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

Type Systems. Today. 1. Organizational Matters. 1. Organizational Matters. Lecture 1 Oct. 20th, 2004 Sebastian Maneth. 1. Organizational Matters

Type Systems. Today. 1. Organizational Matters. 1. Organizational Matters. Lecture 1 Oct. 20th, 2004 Sebastian Maneth. 1. Organizational Matters Today Type Systems 1. Organizational Matters 2. What is this course about? 3. Where do types come from? 4. Def. of the small language Expr. Its syntax and semantics. Lecture 1 Oct. 20th, 2004 Sebastian

More information

Formal Languages and Compilers Lecture IV: Regular Languages and Finite. Finite Automata

Formal Languages and Compilers Lecture IV: Regular Languages and Finite. Finite Automata Formal Languages and Compilers Lecture IV: Regular Languages and Finite Automata Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/

More information

Operational Semantics. One-Slide Summary. Lecture Outline

Operational Semantics. One-Slide Summary. Lecture Outline Operational Semantics #1 One-Slide Summary Operational semantics are a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:

More information

Recursive Types and Subtyping

Recursive Types and Subtyping Recursive Types and Subtyping #1 One-Slide Summary Recursive types (e.g., list) make the typed lambda calculus as powerful as the untyped lambda calculus. If is a subtype of then any expression of type

More information

Principles of Program Analysis: A Sampler of Approaches

Principles of Program Analysis: A Sampler of Approaches Principles of Program Analysis: A Sampler of Approaches Transparencies based on Chapter 1 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis Springer Verlag

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 7b Andrew Tolmach Portland State University 1994-2017 Values and Types We divide the universe of values according to types A type is a set of values and

More information

Variables. Substitution

Variables. Substitution Variables Elements of Programming Languages Lecture 4: Variables, binding and substitution James Cheney University of Edinburgh October 6, 2015 A variable is a symbol that can stand for another expression.

More information

MIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology

MIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology MIT 6.035 Specifying Languages with Regular essions and Context-Free Grammars Martin Rinard Massachusetts Institute of Technology Language Definition Problem How to precisely define language Layered structure

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

Verification Overview Testing Theory and Principles Testing in Practice. Verification. Miaoqing Huang University of Arkansas 1 / 80

Verification Overview Testing Theory and Principles Testing in Practice. Verification. Miaoqing Huang University of Arkansas 1 / 80 1 / 80 Verification Miaoqing Huang University of Arkansas Outline 1 Verification Overview 2 Testing Theory and Principles Theoretical Foundations of Testing Empirical Testing Principles 3 Testing in Practice

More information

MIT Specifying Languages with Regular Expressions and Context-Free Grammars

MIT Specifying Languages with Regular Expressions and Context-Free Grammars MIT 6.035 Specifying Languages with Regular essions and Context-Free Grammars Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Language Definition Problem How to precisely

More information

Harvard School of Engineering and Applied Sciences Computer Science 152

Harvard School of Engineering and Applied Sciences Computer Science 152 Harvard School of Engineering and Applied Sciences Computer Science 152 Lecture 17 Tuesday, March 30, 2010 1 Polymorph means many forms. Polymorphism is the ability of code to be used on values of different

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

CSE-321 Programming Languages 2014 Final

CSE-321 Programming Languages 2014 Final Name: Hemos ID: CSE-321 Programming Languages 2014 Final Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Total Score Max 15 12 14 14 30 15 100 There are six problems on 12 pages in this exam.

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

PROPAGATION-BASED CONSTRAINT SOLVER IN IMS Igor Ol. Blynov Kherson State University

PROPAGATION-BASED CONSTRAINT SOLVER IN IMS Igor Ol. Blynov Kherson State University Інформаційні технології в освіті UDC 0044:37 PROPAGATION-BASED CONSTRAINT SOLVER IN IMS Igor Ol Blynov Kherson State University Abstracts Article compiling the main ideas of creating propagation-based

More information

From Tableaux to Automata for Description Logics

From Tableaux to Automata for Description Logics Fundamenta Informaticae XX (2003) 1 33 1 IOS Press From Tableaux to Automata for Description Logics Franz Baader, Jan Hladik, and Carsten Lutz Theoretical Computer Science, TU Dresden, D-01062 Dresden,

More information

Automatic synthesis of switching controllers for linear hybrid systems: Reachability control

Automatic synthesis of switching controllers for linear hybrid systems: Reachability control Automatic synthesis of switching controllers for linear hybrid systems: Reachability control Massimo Benerecetti and Marco Faella Università di Napoli Federico II, Italy Abstract. We consider the problem

More information

Propositional Logic. Part I

Propositional Logic. Part I Part I Propositional Logic 1 Classical Logic and the Material Conditional 1.1 Introduction 1.1.1 The first purpose of this chapter is to review classical propositional logic, including semantic tableaux.

More information

Lecture 1: Conjunctive Queries

Lecture 1: Conjunctive Queries CS 784: Foundations of Data Management Spring 2017 Instructor: Paris Koutris Lecture 1: Conjunctive Queries A database schema R is a set of relations: we will typically use the symbols R, S, T,... to denote

More information

Polymorphic Functions with Set-Theoretic Types

Polymorphic Functions with Set-Theoretic Types Polymorphic Functions with Set-Theoretic Types Part 1: Syntax, Semantics, and Evaluation Giuseppe Castagna 1 Kim Nguyễn 2 Zhiwu Xu 1,3 Hyeonseung Im 2 Sergueï Lenglet 4 Luca Padovani 5 1 CNRS, PPS, Univ

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

A Core Calculus for XQuery 3.0

A Core Calculus for XQuery 3.0 A Core Calculus for XQuery 3.0 Giuseppe Castagna, Hyeonseung Im, Kim Nguyn, Véronique Benzaken To cite this version: Giuseppe Castagna, Hyeonseung Im, Kim Nguyn, Véronique Benzaken. A Core Calculus for

More information

Computing least common subsumers for FLE +

Computing least common subsumers for FLE + Computing least common subsumers for FLE + Sebastian Brandt and Anni-Yasmin Turhan Theoretical Computer Science, TU Dresden, Germany Email: {brandt, turhan}@tcs.inf.tu-dresden.de Abstract Transitive roles

More information

Type Based XML Projection

Type Based XML Projection 1/90, Type Based XML Projection VLDB 2006, Seoul, Korea Véronique Benzaken Dario Colazzo Giuseppe Castagna Kim Nguy ên : Équipe Bases de Données, LRI, Université Paris-Sud 11, Orsay, France : Équipe Langage,

More information

Constrained Types and their Expressiveness

Constrained Types and their Expressiveness Constrained Types and their Expressiveness JENS PALSBERG Massachusetts Institute of Technology and SCOTT SMITH Johns Hopkins University A constrained type consists of both a standard type and a constraint

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

Fundamental Concepts. Chapter 1

Fundamental Concepts. Chapter 1 Chapter 1 Fundamental Concepts This book is about the mathematical foundations of programming, with a special attention on computing with infinite objects. How can mathematics help in programming? There

More information

A Modality for Recursion

A Modality for Recursion A Modality for Recursion (Technical Report) March 31, 2001 Hiroshi Nakano Ryukoku University, Japan nakano@mathryukokuacjp Abstract We propose a modal logic that enables us to handle self-referential formulae,

More information

Lecture 7. Search. Search. Foundations of Constraint Programming

Lecture 7. Search. Search. Foundations of Constraint Programming Lecture 7 1 Outline Introduce search trees Discuss various types of labeling trees, in particular trees for - forward checking - partial look ahead - maintaining arc consistency (MAC) Discuss various search

More information

15.4 Longest common subsequence

15.4 Longest common subsequence 15.4 Longest common subsequence Biological applications often need to compare the DNA of two (or more) different organisms A strand of DNA consists of a string of molecules called bases, where the possible

More information

Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m.

Note that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m. CS 6110 S18 Lecture 8 Structural Operational Semantics and IMP Today we introduce a very simple imperative language, IMP, along with two systems of rules for evaluation called small-step and big-step semantics.

More information

Towards a Memory-Efficient Knapsack DP Algorithm

Towards a Memory-Efficient Knapsack DP Algorithm Towards a Memory-Efficient Knapsack DP Algorithm Sanjay Rajopadhye The 0/1 knapsack problem (0/1KP) is a classic problem that arises in computer science. The Wikipedia entry http://en.wikipedia.org/wiki/knapsack_problem

More information

The design of a programming language for provably correct programs: success and failure

The design of a programming language for provably correct programs: success and failure The design of a programming language for provably correct programs: success and failure Don Sannella Laboratory for Foundations of Computer Science School of Informatics, University of Edinburgh http://homepages.inf.ed.ac.uk/dts

More information

EXTENSIONS OF FIRST ORDER LOGIC

EXTENSIONS OF FIRST ORDER LOGIC EXTENSIONS OF FIRST ORDER LOGIC Maria Manzano University of Barcelona CAMBRIDGE UNIVERSITY PRESS Table of contents PREFACE xv CHAPTER I: STANDARD SECOND ORDER LOGIC. 1 1.- Introduction. 1 1.1. General

More information

Operational Semantics

Operational Semantics Operational Semantics #1 One-Slide Summary Operational semantics is a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:

More information

Types for References, Exceptions and Continuations. Review of Subtyping. Γ e:τ τ <:σ Γ e:σ. Annoucements. How s the midterm going?

Types for References, Exceptions and Continuations. Review of Subtyping. Γ e:τ τ <:σ Γ e:σ. Annoucements. How s the midterm going? Types for References, Exceptions and Continuations Annoucements How s the midterm going? Meeting 21, CSCI 5535, Spring 2009 2 One-Slide Summary Review of Subtyping If τ is a subtype of σ then any expression

More information

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages Lesson 14 Type Checking Collaboration and Management Dana Fisman www.cs.bgu.ac.il/~ppl172 1 Type Checking We return to the issue of type safety we discussed informally,

More information

Mutable References. Chapter 1

Mutable References. Chapter 1 Chapter 1 Mutable References In the (typed or untyped) λ-calculus, or in pure functional languages, a variable is immutable in that once bound to a value as the result of a substitution, its contents never

More information

3.7 Denotational Semantics

3.7 Denotational Semantics 3.7 Denotational Semantics Denotational semantics, also known as fixed-point semantics, associates to each programming language construct a well-defined and rigorously understood mathematical object. These

More information

1 Introduction. 3 Syntax

1 Introduction. 3 Syntax CS 6110 S18 Lecture 19 Typed λ-calculus 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic semantics,

More information

Fiona A Tool to Analyze Interacting Open Nets

Fiona A Tool to Analyze Interacting Open Nets Fiona A Tool to Analyze Interacting Open Nets Peter Massuthe and Daniela Weinberg Humboldt Universität zu Berlin, Institut für Informatik Unter den Linden 6, 10099 Berlin, Germany {massuthe,weinberg}@informatik.hu-berlin.de

More information

Semantic Subtyping for Objects and Classes

Semantic Subtyping for Objects and Classes Semantic Subtyping for Objects and Classes Ornela Dardha 1, Daniele Gorla 2, and Daniele Varacca 3 1 INRIA Focus Team / Università di Bologna, Italy 2 Dip. di Informatica, Sapienza Università di Roma,

More information

Multi Domain Logic and its Applications to SAT

Multi Domain Logic and its Applications to SAT Multi Domain Logic and its Applications to SAT Tudor Jebelean RISC Linz, Austria Tudor.Jebelean@risc.uni-linz.ac.at Gábor Kusper Eszterházy Károly College gkusper@aries.ektf.hu Abstract We describe a new

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 14 Tuesday, March 24, 2015 1 Parametric polymorphism Polymorph means many forms. Polymorphism is the ability of

More information

Critical Analysis of Computer Science Methodology: Theory

Critical Analysis of Computer Science Methodology: Theory Critical Analysis of Computer Science Methodology: Theory Björn Lisper Dept. of Computer Science and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ March 3, 2004 Critical

More information

nfn2dlp: A Normal Form Nested Programs Compiler

nfn2dlp: A Normal Form Nested Programs Compiler nfn2dlp: A Normal Form Nested Programs Compiler Annamaria Bria, Wolfgang Faber, and Nicola Leone Department of Mathematics, University of Calabria, 87036 Rende (CS), Italy {a.bria,faber,leone}@mat.unical.it

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

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

Derivation for the Necessity of Recursive Types and its Basic Usage

Derivation for the Necessity of Recursive Types and its Basic Usage Derivation for the Necessity of Recursive Types and its Basic Usage Philipp Koster Supervised by Prof. Dr. Farhad D. Mehta Seminar AT 2016 1 Abstract This paper derives the need for recursive types by

More information

Typed Lambda Calculus. Chapter 9 Benjamin Pierce Types and Programming Languages

Typed Lambda Calculus. Chapter 9 Benjamin Pierce Types and Programming Languages Typed Lambda Calculus Chapter 9 Benjamin Pierce Types and Programming Languages t ::= x x. t t t Call-by-value small step perational Semantics terms variable v ::= values abstraction x. t abstraction values

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

Overview. A normal-order language. Strictness. Recursion. Infinite data structures. Direct denotational semantics. Transition semantics

Overview. A normal-order language. Strictness. Recursion. Infinite data structures. Direct denotational semantics. Transition semantics Overview A normal-order language Strictness Recursion Infinite data structures Direct denotational semantics Transition semantics Lazy (call-by-need) evaluation and its semantics A Normal-Order Language

More information

Verifying pattern matching with guards in Scala

Verifying pattern matching with guards in Scala EPFL SAV 07 June 21, 2007 version 1.1 Outline Introduction Scala reasoning about pattern matching status in Scala motivation project overview general idea formalization of concepts axioms patterns miscellaneous

More information

Lambda Calculus. Type Systems, Lectures 3. Jevgeni Kabanov Tartu,

Lambda Calculus. Type Systems, Lectures 3. Jevgeni Kabanov Tartu, Lambda Calculus Type Systems, Lectures 3 Jevgeni Kabanov Tartu, 13.02.2006 PREVIOUSLY ON TYPE SYSTEMS Arithmetical expressions and Booleans Evaluation semantics Normal forms & Values Getting stuck Safety

More information

1. Lexical Analysis Phase

1. Lexical Analysis Phase 1. Lexical Analysis Phase The purpose of the lexical analyzer is to read the source program, one character at time, and to translate it into a sequence of primitive units called tokens. Keywords, identifiers,

More information

Discrete Mathematics Lecture 4. Harper Langston New York University

Discrete Mathematics Lecture 4. Harper Langston New York University Discrete Mathematics Lecture 4 Harper Langston New York University Sequences Sequence is a set of (usually infinite number of) ordered elements: a 1, a 2,, a n, Each individual element a k is called a

More information

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: P R O B L E M S Finite Autom ata. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which: a) Are a multiple of three in length. b) End with the string

More information

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages www.cs.bgu.ac.il/~ppl172 Collaboration and Management Dana Fisman Lesson 2 - Types with TypeScript 1 Types What are types in programming languages? What types are you

More information

Recursive Types and Subtyping

Recursive Types and Subtyping Recursive Types and Subtyping #1 One-Slide Summary Recall: Recursive types (e.g., τ list) make the typed lambda calculus as powerful as the untyped lambda calculus. If τ is a subtype of σ then any expression

More information