Type raising, continuations, and classical logic

Similar documents
Extracting the Range of cps from Affine Typing

A Typed Calculus Supporting Shallow Embeddings of Abstract Machines

Syntax-semantics interface and the non-trivial computation of meaning

Computational Linguistics: Syntax-Semantics Interface

λ calculus Function application Untyped λ-calculus - Basic Idea Terms, Variables, Syntax β reduction Advanced Formal Methods

Chapter 5: The Untyped Lambda Calculus

Individuals, equivalences and quotients. in type theoretical semantics.

One of a number of approaches to a mathematical challenge at the time (1930): Constructibility

1 Scope, Bound and Free Occurrences, Closed Terms

Type Systems Winter Semester 2006

Pure Lambda Calculus. Lecture 17

Lexicografie computationala Feb., 2012

CS 4110 Programming Languages & Logics. Lecture 17 Programming in the λ-calculus

11/6/17. Outline. FP Foundations, Scheme. Imperative Languages. Functional Programming. Mathematical Foundations. Mathematical Foundations

Proofs-Programs correspondance and Security

Introduction to Lambda Calculus. Lecture 5 CS 565 1/24/08

Introduction to the Lambda Calculus

Introduction to Lambda Calculus. Lecture 7 CS /08/09

Delimited Continuations, Applicative Functors and Natural Language Semantics

Lecture Notes on Data Representation

Lambda Calculus. Lecture 4 CS /26/10

Thunks (continued) Olivier Danvy, John Hatcli. Department of Computing and Information Sciences. Kansas State University. Manhattan, Kansas 66506, USA

COMPUTATIONAL SEMANTICS WITH FUNCTIONAL PROGRAMMING JAN VAN EIJCK AND CHRISTINA UNGER. lg Cambridge UNIVERSITY PRESS

Introduction to Semantics. Expanding Our Formalism, Part 2 1

INTENSIONAL LOGIC TRANSLATION FOR QUANTITATIVE NATURAL LANGUAGE SENTENCES

Introduction to the Lambda Calculus. Chris Lomont

CS 6110 S14 Lecture 1 Introduction 24 January 2014

Fundamentals and lambda calculus

Introductory Example

Semantics and Generative Grammar. Expanding Our Formalism, Part 2 1. These more complex functions are very awkward to write in our current notation

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

Lecture slides & distribution files:

LING 130: Quantified Noun Phrases

4.8 Dependent Types 97

Lecture 7. Introduction to Function-Argument Structure and Lambdas. 1. Function-argument structure in natural language

Functional Languages and Higher-Order Functions

5. Introduction to the Lambda Calculus. Oscar Nierstrasz

CIS 500 Software Foundations Fall September 25

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

Introductory logic and sets for Computer scientists

Idioms are oblivious, arrows are meticulous, monads are promiscuous

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

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

Concepts of programming languages

Typed Lambda Calculus for Syntacticians

arxiv: v2 [cs.ai] 18 Sep 2013

LOGIC AND DISCRETE MATHEMATICS

The duality of construction

Computational Linguistics: Syntax-Semantics

Less naive type theory

Type-theoretical natural-language semantics: on the system F for meaning assembly. Types 2013

Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description)

Solving Natural Language Math Problems

The Lambda Calculus. 27 September. Fall Software Foundations CIS 500. The lambda-calculus. Announcements

CIS 500 Software Foundations Fall December 4

Propositional Logic Formal Syntax and Semantics. Computability and Logic

The Arrow Calculus (Functional Pearl)

Denotational Semantics of a Simple Imperative Language Using Intensional Logic

the application rule M : x:a: B N : A M N : (x:a: B) N and the reduction rule (x: A: B) N! Bfx := Ng. Their algorithm is not fully satisfactory in the

Token-Passing Nets: Call-by-Need for Free

Logic and Natural Language Semantics: Formal Semantics

A Type-Theoretic Foundation of Continuations and Prompts

Lambda Calculus. Variables and Functions. cs3723 1

Chapter 2 The Language PCF

Evaluation of Predicate Calculus By Arve Meisingset, retired research scientist from Telenor Research Oslo Norway

