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

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

LOGIC AND DISCRETE MATHEMATICS

Programming Languages Third Edition

Contents. Chapter 1 SPECIFYING SYNTAX 1

Introductory logic and sets for Computer scientists

EXTENSIONS OF FIRST ORDER LOGIC

Logic and its Applications

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

Lecture 1: Conjunctive Queries

A simple syntax-directed

Computational Semantics and Type Theory Draft

Principles of Programming Languages 2017W, Functional Programming

AN INTRODUCTION TO FUZZY SETS Analysis and Design. Witold Pedrycz and Fernando Gomide

List of Figures. About the Authors. Acknowledgments

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

CMSC 330 Practice Problem 4 Solutions

Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1

INTENSIONAL LOGIC TRANSLATION FOR QUANTITATIVE NATURAL LANGUAGE SENTENCES

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

Semantics and Pragmatics of NLP Propositional Logic, Predicates and Functions

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

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

Functional Programming. Pure Functional Programming

CMSC 330, Fall 2009, Practice Problem 3 Solutions

1. Explain the input buffer scheme for scanning the source program. How the use of sentinels can improve its performance? Describe in detail.

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

CS 6110 S14 Lecture 1 Introduction 24 January 2014

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

Lecture 5. Logic I. Statement Logic

An Evolution of Mathematical Tools

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

CSC 501 Semantics of Programming Languages

Syllabi of the Comprehensive Examination in Computer Science

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

Syntax and Grammars 1 / 21

Dependency grammar and dependency parsing

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

An Efficient Implementation of PATR for Categorial Unification Grammar

Semester Review CSC 301

About the Authors... iii Introduction... xvii. Chapter 1: System Software... 1

CSE450 Translation of Programming Languages. Lecture 4: Syntax Analysis

MIDTERM EXAM (Solutions)

7. Introduction to Denotational Semantics. Oscar Nierstrasz

SYLLABUS UNIT - I UNIT - II UNIT - III UNIT - IV CHAPTER - 1 : INTRODUCTION CHAPTER - 4 : SYNTAX AX-DIRECTED TRANSLATION TION CHAPTER - 7 : STORA

Understanding and Writing Compilers

Programming Languages

CMSC 330: Organization of Programming Languages. Operational Semantics

CSCI 1260: Compilers and Program Analysis Steven Reiss Fall Lecture 4: Syntax Analysis I

Computing Inside The Parser Syntax-Directed Translation. Comp 412 COMP 412 FALL Chapter 4 in EaC2e. source code. IR IR target.

Using Distributed NLP to Bootstrap Semantic Representations from Web Resources

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

G COURSE PLAN ASSISTANT PROFESSOR Regulation: R13 FACULTY DETAILS: Department::

Which of the following is not true of FORTRAN?

CS 415 Midterm Exam Spring SOLUTION

Type raising, continuations, and classical logic

The MetaGrammar Compiler: An NLP Application with a Multi-paradigm Architecture

MIDTERM EXAMINATION. CSE 130: Principles of Programming Languages. Professor Goguen. February 16, points total

An Inference Engine with a Natural Language Interface

Context and the Composition of Meaning

Formal Systems and their Applications

Dependency grammar and dependency parsing

Homework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture

COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

Dependency grammar and dependency parsing

Compilation 2012 Context-Free Languages Parsers and Scanners. Jan Midtgaard Michael I. Schwartzbach Aarhus University

The discussion of Chapter 1 will be split into two sessions; the first will cover 1.1 and 1.2; the second will cover 1.3, 1.4, and 1.5.

Context-free Grammars

Functional Programming. Pure Functional Languages

Torben./Egidius Mogensen. Introduction. to Compiler Design. ^ Springer

Lambda: the ultimate syntax-semantics interface

Z Notation. June 21, 2018

Principles of Programming Languages COMP251: Syntax and Grammars

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

Informal Semantics of Data. semantic specification names (identifiers) attributes binding declarations scope rules visibility

arxiv: v2 [cs.ai] 18 Sep 2013

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

Trustworthy Compilers

Lecture 12: Conditional Expressions and Local Binding

EECS 6083 Intro to Parsing Context Free Grammars

Introduction. Compiler Design CSE Overview. 2 Syntax-Directed Translation. 3 Phases of Translation

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

1. The output of lexical analyser is a) A set of RE b) Syntax Tree c) Set of Tokens d) String Character

Functional Programming. Big Picture. Design of Programming Languages

CSE 3302 Programming Languages Lecture 2: Syntax

Highest Safe Rung Problem. Spring 2014 Karl Lieberherr Zhengxing Chen

Proofs-Programs correspondance and Security

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

VALLIAMMAI ENGINEERING COLLEGE

CMPT 755 Compilers. Anoop Sarkar.

COP4020 Spring 2011 Midterm Exam

LL(k) Parsing. Predictive Parsers. LL(k) Parser Structure. Sample Parse Table. LL(1) Parsing Algorithm. Push RHS in Reverse Order 10/17/2012

Principles of Programming Languages [PLP-2015] Detailed Syllabus

ITEC2620 Introduction to Data Structures

Formal Semantics. Chapter Twenty-Three Modern Programming Languages, 2nd ed. 1

CS 415 Midterm Exam Spring 2002

CS131 Typed Lambda Calculus Worksheet Due Thursday, April 19th

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.

Formal Predicate Calculus. Michael Meyling

Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5

