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

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

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

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

Applicative Abstract Categorial Grammars

LING 130: Quantified Noun Phrases

Functional Programming. Pure Functional Languages

Computational Linguistics: Syntax-Semantics Interface

arxiv: v2 [cs.ai] 18 Sep 2013

F08: Intro to Composition

Type raising, continuations, and classical logic

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

Typed Lambda Calculus for Syntacticians

Parsing. Zhenjiang Hu. May 31, June 7, June 14, All Right Reserved. National Institute of Informatics

Delimited Continuations, Applicative Functors and Natural Language Semantics

Fundamentals and lambda calculus. Deian Stefan (adopted from my & Edward Yang s CSE242 slides)

Typed Lambda Calculus

Functional Programming. Pure Functional Languages

Functional Programming. Big Picture. Design of Programming Languages

Programming Languages Third Edition

Semantics of programming languages

Languages and Compilers

X-KIF New Knowledge Modeling Language

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

Encryption as an Abstract Datatype:

Computational Linguistics: Syntax-Semantics

Coreference without Discourse Referents

Denotational Semantics. Domain Theory

Logic and Natural Language Semantics: Formal Semantics

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

Semantics and Pragmatics of NLP

Contents. Chapter 1 SPECIFYING SYNTAX 1

INTENSIONAL LOGIC TRANSLATION FOR QUANTITATIVE NATURAL LANGUAGE SENTENCES

Introduction to lambda calculus Part 3

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

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

Optional Arguments in Abstract Categorial Grammar

Semantics and Pragmatics of NLP Propositional Logic, Predicates and Functions

Introduction to Scheme

Semantics of programming languages

Lambda: the ultimate syntax-semantics interface

CS 6110 S14 Lecture 1 Introduction 24 January 2014

A Functional Evaluation Model

Lexicografie computationala Feb., 2012

An Inverse Lambda Calculus Algorithm. For Natural Language Processing. Marcos Alvarez Gonzalez

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

Fundamentals and lambda calculus

Formal Systems and their Applications

Stop coding Pascal. Saturday, April 6, 13

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.

Organization of Programming Languages CS3200/5200N. Lecture 11

Discourse Representation Theory Building Discourse Representations

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

COP 3402 Systems Software Syntax Analysis (Parser)

Solving Natural Language Math Problems

Introduction to Semantics. Expanding Our Formalism, Part 2 1

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

CMPSCI 250: Introduction to Computation. Lecture #7: Quantifiers and Languages 6 February 2012

More Theories, Formal semantics

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

LOGIC AND DISCRETE MATHEMATICS

Quoting side effects. Chung-chieh Shan Rutgers University

Denotational Semantics of a Simple Imperative Language Using Intensional Logic

CA Compiler Construction

Lecture Notes on Data Representation

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

15-819M: Data, Code, Decisions

n n Try tutorial on front page to get started! n spring13/ n Stack Overflow!

An Efficient Implementation of PATR for Categorial Unification Grammar

Non-deterministic Finite Automata (NFA)

Semantics of programming languages

Z Notation. June 21, 2018

CLF: A logical framework for concurrent systems

Specifying Syntax. An English Grammar. Components of a Grammar. Language Specification. Types of Grammars. 1. Terminal symbols or terminals, Σ

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

Going beyond propositional logic

1 Delimited continuations in Haskell

Flang typechecker Due: February 27, 2015

Semantics and First-Order Predicate Calculus

Recursive Functions of Symbolic Expressions and Their Application, Part I

Functional Programming. Pure Functional Programming

SEMANTIC ANALYSIS TYPES AND DECLARATIONS

Chapter 2 & 3: Representations & Reasoning Systems (2.2)

Metaprogramming assignment 3

Lambda Calculus. Lecture 4 CS /26/10

Polymorphic lambda calculus Princ. of Progr. Languages (and Extended ) The University of Birmingham. c Uday Reddy

LANGUAGE PROCESSORS. Presented By: Prof. S.J. Soni, SPCE Visnagar.

An Evolution of Mathematical Tools

Topic 1: Introduction