Homework. Lecture 7: Parsers & Lambda Calculus. Rewrite Grammar. Problems

Foundations. Yu Zhang. Acknowledgement: modified from Stanford CS242

Answer Type Polymorphism in Call-by-name Continuation Passing

9/23/2014. Why study? Lambda calculus. Church Rosser theorem Completeness of Lambda Calculus: Turing Complete

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

Recursive Definitions, Fixed Points and the Combinator

CS152: Programming Languages. Lecture 7 Lambda Calculus. Dan Grossman Spring 2011

Logic as a framework for NL semantics. Outline. Syntax of FOL [1] Semantic Theory Type Theory

COMP 1130 Lambda Calculus. based on slides by Jeff Foster, U Maryland

Automata Theory for Reasoning about Actions

Programming Language Concepts: Lecture 19

Proseminar on Semantic Theory Fall 2013 Ling 720 An Algebraic Perspective on the Syntax of First Order Logic (Without Quantification) 1

Interpretations of Classical Logic Using λ-calculus. Freddie Agestam

CSCI B522 Lecture 11 Naming and Scope 8 Oct, 2009

Organization of Programming Languages CS3200/5200N. Lecture 11

Functional Programming and λ Calculus. Amey Karkare Dept of CSE, IIT Kanpur

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

Rule Formats for Nominal Modal Transition Systems

Whereweare. CS-XXX: Graduate Programming Languages. Lecture 7 Lambda Calculus. Adding data structures. Data + Code. What about functions

Introduction to lambda calculus Part 3

The Truth about Types. Bartosz Milewski

Type Inference with Recursive Type Equations

Nonmonotonic Databases and Epistemic Queries*

Substitution in Structural Operational Semantics and value-passing process calculi

CSC 501 Semantics of Programming Languages

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

An Implementation of the Language Lambda Prolog Organized around Higher-Order Pattern Unification

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

Typed Lambda Calculus

The Essence of Compiling with Continuations

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

Calculus of Inductive Constructions

What if current foundations of mathematics are inconsistent? Vladimir Voevodsky September 25, 2010

VU Semantik von Programmiersprachen

The Untyped Lambda Calculus

Transcription:

Type raising, continuations, and classical logic Philippe de Groote Inria-Lorraine Abstract. There is a striking analogy between type raising, as introduced by Montague (973), and the notion of continuation that has been developped in programming language theory in order to give compositional semantics to control operators (Stratchey and Wadsworth, 974). In fact, this analogy is such that it is possible to see Montague s semantics as a continuation based semantics. On the other hand, the notion of continuation allows classical logic to be given a Curry-Howard interpretation (Griffin 99). In particular, the double negation law ((A ) ) A is provided with a computational content, which may be used to give a type logical interpretation of type lowering. Putting the pieces of the picture together, it is possible to use classical extensions of the λ-calculus in order to express the semantic components of the lexical entries of Morrill s (994) type logical grammars. This solution offers the advantage of not burdening the syntax by enforcing type raising to the worst case. Type raising and continuations Montague (973) introduced type raising as a way of providing a compositional semantics to constructs that may give rise to scope ambiguities. Such constructs (typically, quantifiers) have semantic scopes that may be wider than their apparent syntactic scopes. Around the same time, computer scientists were trying to provide a compositional semantics to full jumps (i.e., goto statements), which led to the discovery of continuations (Stratchey and Wadsworth, 974). Both problems are similar, and both solutions present striking similitudes. Montague s type raising is based on Leibniz s principle, which consists of identifying an entity with the set of its properties. Consequently, the type of entities e is replaced by (e t) t, where t is the type of propositions. In programming language theory, a continuation semantics (as opposed to a direct semantics) consists in providing the semantic function with the continuation of the program as an explicit parameter. Let P be a program, let [[ ]] be the semantic function, and let s be some initial state. If we consider programs as state transformers, a direct semantics is such that [[P ]] s State. On the other hand, a continuation semantics gives [[P ]] s (State State) State. In fact, in both cases (type raising and continuation semantics), a type A is replaced by a type (A O) O, where O is the type of observable entities or facts. 2 Negative translations and classical logic In the realm of the λ-calculus, the notion of continuation gave rise to the so-called CPS-transformations (Plotkin 975). These are continuation-based syntactic transformations of the λ-terms that allow given evaluation strategies (typically, call-byname or call-by-value) to be simulated.

