gf mmt glf
play

GF + MMT = GLF From Language to Semantics through LF Michael - PowerPoint PPT Presentation

GF + MMT = GLF From Language to Semantics through LF Michael Kohlhase Jan Frederik Schaefer Friedrich-Alexander-Universit at Erlangen-N urnberg LFMTP Vancouver, June 22, 2019 1 / 35 Natural Language Semantics run ( mary )


  1. GF + MMT = GLF From Language to Semantics through LF Michael Kohlhase Jan Frederik Schaefer Friedrich-Alexander-Universit¨ at Erlangen-N¨ urnberg LFMTP Vancouver, June 22, 2019 1 / 35

  2. Natural Language Semantics run ′ ( mary ′ ) ∧ happy ′ ( john ′ ) “ Mary runs and John is happy. ” ∀ x . love ′ ( x , mary ′ ) “ Everyone loves Mary. ” “ He loves her. ” ∃ X M , Y F . love’ ( X M , Y F ) ¬ ◇ run ′ ( john ′ ) “ John isn’t allowed to run. ” 2 / 35

  3. Natural Language Semantics Definition NL semantics studies the meaning of NL utterances How could we do this? Look at a fragment of English and define a suitable logic [Mon70] ↝ we could cheat a little: run ′ ( mary ′ ) ∧ happy ′ ( mary ′ ) “ Mary runs. She is happy. ” ↝ describe the translation as well 3 / 35

  4. Natural Language Semantics induces M = ⟨D , I⟩ ⊧ ⊆ FL × FL ⊧ ≡ ⊢ C ? I ϕ formulae ⊢ C ⊆ FL × FL FL Analysis ⊧ N L ≡ ⊢ C ? induces ⊧ N L ⊆ NL × NL NL Comp Ling 4 / 35

  5. Natural Language Understanding (NLU) Systems Semantics Semantic Construction Analysis Syntax Logic Logic (compositional) (inferential) Tree Expression Expression parsing NL Utterance 5 / 35

  6. The Grammatical Logical Framework (GLF) parsing Semantics NL Utterance Syntax Logic Construction Tree Expression GF MMT (Grammatical Framework) Transition trivial: compatible logical frameworks GF = grammar development framework + MMT = logic development framework GLF = semantics development framework 6 / 35

  7. The Example ∀ x . run ′ ( x ) “ Everyone runs. ” ∃ x . happy ′ ( x ) “ Someone is happy. ” happy ′ ( john ′ ) ∧ happy ′ ( mary ′ ) “ John and Mary are happy. ” Fragment of English Target logic: FOL 7 / 35

  8. The Grammatical Framework (GF) [Ran11] ● GF is a programming language for multilingual grammar applications ● Abstract syntax : describes parse trees ● Concrete syntaxes : language-specific linearization rules makeStmt abstract syntax john be_happy ⋯ ⋯ “ Johann ist ⋯ “ John is happy ” concrete syntaxes gl¨ ucklich ” 8 / 35

  9. Describing the Fragment in GF – Abstract Syntax abstract Gossip = { cat Actor; Action; Stmt; fun everyone : Actor; someone : Actor; makeStmt : Actor -> Action -> Stmt; twoOf : Actor -> Actor -> Actor; } abstract GossipLex = Gossip ** { fun makeStmt john, mary : Actor; run : Action; twoOf be_happy be_happy : Action; } mary john makeStmt (twoOf john mary) be_happy 9 / 35

  10. Describing the Fragment in GF – Concrete Syntax concrete GossipEng of Gossip = { lincat Actor = Str; Action = Str; Stmt = Str; lin everyone = "everyone"; someone = "someone"; makeStmt actor action = actor ++ action; twoOf a b = a ++ "and" ++ b; } concrete GossipLexEng of GossipLex = GossipEng ** { lin john = "John"; mary = "Mary"; run = "runs"; be_happy = "is happy"; } 10 / 35

  11. 11 / 35

  12. Describing the Fragment in GF – Concrete Syntax Problem “ John is happy ” vs “ John and Mary are happy ” Solutions ● More sophisticated grammar rules ● Use the resource grammar library 12 / 35

  13. Describing the Fragment in GF – Concrete Syntax concrete GossipEng of Gossip = { param Plurality = Sg | Pl; lincat Actor = {s : Str; p : Plurality }; Action = Plurality => Str; Stmt = Str; lin everyone = {s = "everyone"; p = Sg }; someone = {s = "someone"; p = Sg }; makeStmt actor action = actor.s ++ action ! actor.p ; twoOf a b = {s = a.s ++ "and" ++ b.s; p = Pl }; } 13 / 35

  14. Describing the Fragment in GF – Concrete Syntax Resource Grammar Library : grammar rules for 36 languages concrete GossipEng of Gossip = open SyntaxEng, DictEng in { lincat Actor = NP; Action = VP; Stmt = S; lin everyone = everyone_NP; someone = someone_NP; makeStmt actor action = mkS (mkCl actor action); twoOf a b = mkNP and_Conj a b; } 14 / 35

  15. Where are we? makeStmt “ John and Mary ↦ twoOf be_happy are happy ” mary john parsing Semantics NL Utterance Syntax Logic Construction Tree Expression GF MMT (Grammatical Framework) 15 / 35

  16. MMT – “anything you can do we can do meta” [RK13] ● You may remember “Rapid Prototyping Formal Systems in MMT: 5 Case Studies” [MR19] ● Meta meta theories/meta meta tool set ● Little theories ● Bring your own logic ● Logic development environment ● Foundation-independent 16 / 35

  17. From GF to MMT Abstract syntax (GF) Language theory (MMT) abstract Gossip = { theory Gossip : ur:?LF = cat : type ∥ Actor; Actor Action : type ∥ Action; : type ∥ Stmt; Stmt fun everyone : Actor ∥ everyone : Actor; : Actor ∥ someone : Actor; someone makeStmt : makeStmt : Actor → Action → Stmt ∥ Actor->Action->Stmt; twoOf:Actor → Actor → Actor ∥ twoOf:Actor->Actor->Actor; } � makeStmt ↦ makeStmt (twoOf john mary) be happy twoOf be_happy mary john 17 / 35

  18. Where are we? makeStmt (twoOf john mary) be happy “ John and Mary are happy ” makeStmt (twoOf john mary) be happy parsing Semantics NL Utterance Syntax Logic Construction Tree Expression GF MMT (Grammatical Framework) 18 / 35

  19. Target Logic and Domain Theory in MMT theory FOL : ur:?LF = ∥ prop : type | # o : o → o → o | # 1 ∧ 2 ∥ and : o → o | # ¬ 1 ∥ neg : o → o → o | # 1 ∨ 2 | or = [x,y] ¬ ( ( ¬ x) ∧ ( ¬ y) ) ∥ ∥ ind : type | # ι forall : ( ι → o) → o | # ∀ 1 ∥ exists : ( ι → o) → o | # ∃ 1 | = [p] ¬ ( ∀ [x] ( ¬ p x)) ∥ � theory DomainTheory : ?FOL = ∥ mary : ι | # mary’ ∥ john : ι | # john’ : ι → o | # run’ 1 ∥ run happy : ι → o | # happy’ 1 ∥ � 19 / 35

  20. Where are we? makeStmt (twoOf john mary) be happy “ John and Mary (happy’ john’) ∧ (happy’ mary’) are happy ” makeStmt (twoOf john mary) be happy parsing Semantics NL Utterance Syntax Logic Construction Tree Expression GF MMT (Grammatical Framework) 20 / 35

  21. Semantics Construction in MMT Gossip FOL Actor , Action , Stmt o ,ι ∧ , ¬ , ∨ everyone , someone , ∀ , ∃ makeStmt , twoOf GossipLex DomainTheory john ′ , mary ′ , john , mary , run ′ , happy ′ run , be happy 21 / 35

  22. Naive Approach view GossipSem : ?Gossip -> ?FOL = = o ∥ Stmt = ι → o ∥ Action = ι ∥ Actor everyone = ??? ∥ = ??? ∥ someone makeStmt = [a, ϕ ] ϕ a ∥ = ??? ∥ twoOf � view GossipLexSem : ?GossipLex -> ?DomainTheory = include ?GossipSem ∥ = john’ ∥ john = mary’ ∥ mary = [x] run’ x ∥ run be_happy = [x] happy’ x ∥ � 22 / 35

  23. Type Raising [Mon74] Problem Actor = ι everyone : Actor = ? Solution Actor = ( ι → o) → o john = [ ϕ ] ϕ john’ everyone = [ ϕ ] ∀ [x] ( ϕ x) = [ ϕ ] ∀ ϕ Example “ everyone runs ” ↦ ↝ β ([ ϕ ] ∀ [x] ( ϕ x)) run’ ∀ [x] (run’ x) 23 / 35

  24. Better Approach view GossipSem : ?Gossip -> ?FOL = = o ∥ Stmt = ι → o ∥ Action = ( ι → o) → o ∥ Actor everyone = [ ϕ ] ∀ ϕ ∥ = [ ϕ ] ∃ ϕ ∥ someone makeStmt = [a, ϕ ] a ϕ ∥ = [a1,a2] [ ϕ ] (a1 ϕ ) ∧ (a2 ϕ ) ∥ twoOf � view GossipLexSem : ?GossipLex -> ?DomainTheory = include ?GossipSem ∥ = [ ϕ ] ϕ john’ ∥ john = [ ϕ ] ϕ mary’ ∥ mary = [x] run’ x ∥ run be_happy = [x] happy’ x ∥ � 24 / 35

  25. Better Approach view GossipSem : ?Gossip -> ?FOL = = o ∥ Stmt = ι → o ∥ Action = ( ι → o) → o ∥ Actor everyone = [ ϕ ] ∀ ϕ ∥ = [ ϕ ] ∃ ϕ ∥ someone makeStmt = [a, ϕ ] a ϕ ∥ = [a1,a2] [ ϕ ] (a1 ϕ ) ∧ (a2 ϕ ) ∥ twoOf � These views are described in NL semantics papers like [Mon74]: view GossipLexSem : ?GossipLex -> ?DomainTheory = include ?GossipSem ∥ = [ ϕ ] ϕ john’ ∥ john = [ ϕ ] ϕ mary’ ∥ mary = [x] run’ x ∥ run be_happy = [x] happy’ x ∥ � 24 / 35

  26. Example “ John and Mary are happy ” ↓ parse makeStmt (twoOf john mary) be happy ↓ semantics construction ([a, ϕ ] a ϕ ) (([a1,a2] [ ϕ ] (a1 ϕ ) ∧ (a2 ϕ )) ([ ϕ ] ϕ john’) ([ ϕ ] ϕ mary’)) ([x] happy’ x) ↓ simplify ([a1,a2, ϕ ] (a1 ϕ ) ∧ (a2 ϕ )) ([ ϕ ] ϕ john’) ([ ϕ ] ϕ mary’) happy’ ↓ simplify ([ ϕ ] ( ϕ john’) ∧ ( ϕ mary’)) happy’ ↓ simplify (happy’ john’) ∧ (happy’ mary’) 25 / 35

  27. Other Examples (from paper) Adding Transitive Verbs ( ↝ more type raising) “ John and Mary love everyone ” ↓ ∀ [x: ι ](love’ john’ x) ∧ (love’ mary’ x) 26 / 35

  28. Other Examples (from paper) (Multi) Modal Logic Modalities: ● deontic – something is obligatory ( � d � ) or permissible ( ⟪ d ⟫ ) ● epistemic – someone believes something is true ( � e john’ � ) or possible ( ⟪ e john’ ⟫ ). “ John doesn’t believe that Mary has to run ” ↓ ¬ � (e john’) �� d � (run’ mary’) . 27 / 35

  29. GLF Script Please enter a sentence: John isn’t allowed to run I got the following interpretations: ¬⟪ d ⟫ (run’ john’) Please enter a sentence: Mary believes that John doesn’t have to run I got the following interpretations: � (e mary’) � ¬ � d � (run’ john’) Please enter a sentence: 28 / 35

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend