gf a logical framework for grammars
play

GF: a Logical Framework for Grammars Aarne Ranta University of - PowerPoint PPT Presentation

GF: a Logical Framework for Grammars Aarne Ranta University of Gothenburg and Digital Grammars AB Estonian-Finnish Logic Meeting Rakvere, 15 November 2015 CLT Contributors Krasimir Angelov, Bjrn Bringert, Grgoire Dtrez, Ramona Enache,


  1. GF: a Logical Framework for Grammars Aarne Ranta University of Gothenburg and Digital Grammars AB Estonian-Finnish Logic Meeting Rakvere, 15 November 2015 CLT

  2. Contributors Krasimir Angelov, Björn Bringert, Grégoire Détrez, Ramona Enache, Erik de Graaf, Thomas Hallgren, Qiao Haiyan, Kaarel Kaljurand, Chotiros Kairoje, Prasanth Kolachina, Hans Leiß, Inari Listenmaa, Peter Ljunnglöf, K.V.S. Prasad, Scharolta Siencnik, Christina Unger, Daniel Vidal, Shafqat Virk, Liza Zimina 50+ GF Resource Grammar Library contributors 150+ GF-dev members

  3. Outline Demo Overview: interlingua and translation Hands-on coding

  4. Demo

  5. Mobile https://play.google.com/store/apps/details?id=org.grammaticalframework.ui.android https://itunes.apple.com/us/app/gf-offline-translator/id1023328422?mt=8

  6. Cloud http://cloud.grammaticalframework.org/

  7. Overview: translation and interlingua

  8. Google translate 16 September 2015

  9. one can learn to name every one of the infinite series of numbers, and thus to write infinitely many different words in an unknown language . The same could be done for all the other words necessary to express all the other things which fall within the purview of the human mind . the discovery of s uch a language depends upon the true philosophy . Descartes, letter to Mersenne, 1629 http://www.autodidactproject.org/other/descartes-lg1.html

  10. Wikipedia

  11. LF = Logical Framework from - one universal logic to - a framework for defining logics - hence, many special-purpose logics Theory: higher-level type theory 1984 Implementations: LF, ALF, Coq, Agda

  12. GF = Grammatical Framework from - one universal grammar to - a framework for defining grammars - hence, many special-purpose grammars

  13. GF = LF + concrete syntax interlingua = logic = abstract syntax concrete syntax : mapping from an interlingua to a language

  14. To achieve precision “ all things which fall within the purview of the human mind” domain-specific interlinguas : - mathematics - tourist phrases - sports - etc, etc

  15. TitleParagraph DefinitionTitle DefPredParagraph type_Sort A_Var contractible_Pred (ExistCalledProp a_Var (ExpSort (VarExp A_Var)) (FunInd centre_of_contraction_Fun) (ForAllProp (BaseVar x_Var) (ExpSort (VarExp A_Var)) (ExpProp (equalExp (VarExp a_Var) (VarExp x_Var))))) FormatParagraph EmptyLineFormat TitleParagraph DefinitionTitle DefPredParagraph (mapSort (mapExp (VarExp A_Var) (VarExp B_Var))) f_Var equivalence_Pred (ForAllProp (BaseVar y_Var) (ExpSort (VarExp B_Var)) (PredProp contractible_Pred (AliasInd (AppFunItInd fiber_Fun) (FunInd (ExpFun (ComprehensionExp x_Var (VarExp A_Var) (equalExp (AppExp f_Var (VarExp x_Var)) (VarExp y_Var)))))))) DefPropParagraph (ExpProp (equivalenceExp (VarExp A_Var) (VarExp B_Var))) (ExistSortProp (equivalenceSort (mapExp (VarExp A_Var) (VarExp B_Var)))) FormatParagraph EmptyLineFormat TitleParagraph LemmaTitle TheoremParagraph (ForAllProp (BaseVar A_Var) type_Sort (PredProp equivalence_Pred (AliasInd (FunInd identity_map_Fun) (FunInd (ExpFun (DefExp (identityMapExp (VarExp A_Var)) (TypedExp (BaseExp (lambdaExp x_Var (VarExp A_Var) (VarExp x_Var))) (mapExp (VarExp A_Var) (VarExp A_Var))))))))) FormatParagraph EmptyLineFormat TitleParagraph ProofTitle AssumptionParagraph (ConsAssumption (ForAssumption y_Var (ExpSort (VarExp A_Var)) (LetAssumption (FunInd (ExpFun (DefExp (fiberExp (VarExp y_Var) (VarExp A_Var)) (ComprehensionExp x_Var (VarExp A_Var) (equalExp (VarExp x_Var) (VarExp y_Var)))))) (AppFunItInd (fiberWrt_Fun (FunInd (ExpFun (identityMapExp (VarExp A_Var)))))))) (BaseAssumption (LetExpAssumption (barExp (VarExp y_Var)) (TypedExp (BaseExp (pairExp (VarExp y_Var) (reflexivityExp (VarExp A_Var) (VarExp y_Var)))) (fiberExp (VarExp y_Var) (VarExp A_Var)))))) ConclusionParagraph (AsConclusion (ForAllProp (BaseVar y_Var) (ExpSort (VarExp A_Var)) (ExpProp (equalExp (pairExp (VarExp y_Var) (reflexivityExp (VarExp A_Var) (VarExp y_Var))) (VarExp y_Var)))) (ApplyLabelConclusion id_induction_Label (ConsInd (FunInd (ExpFun (VarExp y_Var))) (ConsInd (FunInd (ExpFun (TypedExp (BaseExp (VarExp x_Var)) (VarExp A_Var)))) (ConsInd (FunInd (ExpFun (TypedExp (BaseExp (VarExp z_Var)) (idPropExp (VarExp x_Var) (VarExp y_Var))))) BaseInd))) (DisplayExpProp (equalExp (pairExp (VarExp x_Var) (VarExp z_Var)) (VarExp y_Var))))) ConclusionSoThatParagraph (ForConclusion (BaseVar y_Var) (ExpSort (VarExp A_Var)) (ApplyLabelConclusion sigma_elimination_Label (ConsInd (FunInd (ExpFun (TypedExp (BaseExp (VarExp u_Var)) (fiberExp (VarExp y_Var) (VarExp A_Var))))) BaseInd) (ExpProp (equalExp (VarExp u_Var) (VarExp y_Var))))) (PredProp contractible_Pred (FunInd (ExpFun (fiberExp (VarExp y_Var) (VarExp A_Var))))) ConclusionParagraph (PropConclusion (PredProp equivalence_Pred (FunInd (ExpFun (TypedExp (BaseExp (identityMapExp (VarExp A_Var))) (mapExp (VarExp A_Var) (VarExp A_Var))))))) QEDParagraph https://github.com/GrammaticalFramework/gf-contrib/tree/master/homotopy-typetheory

  16. http://www.grammaticalframework.org/demos/phrasebook

  17. ● Svängrumsytan utanför dörren lutar 3% i sidled. ● The turning space outside the gate tilts 3% sideways. ● Kääntymätila oven ulkopuolella kallistuu 3% sivusuunnassa. UttSTD (PredUttTD (AdvNPTD (DetCNTD (DetQuant DefArt NumSg) (UseNTD svängrumsyta_NTD)) (PrepNPTD utanför_Prep (DetCNTD (DetQuant DefArt NumSg) (UseNTD dörr_NTD)))) (AdvVPTD (luta_VPTD (ProcentMeasure 3)) i_sidled_AdvTD)) http://www.t-d.se/sv/TD2/

  18. To achieve coverage “ a language of true philosophy” layered interlinguas : - semantic - syntactic - chunk-based

  19. The Vauquois triangle semantic interlingua syntactic transfer word to word transfer

  20. Embedded interlinguas

  21. A brief history of GF 1994: AR, Type-Theoretical Grammar , OUP 1998: Multilingual Document Authoring at Xerox 2010: MOLTO (Multilingual Online Translation) FP7 2014: GF Offline Translator, Android and iOS

  22. GF resources: 30+ languages Norwegian Danish Afrikaans English Swedish German Dutch French Italian Spanish Catalan Romanian Bulgarian Finnish Estonian Polish Japanese Thai Chinese Hindi Russian Latvian Mongolian Urdu Punjabi Sindhi Greek Maltese Nepali Persian Latin Turkish Hebrew Arabic Amharic Swahili

  23. GF community: 150+ members

  24. The GF book A. Ranta. Grammatical Framework: Programming with Multilingual Grammars , CSLI, Stanford, 2011. Chinese translation by Prof. Yan Tian: 语 法框架 为 多种自 然 语 言 语 法 编 程 , Shanghai Jiao Tong University Press, 2014.

  25. Translation model: multi-source multi-target compiler

  26. Compiling Java to JVM 00000100 00000101 1 + 2 * 3 00000110 01101000 01100000

  27. Word alignments 00000100 1 00000101 + 2 00000110 * 01101000 3 01100000

  28. Abstract syntax 00000100 Add 00000101 1 + 2 * 3 00000110 N1 Mul 01101000 01100000 N2 N3

  29. More concrete syntaxes 00000100 1 + 2 * 3 00000101 Add 00000110 01101000 N1 Mul 01100000 N2 N3 the sum of 1 and the la somme de 1 et du product of 2 and 3 produit de 2 et de 3

  30. How it is defined Abstract syntax fun Add : Exp -> Exp -> Exp Concrete syntax, Java lin Add x y = x ++ “+” ++ y Concrete syntax, JVM lin Add x y = x ++ y ++ “01100000”

  31. Compiling to natural language Concrete syntax, English lin Add x y = “the sum of” ++ x ++ “and” ++ y Concrete syntax, French lin Add x y = “la somme” ++ de x ++ “et” ++ de y

  32. Subject-verb-object predication abstract fun Pred : NP -> VP -> S fun Compl : TV -> NP -> VP concrete SVO: lin Pred np vp = np ++ vp lin Compl tv np = tv ++ np SOV: lin Pred np vp = np ++ vp lin Compl tv np = np ++ tv

  33. What about VSO? Linearization can produce strings or records . Each category has a linearization type lincat S, NP = Str lincat VP = {verb : Str ; obj : Str} lin Pred np vp = vp.verb ++ np ++ vp.obj lin Compl tv np = {verb = tv ; obj = np}

  34. Agreement Pred we_NP (Compl love_TV) she_NP we love her Pred she_NP (Compl love_TV) we_NP she loves us

  35. Agreement lincat TV = Number => Str lincat NP = {s : Case => Str ; n : Number} lin she_NP = { s = table {Nom => “she” ; Acc => “her”} ; n = Sg } lin Pred np vp = np.s ! Nom ++ vp ! np.n lin Compl tv np = table {n => tv ! n ++ np.s !Acc}

  36. Expressivity of GF GF source language - type theory + functional programming - static type checking - module system PGF machine language - Portable Grammar Format (binary) - PMCFG (Parallel Multiple Context-Free Grammar)

  37. GF forms of judgement cat C fun f : C 1 )-> … -> C n )-> C lincat C = T o -> … -> A n o -> A o lin f = t : A 1

  38. GF with dependent types cat C (x 1 : A 1 )...(x n : A n ) fun f : (x 1 : A 1 ) -> … -> (x n : A n ) -> A lincat C = T o -> … -> A n o -> A o lin f = t : A 1

  39. GF functional programming oper f : T = t param P = C 1 P 1 | … | C n P n module system functors libraries binary runtime (PGF = Portable Grammar Format)

  40. GF source

  41. probability model GF source

  42. probability model GF compiler PGF GF binary source

  43. PGF PGF runtime binary system

  44. PGF user interface PGF runtime binary system

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