For instance, Plotkin s call-by-value CPS-transformation is as follows: c = λk. k c; x = λk. k x; λx. M = λk. k (λx. M); M N = λk. M (λm. N (λn. m n k)) Now, compare the following naive type logical grammar, where the lexical items are assigned a direct interpretation: John j : NP Mary m : NP loves λx. λy. love y x : (NP \ S) / NP together with the grammar, where the lexical items are assigned a Montague-like interpretation: John λk. k j : NP Mary λk. k m : NP loves λf. λg. f (λx. g (λy. love y x)) : (NP \ S) / NP Again, the analogy between continuation and type raising is striking. The Montaguelike interpretation may almost be seen as the call-by-value CPS-transform of the direct interpretation. This opens a new line of research that has been advocated in Barker s recent work (2, 2). When applying a CPS-transformation to a typed λ-term, it induced another transformation at the type level (Meyer and Wand, 985). For instance, the above CPS-transformation induces the following type transformation: α = (α ), where: a = a, for a atomic; (α β) = α β. Griffin (99) observed that these type transformations amount to double negative translations of classical logic into minimalist logic, and that it allows classical logic to be provided with a formulae-as-type interpretation. In this setting, the double negation law ((A ) ) A, which corresponds to type lowering, is given a computational content by considering the absurd type to be the type of observable entities (this is radically different from the usual interpretation of as the empty type). 3 The λµ-calculus Griffin s discovery gave rise to several extensions of the λ-calculus, which aim at adapting the Curry-Howard isomorphism to the case of classical logic. The λµcalculus (Parigot 992) is such a system. The λµ-calculus is a strict extension of the λ-calculus. Its syntax is provided with a second alphabet of variables (α, β, γ,... called the µ-variables), and two additional constructs: µ-abatraction (µα. t), and naming (α t). These constructs obey the following typing rules: Besides β-reduction: α : A α t : t : A [α : A] t : µα. t : A

(λx. t) t t[x := u] a notion of µ-reduction is defined: (µ) (µα. u) v µβ. u[α t i := β (t i v)] where u[α t i := β (t i v)] stands for the term u where each subterm of the form α t i has been replaced by β (t i v). It corresponds to the following proof-theoretic reduction: α : (A B) α t i : u : µα. u : A B t i : A B (µα. u) v : B v : A β : B t i : A B t i v : B β (t i v) : u[α t i := β (t i v)] : µβ. u[α t i := β (t i v)] : B v : A As well-known, classical logic is not naturally confluent. Consequently, there exist variants of the λµ-calculus that do not satisfy the Church-Rosser property (Parigot 2). This is the case if we also consider the symmetric of the µ-reduction rule: (µ ) v (µα. u) µβ. u[α t i := β (v t i )] Finally, for the purpose of the example given in the next section, we also add the following simplification rules: µα. u u[α t i := t i ] which may be applied only to terms of type. 4 Semantic recipes as λµ-terms Dealing with a calculus that do not satisfy the Church-Rosser property is not a defect in the case of natural language semantics. Indeed, the fact that a same term may have several different normal forms allows one to deal with semantic ambiguities. If we consider the sentential category S (or, semantically, Montague s type t) to be our domain of observable facts, the following typing judgement is derivable: Person : e t x : e α : e t x : e (Person x) : t (α x) : t (Person x) (α x) : t x.(person x) (α x) : t µα. x.(person x) (α x) : e

