Computational Semantics
Total Page:16
File Type:pdf, Size:1020Kb
Computational Semantics Aljoscha Burchardt Stephan Walter Alexander Koller Michael Kohlhase Patrick Blackburn Johan Bos MiLCA, Saarbrücken Abstract The most central fact about natural language is that it has meaning. Semantics is the study of meaning. In formal semantics, we conduct this study in a formal manner. In computational semantics, we're additionally interested in using the results of our study when we implement programs that process natural language. This is what we will be concerned with in this course. MiLCA Computerlinguistik, Universität des Saarlandes Saarbrücken, Germany November 2002 Contents 1 First-Order Logic 5 1.1 Basic Concepts . 5 1.1.1 Vocabularies . 5 1.1.2 First-Order Models . 6 1.1.3 An Example Model . 7 1.1.4 Exact Models . 7 1.1.5 First-Order Languages . 8 1.1.6 Building Formulae . 9 1.1.7 Subformulae, Free Variables . 10 1.1.8 Free Variables versus Bound Variables . 11 1.1.9 Notation . 11 1.2 Semantic Notions . 12 1.2.1 Satisfaction . 12 1.2.2 Interpretations and Variant Assignments . 13 1.2.3 The Satisfaction Definition . 13 1.2.4 Truth in a Model . 13 1.2.5 Validities . 14 1.2.6 Valid Arguments . 15 1.2.7 An Example . 16 1.3 Equality . 16 1.3.1 Equality Symbol . 16 1.3.2 Semantics of Equality . 16 1.4 Exercises . 17 2 Prolog and First-Order Logic 19 2.1 A Simple Model Checker . 19 2.1.1 Representing Vocabularies . 19 2.1.2 Representing Simple Formulae . 19 2.1.3 Representing Complex Formulae . 20 2.1.4 Representing Models . 21 2.1.5 Another Example . 23 2.1.6 Semantic Evaluation . 24 2.1.7 Evaluating Complex Formulae . 25 2.1.8 Quantifiers . 25 2.1.9 Checking Models . 26 2.2 Refinements . 27 2.2.1 Problem One: Unknown Vocabulary . 27 2.2.2 Problem Two: Formulae with Free Variables . 28 2.2.3 Refining the Implementation . 28 2.3 File Listing . 29 2.3.1 All modules for the model checker . 29 2.4 Exercises . 29 3 Lambda Calculus 33 3.1 Building Meaning Representations . 33 3.1.1 Being Systematic . 33 3.1.2 Being Systematic (II) . 33 3.1.3 [Sidetrack] Compositional Semantics . 34 3.1.4 Summing Up . 36 3.2 Syntactic Analysis . 37 3.2.1 A Simple Solution: CFG . 37 3.2.2 Using DCGs . 38 3.3 Semantics Construction . 39 3.3.1 A First Attempt . 39 3.3.2 Putting Things in the Right Place I . 40 3.3.3 Putting Things in the Right Place II . 41 3.4 The Lambda Calculus . 42 3.4.1 Lambda-Abstraction . 42 3.4.2 Reducing Complex Expressions . 43 3.4.3 Using Lambdas . 44 3.4.4 [Sidetrack] Simply Typed Lambda-Calculus . 45 3.4.5 Advanced Topics: Proper Names and Transitive Verbs . 49 3.4.6 The Moral . 50 3.4.7 Accidental Bindings . 52 3.4.8 Alpha-Conversion . 53 3.4.9 Summing Up . 53 3.5 Implementing Lambda Calculus . 54 3.5.1 Representations . 54 3.5.2 Extending the DCG . 55 3.5.3 The Lexicon . 55 3.5.4 A First Run . 56 3.5.5 Beta-Conversion . 56 3.5.6 Beta-Conversion Continued . 57 3.5.7 An Afterthought on Alpha-Conversion . 58 3.6 Running the Program . 59 3.7 Exercises . 60 4 Towards a Modular Architecture 63 4.1 Architecture of our Grammar . 63 4.2 The Syntax Rules . 64 4.2.1 Ideal Syntax Rules . 64 4.2.2 The Syntax Rules we will use . 65 4.3 The Semantic Side . 66 4.3.1 The Semantically Annotated Syntax Rules . 66 4.3.2 Implementing combine/2 for Functional Application . 67 4.4 Looking Up the Lexicon . 68 4.4.1 Lexical Rules . 68 4.4.2 The Lexicon . 69 4.4.3 `Special' Words . 70 4.4.4 Semantic Macros for Lambda-Calculus . 71 4.5 Lambda at Work . 72 4.6 Exercises . 73 5 Scope and Underspecification 75 5.1 Scope Ambiguities . 75 5.1.1 What Are Scope Ambiguities? . 75 5.1.2 Scope Ambiguities and Montague Semantics . 76 5.1.3 A More Complex Example . 78 5.1.4 The Fifth Reading . 79 5.1.5 Montague's Approach to the Scope Problem . 79 5.1.6 Quantifying In: An Example . 80 5.1.7 Other Traditional Solutions . 80 5.1.8 The Problem with the Traditional Approaches . 81 5.2 Underspecification . 82 5.2.1 Introduction . 82 5.2.2 Computational Advantages . 84 5.2.3 Underspecified Descriptions . 85 5.2.4 The Masterplan . 85 5.2.5 Formulas are trees! . 87 5.2.6 Describing Lambda-Structures . 88 5.2.7 From Lambda-Expressions to an Underspecified Descrip- tion . 89 5.2.8 Relating Constraint Graphs and Lambda-Structures . 90 5.2.9 Sidetrack: Constraint Graphs - The True Story . 91 5.2.10 Sidetrack: Predicates versus Functions . 92 6 Constraint Solving 95 6.1 Constraint Solving . 95 6.1.1 Satisfiability and Enumeration . 95 6.1.2 Solved Forms . 95 6.1.3 Solved Forms: An Example . 97 6.1.4 Defining Solved Forms . 98 6.2 An Algorithm For Solving Constraints . 98 6.2.1 The Choice Rule . 98 6.2.2 Normalization . 99 6.2.3 The Enumeration Algorithm . 100 6.3 Constraint Solving in Prolog . 101 6.3.1 Prolog Representation of Constraint Graphs . 101 6.3.2 Solve . 103 6.3.3 Distribute . 104 6.3.4 (Parent) Normalization . 104 6.3.5 Redundancy Elimination . 105 6.4 Semantics Construction for Underspecified Semantics . 106 6.4.1 The Semantic Macros . 106 6.4.2 The combine-rules . 107 6.5 Running CLLS . 111 6.6 Exercises . 112 7 Inference in Computational Semantics 115 7.1 What is Inference, and how do we use it in Computational Se- mantics? . 115 7.1.1 What we already know about Logics . 115 7.1.2 Calculi . 116 7.1.3 A simple Logical System: Propositional Logic with Hilbert- Calculus . 116 7.1.4 Proofs in Hilbert Calculus . 117 7.1.5 Properties of Calculi (Theoretical Logic) . 118 7.1.6 Sidetrack: Calculemus! . 119 7.1.7 Natural Language Semantics . 120 7.2 Tableaux Calculi . 121 7.2.1 Tableaux for Theorem Proving . 121 7.2.2 Tableaux for Theorem Proving (continued) . 123 7.2.3 Analytical Tableaux: A more formal Account . 124 7.2.4 Using Tableaux to test Truth Conditions . ..