surface reasoning
play

Surface Reasoning Lecture 2: Logic and Grammar Thomas Icard June - PowerPoint PPT Presentation

Surface Reasoning Lecture 2: Logic and Grammar Thomas Icard June 18-22, 2012 Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 1 Categorial Grammar Combinatory Categorial Grammar Lambek Calculus Interlude:


  1. Surface Reasoning Lecture 2: Logic and Grammar Thomas Icard June 18-22, 2012 Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 1

  2. Categorial Grammar � Combinatory Categorial Grammar � Lambek Calculus � Interlude: Syntax/Semantics Interface � S´ anchez-Valencia’s Natural Logic � van Eijk’s Marking Algorithm � References � Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 2

  3. Categorial Grammar (Ajdukiewicz/Bar-Hillel) Categorial Grammar Define a set CAT of categories as follows: ◮ Some set of basic categories is in CAT. ◮ If A , B ∈ CAT, then both A / B ∈ CAT and A \ B ∈ CAT. Two basic rules: (FA) A / B , B ⇒ A . (BA) B , A \ B ⇒ A . If we add to these two more rules we obtain a basic proof system: (id) A ⇒ A . (cut) If Γ , A , Γ ′ ⇒ B and ∆ ⇒ A , then Γ , ∆ , Γ ′ ⇒ B . Here Γ and ∆ are finite sequences of categories. Definition CG is the smallest relation containing (id), (FA), and (BA), and closed under (cut). Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 3

  4. Categorial Grammar ◮ Given a set Σ of basic lexical items, e.g. natural language expressions, a lexicon is an assignment of a finite number of categories to each lexical item: LEX ⊆ Σ × CAT. ◮ A string w 1 , ..., w n ∈ Σ + is an expression of type B just in case there is a sequence of categories A 1 , ..., A n such that � w i , A i � ∈ LEX, for each i ≤ n , and A 1 , ..., A n ⇒ B . Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 4

  5. Categorial Grammar A toy lexicon: ◮ Theodore, np ◮ broccoli, np ◮ candidate, n ◮ likes, ( s \ np ) / np ◮ every, some, ( s / ( s \ np )) / n ◮ who, ( n \ n ) / ( s \ np ) Or, abbreviating iv = s \ np and tv = iv / np , this simplifies to: ◮ Theodore, np ◮ broccoli, np ◮ candidate, n ◮ likes, tv ◮ every, some, ( s / iv ) / n ◮ who, ( n \ n ) / iv Example: likes broccoli ( s \ np ) / np np Theodore s \ np np s Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 5

  6. Categorial Grammar A toy lexicon: ◮ Theodore, np ◮ broccoli, np ◮ candidate, n ◮ likes, ( s \ np ) / np ◮ every, some, ( s / ( s \ np )) / n ◮ who, ( n \ n ) / ( s \ np ) Or, abbreviating iv = s \ np and tv = iv / np , this simplifies to: ◮ Theodore, np ◮ broccoli, np ◮ candidate, n ◮ likes, tv ◮ every, some, ( s / iv ) / n ◮ who, ( n \ n ) / iv Example: likes broccoli tv np Theodore np iv s Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 6

  7. Categorial Grammar Longer example: likes broccoli tv np who ( n \ n ) / iv iv candidate every n n \ n likes Theodore ( s / iv ) / n n tv np s / iv iv s Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 7

  8. Categorial Grammar CG versus CFG Theorem (Gaifman) The class of languages generated by context free grammars coincides with the class of languages accepted by categorial grammars. ◮ Recall our lexicon LEX: • Theodore, np • broccoli, np • candidate, n • likes, tv • every, some, ( s / iv ) / n • who, ( n \ n ) / iv ◮ A context free grammar generating the same set of strings would be: S → NP VP NP → every N | some N | PN | NP who VP N → candidate PN → Theodore | broccoli VP → likes PN Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 8

  9. Categorial Grammar ◮ Problem: the following are not strings in the language: • ‘who Theodore likes’ • ‘likes some candidate’ ◮ In particular, we cannot parse: • ‘Every candidate who Theodore likes likes some candidate’ ◮ For ‘who Theodore likes’ we would need ‘who’ to have category (( n \ n ) / tv ) / np in addition to ( n \ n ) / iv : who Theodore (( n \ n ) / tv ) / np np likes ( n \ n ) / tv tv n / n ◮ Similarly, ‘all’ and ‘some’ would have to have a second category ( iv \ tv ) / n for object position, in addition to ( s / iv ) / n . ◮ This is inelegant and seems to miss some cross-categorial generalizations. Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 9

  10. Combinatory Categorial Grammar ◮ Combinatory Categorial Grammar (CCG) is an extension of CG with several further rules. (For more go to Mark Steedman’s course!) ( > B) A / B , B / C ⇒ A / C ( < B) B \ C , A \ B ⇒ A \ C ( > T) A ⇒ B / ( B \ A ) ( < T) A ⇒ B \ ( B / A ) ◮ Using > B and > T we can now parse ‘who Theodore likes’: Theodore np likes ( > T ) s / ( s \ np ) ( s \ np ) / np ( > B ) who ( n \ n ) / ( s / np ) s / np n \ n Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 10

  11. Combinatory Categorial Grammar ◮ CCG can also capture quantifiers in object position by assigning ‘some’ and ‘all’ an only slightly adjusted category ( s \ ( s / np )) / n , in addition to ( s / ( s \ np )) / n for subject position: Theodore np likes some candidate ( > T ) s / ( s \ np ) ( s \ np ) / np ( s \ ( s / np )) / n n ( > B ) s \ ( s / np ) s / np s ◮ CCG has another rule: ( < S x ) B / C , ( A \ B ) / C ⇒ A / C ◮ In general, CCG is stronger than context free, equivalent to so called linear index grammars (like TAG and other grammatical formalisms). Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 11

  12. Lambek Calculus ◮ Lambek Calculus is an alternative to CCG. The main idea is that categories correspond to logical formulas, and category forming operators correspond to logical constants. “Parsing as deduction” ◮ The setting is Gentzen-style Natural Deduction, where Γ � A means the sequence Γ is of category A . ◮ The basic Lambek Calculus L is given by the following rules: (Ax) A � A ∆ � A \ B ( \ E ) ∆ � A / B Γ � B Γ � B ( / E ) ∆ , Γ � A Γ , ∆ � A B , ∆ � A ( \ I ) ∆ , B � A ( / I ) ∆ � A / B ∆ � A \ B Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 12

  13. Lambek Calculus (Ax) A � A ∆ � A \ B ( \ E ) ∆ � A / B Γ � B Γ � B ( / E ) ∆ , Γ � A Γ , ∆ � A B , ∆ � A ( \ I ) ∆ , B � A ( / I ) ∆ � A / B ∆ � A \ B ◮ From these follow all of the CCG rules, with the exception of < S x . [ C � C ] 1 Γ � B / C ( / E ) ∆ � A / B Γ , C � B ( / E ) ∆ , Γ , C � A ( / I ) 1 ∆ , Γ � A / C ◮ That is, if ∆ is of category A / B and Γ is of category B / C , then ∆ , Γ is of category A / C . This is just rule > B . Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 13

  14. Lambek Calculus (Ax) A � A ∆ � A \ B ( \ E ) ∆ � A / B Γ � B Γ � B ( / E ) ∆ , Γ � A Γ , ∆ � A B , ∆ � A ( \ I ) ∆ , B � A ( / I ) ∆ � A / B ∆ � A \ B ◮ From these follow all of the CCG rules, with the exception of < S x . [ B \ A � B \ A ] 1 ∆ � A ( \ E ) ∆ , B \ A � B ( / I ) 1 ∆ � B / ( B \ A ) ◮ That is, if ∆ is of category A , then it is also of category B / ( B \ A ) . This is rule > T . Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 14

  15. Lambek Calculus ◮ Again, we cannot derive < S x , which means L is strictly weaker than CCG. Theorem (Pentus) L is context free. ◮ Still, it allows for elegant derivations without excess categories: [ np � np ] 1 likes � tv ( / E ) likes, np � s \ np Theodore � np ( \ E ) Theodore likes , np � s ( / I ) 1 who � ( n \ n ) / ( s / np ) Theodore likes � s / np ( \ E ) who Theodore likes � n \ n Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 15

  16. Lambek Calculus ◮ As is well known, in natural language syntax tree structure matters. We sometimes cannot assume our sequences satisfy associativity. ◮ The weakest of the Categorial Type Logics is NL: (Ax) A � A ∆ � A \ B ( \ E ) ∆ � A / B Γ � B Γ � B ( / E ) ( ∆ ◦ Γ ) � A ( Γ ◦ ∆ ) � A ( ∆ ◦ B ) � A ( B ◦ ∆ ) � A ( \ I ) ( / I ) ∆ � A / B ∆ � A \ B ◮ Adding associativity gives us back L: Γ [ ∆ 1 ◦ ( ∆ 2 ◦ ∆ 3 )] � C Γ [( ∆ 1 ◦ ∆ 2 ) ◦ ∆ 3 ] � C ◮ Adding commutativity gives a system called LP: Γ [( ∆ 1 ◦ ∆ 2 )] � C Γ [( ∆ 2 ◦ ∆ 1 )] � C ◮ Clearly, in LP forward and backward slash collapse into a single binary operator. Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 16

  17. Interlude: Syntax/Semantics Interface Review of Types ◮ Recall the simple type system T : • Basic types, throughout these notes e and t , are in T ; • If τ , σ ∈ T , then ( τ → σ ) ∈ T . ◮ We can define a function type : CAT → T such that: • type ( np ) = e ; • type ( s ) = t ; • type ( n ) = ( e → t ) ; • type ( A / B ) = type ( A \ B ) = ( type ( B ) → type ( A )) . Thomas Icard: Surface Reasoning, Lecture 2: Logic and Grammar 17

Recommend


More recommend