This allows the following type logical lexical entries to be defined: everybody µα. x.(person x) (α x) : NP somebody µα. x.(person x) (α x) : NP loves λx. λy. love y x : (NP \ S) / NP Then, the sentence everybody loves somebody has only one parsing, to which is associated the following semantic reading: (λx. λy. love y x) (µα. x.(person x) (α x)) (µα. x.(person x) (α x)). This λµ-term may be considered as an underspecified representation. Indeed, its possible reductions yield two different normal forms: (λx. λy. love y x) (µα. x.(person x) (α x)) (µα. x.(person x) (α x)) (λy. love y (µα. x.(person x) (α x))) (µα. x.(person x) (α x)) love (µα. x.(person x) (α x)) (µα. x.(person x) (α x)) (µβ. x.(person x) (β (love x))) (µα. x.(person x) (α x)) (µ ) µβ. x.(person x) (β (love x (µα. y.(person y) (α y)))) (µ) x.(person x) (love x (µα. y.(person y) (α y))) x.(person x) (µα. y.(person y) (α (love x y))) (µ ) x.(person x) ( y.(person y) (love x y)) (λx. λy. love y x) (µα. x.(person x) (α x)) (µα. x.(person x) (α x)) (λy. love y (µα. x.(person x) (α x))) (µα. x.(person x) (α x)) love (µα. x.(person x) (α x)) (µα. x.(person x) (α x)) (µβ. x.(person x) (β (love x))) (µα. x.(person x) (α x)) (µ ) µα. y.(person y) (α ((µβ. x.(person x) (β (love x))) y)) (µ ) y.(person y) ((µβ. x.(person x) (β (love x))) y) y.(person y) (µβ. x.(person x) (β (love x y))) (µ) y.(person y) ( x.(person x) (love x y)) These correspond to subject and object wide scope readings, respectively. 5 conclusions We have argued that Montague s type raising is a particular case of continuation. Consequently, continuation based formalisms, which have been developped in the context of programming language theory, may be used to deal with the sort of semantic ambiguities for which Montague invented type raising. Parigot s λµ-calculus is such a formalism, and we have shown how it may be used to cope with quantifier scope ambiguities. We claim that the λµ-calculus is particularly suitable for expressing compositional semantics of natural languages. For instance, it allows Cooper s (983) storage to be given a type logical foundation. In fact, it allows a lot of dynamic constructs to be defined, which is of particular interest for discourse representation.

references Barker, C. (2) Continuations and the nature of quantification working paper, submitted for publication. Barker, C. (2) Introducing Continuations. In R. Hastings, B. Jackson, and Z. Zvolenszky, editors, Proceedings of SALT, CLC Publications, Ithaca, New York. Cooper, R. (983). Quantification and Syntactic Theory. Dordrecht: Reidel. Griffin, T. G. (99). A formulae-as-types notion of control. In Conference record of the seventeenth annual ACM symposium on Principles of Programming Languages, pages 47 58. Meyer, A. and Wand, M. (985). Continuation semantics in typed lambda-calculi (summary). In R. Parikh, editor, Logics of Programs, volume 93 of Lecture Notes in Computer Science, pages 29 224. Spinger Verlag. Montague, R. (973). The proper treatment of quantification in ordinary english. In J. Hintikka, J. Moravcsik, and P. Suppes, editors, Approaches to natural language: proceedings of the 97 Stanford workshop on Grammar and Semantics, Dordrecht, Reidel. Reprinted: Montague, (974, pages 247 27). Montague, R. (974). Formal Philosophy: selected papers of Richard Montague, edited and with an introduction by Richmond Thomason. Yale University Press. Morrill, G. (994). Type Logical Grammar: Categorial Logic of Signs. Kluwer Academic Publishers, Dordrecht. Parigot, M. (992). λµ-calculus: an algorithmic interpretation of classical natural deduction. In A. Voronkov, editor, Proceedings of the International Conference on Logic Programming and Automated Reasoning, volume 624 of Lecture Notes in Artificial Intelligence, pages 9 2. Springer Verlag. Parigot, M. (2). On the computational interpretation of negation. In P.G. Clote and H. Schwichtenberg, editors, Computer Science Logic, volume 862 of Lecture Notes in Computer Science, Springer Verlag. Plotkin, G. D. (975). Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science, :25 59. Stratchey, C. and Wadsworth, C. (974). Continuations a mathematical semantics for handling full jumps. Technical Report PRG-, Oxford University, Computing Laboratory.