Dependency and (R)MRS

Transcription:

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

Contents Foreword page ix Preface xiii 1 Formal Study of Natural Language 1 1.1 The Study of Natural Language 1 1.2 Syntax, Semantics, and Pragmatics 3 1.3 The Purposes of Communication 5 1.4 Natural Languages and Formal Languages 8 1.5 What Formal Semantics is Not 10 1.6 Computational Semantics and Functional Programming 11 1.7 Overview of the Book 12 1.8 Further Reading 14 2 Lambda Calculus, Types, and Functional Programming 15 2.1 Sets and Set Notation 15 2.2 Relations 17 2.3 Functions 19 2.4 Lambda calculus 22 2.5 Types in Grammar and Computation 27 2.6 Functional Programming 30 2.7 Further reading 31 3 Functional Programming with Haskell 33 3.1 The Programming Language Haskell 33 3.2 Using the Book Code 34 3.3 First Experiments 35 3.4 Type Polymorphism 39 3.5 Recursion 40 3.6 List Types and List Comprehension 41 3.7 List processing with map and filter 43 v

vi Contents 3.8 Function Composition, Conjunction, Disjunction, Quantification 44 3.9 Type Classes 45 3.10 Strings and Texts 47 3.11 Finnish Vowel Harmony 52 3.12 Identifiers in Haskell 55 3.13 User-defined Data Types and Pattern Matching 56 3.14 Application: Representing Phonemes 60 3.15 Further Reading 62 4 Formal Syntax for Fragments 4.1 Grammars for Games 4.2 A Fragment of English 4.3 A Language for Talking about Classes 71 4.4 Prepositional Logic 72 4.5 Predicate Logic 75 4.6 Predicate Logical Formulas in Haskell 79 4.7 Adding Function Symbols 4.8 Further Reading 5 Formal Semantics for Fragments 5.1 Semantics of Sea Battle 5.2 Semantics of Prepositional Logic 5.3 Prepositional Reasoning in Haskell 94 5.4 Semantics of Mastermind 97 5.5 Semantics of Predicate Logic 100 5.6 Semantics of Natural Language Fragments 105 5.7 An Inference Engine with a Natural Language Interface 106 5.8 Further Reading 123 6 Model Checking with Predicate Logic 125 6.1 Linguistic Form and Translation Into 125 Logic 6.2 Predicate Logic as Representation Language 6.3 Representing a Model for Predicate Logic 6.4 Evaluating Formulas in Models 139 6.5 Evaluating Formulas with Structured Terms 143 6.6 Further Reading 147 7 The Composition of Meaning in Natural Language 149 7.1 Rules of the Game 149 150 7.2 Quantification 63 63 68 82 84 87 87 92 127 133 7.3 The Language of Typed Logic and Its Semantics 164 7.4 Reducing Expressions of Typed Logic 168 7.5 Typed Meanings for Natural Language 173

Contents vii 7.6 Implementing Semantic Interpretation 175 7.7 Handling Ambiguity 180 182 7.8 Further Reading 8 Extension and Intension 183 8.1 Sense and Reference, Intension and Extension 183 8.2 Intensional Interpretation 187 8.3 Intensional Constructs 192 8.4 Intensionalization 195 8.5 Intensional Models from Extensional Models 201 8.6 Further Reading 202 9 Parsing 205 9.1 Talking About Parse Trees 205 9.2 Recognizing and Parsing Context-Free Languages 211 9.3 Parsers and Parser Combinators 214 9.4 Features and Categories 223 9.5 Lexical Lookup and Scanning 226 9.6 Parsing Categories 9.7 Handling Extractions 239 9.8 Adding Semantics 251 9.9 Further Reading 260 10 Handling Relations and Scoping 261 10.1 Interpreting NP Lists 261 10.2 Generalized Relations 264 10.3 Boolean Algebras of Relations 269 10.4 Flexible Types for NP Interpretations 10.5 Scope Reversal of Quantifiers 235 271 272 10.6 Interpreting Verbs as Arbitrary Arity Relations 273 10.7 Relational Interpretation of NPs 276 10.8 Quantifier Scoping 278 10.9 Underspecified Logical Form 280 10.10 Further Reading 285 11 Continuation Passing Style Semantics 287 11.1 Continuation Passing Style Programming 287 11.2 Continuations as Abstractions over Context 289 11.3 Continuizing a Grammar 292 11.4 Implementing a Continuized Grammar 296 11.5 Scope Reversal by Means of Continuations 299 11.6 Further Reading 301

viii Contents 12 Discourse Representation and Context 303 12.1 The Dynamics of Pronoun Linking 303 12.2 Abstraction over Context 308 12.3 Continuizing the Account 312 12.4 Implementing Discourse Representation 313 12.5 From Structure Trees to Dynamic Interpretation 322 12.6 Salience 329 12.7 Implementing Reference Resolution 333 12.8 Further Reading 349 13 Communication as tnformative Action 351 13.1 Knowledge and Communication 351 13.2 Reasoning About Knowledge and Ignorance 355 13.3 A Language for Talking About (Common) Knowledge 357 13.4 Presuppositions and Common Knowledge 360 13.5 Adding Public Change 364 13.6 Yes/No Questions and Their Answers 366 13.7 Epistemic Model Checking 368 13.8 Further Reading 385 Afterword 387 Bibliography 389 Index 397