Back to the model. Jason Perry and Chung-chieh Shan Rutgers University. July 10, /24

Scheme Tutorial. Introduction. The Structure of Scheme Programs. Syntax

Chapter 15. Functional Programming Languages

Syntax and Grammars 1 / 21

Haskell Introduction Lists Other Structures Data Structures. Haskell Introduction. Mark Snyder

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

CS 314 Principles of Programming Languages

CMPUT 325 : Lambda Calculus Basics. Lambda Calculus. Dr. B. Price and Dr. R. Greiner. 13th October 2004

From the λ-calculus to Functional Programming Drew McDermott Posted

Definite-clause grammars: PSGs in Prolog (in principle, string rewrite described as a logical formula).

Talen en Compilers. Jurriaan Hage , period 2. November 13, Department of Information and Computing Sciences Utrecht University

UNIVERSITY OF EDINBURGH COLLEGE OF SCIENCE AND ENGINEERING SCHOOL OF INFORMATICS INFR08008 INFORMATICS 2A: PROCESSING FORMAL AND NATURAL LANGUAGES

Transcription:

1 Syntax-semantics interface and the non-trivial computation of meaning APA/ASL Group Meeting GVI-2: Lambda Calculi, Type Systems, and Applications to Natural Language APA Eastern Division 108th Annual Meeting Washington, DC, December 28, 2011

We describe the relationship between the surface form of a sentence and its meaning as two non-trivial but mechanical interpretations of the same (hidden) abstract form. Our approach, in the tradition of abstract categorial grammar (ACG), deals with several languages: The language A is the language of abstract form; the language I is the language in which we write a compositional interpreter of A, which produces a term in a language T. The language A is simply-typed lambda-calculus with constants. A syntactic interpretation I syn gives a surface form for a sentence corresponding to A; T syn is a set of strings or utterances. This interpretation is responsible for word order, case marking, subject-verb agreement, etc. Therefore, A is abstracted from these syntactic details. A can be determined from T syn by parsing. If the abstract language is simple that is, its constants have types of low order parsing is tractable. This is the case for our ACGs. A semantic interpretation I sem computes the meaning of A as a logical formula; T sem is thus the language of higher-order logic. I sem deals with quantifiers, pronouns, question words and their interactions. Our I sem interpreter is non-trivial: it may fail. Although we may parse a sentence to an abstract form, we may fail to compute any meaning for it, if the sentence just doesn t make sense. Our I sem is not a regular lambda-calculus: it expresses computational effects

2 Outline Overview Details Demonstration of the syntax-semantics calculator

3 Syntax-semantics interface Syntax Semantics

Goal: investigate the correspondence between the syntax and semantics

3 Syntax-semantics interface Syntax Semantics "John ignored a woman" j (woman j) (ignore john j)

What does it mean. Syntax: the surface form such as plain text or an utterance. Semantics: logical formula in first-order predicate logic.

3 Syntax-semantics interface Abstract fullstop (ignored (a woman) John) I syn I sem Syntax Semantics "John ignored a woman" j (woman j) (ignore john j)

We follow the Abstract Categorial Grammar approach: both syntax and semantics are the transformations from a common, abstract language

3 Syntax-semantics interface Abstract fullstop (ignored (a woman) John) Syntax Semantics "John ignored a woman" j (woman j) (ignore john j) What is a language?

What is a language: here are the examples. We will define formally later, for now: set of tokens such as strings or terms connected with binary operators and generated by a particular grammar.

3 Syntax-semantics interface Abstract fullstop (ignored (a woman) John) I syn I syn I sem I sem Syntax Semantics "John ignored a woman" j (woman j) (ignore john j)

The abstract language can be transformed to several concrete languages; there may also be alternative semantics transformations.

3 Syntax-semantics interface Abstract fullstop (ignored (a woman) John) I syn I sem Syntax Semantics "John ignored a woman" j (woman j) (ignore john j) What is a transformation?

What are transformations? They are specified in some language, for example, English. We aim at the formal specification of transformations, expressed in a formal language with precise evaluation rules like λ-calculus.

3 Syntax-semantics interface Abstract fullstop (ignored (a woman) John) I syn I sem Syntax Semantics "John ignored a woman" j (woman j) (ignore john j) Parsing

Grammaticality and parsing. A sentence in the concrete syntax is ungrammatical if there is no corresponding abstract sentence: that is, in cannot be parsed.

3 Syntax-semantics interface Abstract fullstop (ignored (a woman) John) I syn I sem Syntax Semantics "John ignored a woman" j (woman j) (ignore john j) I sem is non-trivial: it may fail

Also, although a sentence may parse to an abstract form, I sem may fail to produce the logical formula. A sentence may just make no sense.

3 Syntax-semantics interface Abstract fullstop (ignored (a woman) John) I syn I sem Syntax Semantics "John ignored a woman" j (woman j) (ignore john j) I are composable and modular

Transformations should be modular and composable: the transformation of John to "John" and john which is written for this sentence should work for all other sentences with John.

3 Syntax-semantics interface Abstract fullstop (ignored (a woman) John) I syn I sem I syn1 I sem1 Syntax Semantics "John ignored a woman" j (woman j) (ignore john j) I are composable from smaller features

Transformations compose in a different sense: the whole I syn or I sem can be built from smaller, independent steps. We ll see the examples of that later.

4 Sample sentences (1) John ignored Mary and she left. (2) John ignored a woman and she left. (3) John ignored every woman and she left.... binding

BTW, here some of the example sentences for this talk, to illustrate the range of handled linguistic phenomena.binding, (1), (2), (3).

4 Sample sentences (1) John ignored Mary and she left. (2) John ignored a woman and she left. (3) John ignored every woman and she left.... binding quantification and binding

A quantifier can bind a variable within its scope, (2).

4 Sample sentences (1) John ignored Mary and she left. (2) John ignored a woman and she left. (3) John ignored every woman and she left.... binding quantification and binding different scope of different quantifiers

Different quantifiers have different scope abilities. Universals are clause- or sentence-bound, (3), but indefinites can scope out of a clause or a sentence (2).

5 Outline Overview Details Demonstration of the syntax-semantics calculator

That was the overview of the whole talk. Now we get to the details. We start with Greek, and then move to a less flowery notation, which can be mechanically manipulated.

6 Running example John ignored a woman.

Now we give the details of the ACG and precise definitions.

Abstract signature A higher-order signature A collection of atomic types, constants, and type assignments to constants Signature Σ abs Atomic types John woman a ignored fullstop Composition (elimination rule for ) CN, NP, S, M : NP : CN : CN NP : NP NP S : S M : (a b) a b Language def = the set of the typed terms you can build from the signature 7

Abstract, semantic, etc. languages are defined the same way, by a signature, which enumerates types and constants, and specifies the single composition operation,.

Abstract signature A higher-order signature A collection of atomic types, constants, and type assignments to constants Signature Σ abs Atomic types John woman a ignored fullstop Composition (elimination rule for ) CN, NP, S, M : NP : CN : CN NP : NP NP S : S M : (a b) a b Language def = the set of the typed terms you can build from the signature 7

The only uncommon parts here are the type M, for the complete matrix sentence or discourse, and fullstop, the end of the discourse (or sentence, in this case). Also unlike ACG, we introduce type constructor for the abstract function space. One may regard as the elimination rule for.

8 Abstract terms Language def = the set of the typed terms you can build from the signature Terms over Σ abs e ::= c e e, c Σ abs A sample term def = fullstop (ignored (a woman) John) t woman

One can verify that the term t woman is well-typed and so it is in the set of typed lambda-terms over the abstract signature.

9 String signature Signature Σ str Atomic type string "John" : string "woman" : string "a" : string "ignored" : string "." : string Composition : string string string

The operation denotes string concatenation. It looks like a simple version of the signature.

10 I syn Isyn: mapping of constants of Σabs to terms over Σstr λ-calculus is the meta-language to define I syn N, NP, S, and M string John "John" woman "woman" a "a" ignored λo. λs. s "ignored" o fullstop λx. x "." function application

I syn is the eval. It interprets constants of the abstract signature in, here, the surface language. The interpretation of constants homomorphically extends to the interpretation of the whole abstract language in terms of the surface language.

10 I syn Isyn: mapping of constants of Σabs to terms over Σstr λ-calculus is the meta-language to define I syn N, NP, S, and M string John "John" woman "woman" a "a" ignored λo. λs. s "ignored" o fullstop λx. x "." function application the surface form I syn (t woman ) = (λx. x ".")((λo. λs. s "ignored" o) ((λx. "a" x)"woman") "John") "John" "ignored" "a" "woman" "."

I must emphasize a point that becomes very important later. If we just substitute for the constants in the sample woman term their mapped terms, we get this long phrase on the second line in the table. The whole transformation is trivial: simple exchange taking care of the word order. We can implement case marking, gender and number agreement, etc.

I syn Isyn: mapping of constants of Σabs to terms over Σstr λ-calculus is the meta-language to define I syn N, NP, S, and M string John "John" woman "woman" a "a" ignored λo. λs. s "ignored" o fullstop λx. x "." function application Computing the surface form I syn (t woman ) = (λx. x ".")((λo. λs. s "ignored" o) ((λx. "a" x)"woman") "John") "John" "ignored" "a" "woman" "." 10

When we normalize that term we get what looks like a string, the surface form of our sentence. In ACG tutorials that I read, the fact that we have to normalize, or reduce, the result of the lexicon substitution is hardly ever mentioned. There is a good reason: there is little to say: The calculus here is simply-typed lambda calculus and is strongly normalizing. Every term has the normal form; the normalization is as uneventful as it could ever get. But that would change, in our extension to ACG.

11 Haskell demo notable points Abstract.hs Defining and re-using phrases Type inference The type shows if a phrase is a complete sentence Inferred type shows all features in use Only complete sentence are to be interpreted

We now show how the Greek development we ve seen looks in Haskell.

12 Outline Overview Details Demonstration of the syntax-semantics calculator

13 Applicative Function application with side-effects iα represents a computation that produces the value of the type α and may have en affect Introduction rule pure : α iα Composing principle Monad: mα (α mβ) mβ Applicative: i(α β) iα iβ

I sem uses effects, and effects are structured through Applicative. You might have heard of monads, an obscure philosophical concept borrowed as a joke into Category theory and rising to prominence through hardly countable monad tutorials. Applicative is a simpler version of monads. For one, applicative has been in English language longer (for about 30 years, according to OED: OED quotes 1607 for applicative).

13 Applicative Function application with side-effects iα represents a computation that produces the value of the type α and may have en affect Introduction rule pure : α iα Composing principle Monad: mα (α mβ) mβ Applicative: i(α β) iα iβ All monads are applicatives, but not vice versa Applicatives compose, monads generally not

We ll see many examples of applicatives and their compositions

14 Haskell demo Abstract.hs: the Abstract language Defining and re-using phrases Type inference The type shows if a phrase is a complete sentence Inferred type shows all features in use Only complete sentence are to be interpreted Logic.hs: the language of Logic; lifting through applicative Sem.hs: main transformation; adding ACnj, DynLogic and two levels of quantification modularly

Conclusions Illustration and extensions of ACG Abstract Syntax & semantics, compositionally Transformations may be composed from smaller ones Transformation are effectful and non-trivial Mechanical implementation: semantics calculator Implementation in Haskell Applicatives to express effects Towers of applicatives Applications Account of dynamic logic Interaction of quantification and pronouns http://okmij.org/ftp/gengo/applicative-symantics/ 15

We have described a computational ACG, emphasizing evaluation as a process to produce a (semantic) logical formula. Computational ACG gives us a principled way to assign different quantifiers different scope-taking abilities, maintaining consistency with Minimalism and avoiding free-wheeling Quantifier Raising. Computational ACG let us relate quantification and binding: the same mechanism controls the scope of both. We have implemented Computational ACG by embedding them in Haskell. We can compute ACG yields and, more importantly, denotations. We can do that interactively, in GHCi). There is no longer any need to computing denotations by hand. We (computer, actually) can thus handle more complex examples.