Skip to main content

Introducing a Calculus of Effects and Handlers for Natural Language Semantics

  • Conference paper
  • First Online:
Formal Grammar (FG 2015, FG 2016)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9804))

  • 447 Accesses

Abstract

In compositional model-theoretic semantics, researchers assemble truth-conditions or other kinds of denotations using the lambda calculus. It was previously observed [26] that the lambda terms and/or the denotations studied tend to follow the same pattern: they are instances of a monad. In this paper, we present an extension of the simply-typed lambda calculus that exploits this uniformity using the recently discovered technique of effect handlers [22]. We prove that our calculus exhibits some of the key formal properties of the lambda calculus and we use it to construct a modular semantics for a small fragment that involves multiple distinct semantic phenomena.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Notes

  1. 1.

    This kind of distinction is the same distinction as the one between a mathematical function and a function in a programming language, which might have all kinds of side effects and therefore not be an actual function.

  2. 2.

    Side effects are to programming languages what pragmatics are to natural languages: they both study how expressions interact with the worlds of their users. It might then come as no surprise that phenomena such as anaphora, presupposition, deixis and conventional implicature yield a monadic description.

  3. 3.

    Also known as monad transformers in functional programming.

  4. 4.

    Pronounced “banana”. See [20] for the introduction of banana brackets.

  5. 5.

    The two types \(\alpha \) and \(\beta \) are to be seen as the operation’s input and output types, respectively.

  6. 6.

    These are similar to recursors/paramorphisms. See [20] for the difference. Catamorphisms are also known as folds and the common higher-order function fold found in functional programming languages is actually the iterator/catamorphism for lists.

  7. 7.

    1 is the unit type whose only element is written as \(\star \).

  8. 8.

    Other solutions to this problem include separating the language of logical forms and the metalanguage used in the semantic lexical entries to manipulate logical forms as objects [13].

  9. 9.

    Our \(\mathcal {C}\) has been inspired by an operator of the same name proposed in [9]: de Groote introduces a structure that specializes applicative functors in a similar direction as monads by introducing the \(\mathcal {C}\) operator and equipping it with certain laws; our \(\mathcal {C}\) operator makes the \(\mathcal {F}_E\) type constructor an instance of this structure.

  10. 10.

    In our limited fragment, we will only see it sneak out of a quantifier.

  11. 11.

    Multiple occurrences of the same \(\mathtt {op}_i\) are alright, since those are not metavariables.

  12. 12.

    The definition of (non-trivial) overlap is the same one as the one used when defining critical pairs. See [16] for the precise definition.

References

  1. Barker, C.: Continuations and the nature of quantification. Nat. Lang. Semant. 10(3), 211–242 (2002)

    Article  Google Scholar 

  2. Bauer, A., Pretnar, M.: Programming with algebraic effects and handlers (2012). arXiv preprint: arXiv:1203.1539

  3. Brady, E.: Programming and reasoning with algebraic effects and dependent types. In: ACM SIGPLAN Notices (2013)

    Google Scholar 

  4. Charlow, S.: On the semantics of exceptional scope. Ph.D. thesis, New York University (2014)

    Google Scholar 

  5. de Groote, P.: Towards abstract categorial grammars. In: Proceedings of the 39th Annual Meeting on Association for Computational Linguistics (2001)

    Google Scholar 

  6. de Groote, P.: Type raising, continuations, and classical logic. In: Proceedings of the Thirteenth Amsterdam Colloquium (2001)

    Google Scholar 

  7. de Groote, P.: Towards a Montagovian account of dynamics. In: Proceedings of SALT, vol. 16 (2006)

    Google Scholar 

  8. Giorgolo, G., Asudeh, A.: Natural language semantics with enriched meanings (2015)

    Google Scholar 

  9. de Groote, P.: On logical relations and conservativity. In: Third Workshop on Natural Language and Computer Science, NLCS 2015 (2015)

    Google Scholar 

  10. Hobbs, J., Rosenschein, S.: Making computational sense of montague’s intensional logic. Artif. Intell. 9(3), 287–306 (1977)

    Article  MathSciNet  MATH  Google Scholar 

  11. Kammar, O., Lindley, S., Oury, N.: Handlers in action. In: ACM SIGPLAN Notices (2013)

    Google Scholar 

  12. Kamp, H., Reyle, U.: From Discourse to Logic. Kluwer Academic Pub, Dordrecht (1993)

    MATH  Google Scholar 

  13. Kiselyov, O.: Applicative abstract categorial grammars. In: Proceedings of the Third Workshop on Natural Language and Computer Science (2015)

    Google Scholar 

  14. Kiselyov, O., Sabry, A., Swords, C.: Extensible effects: an alternative to monad transformers. In: ACM SIGPLAN Notices (2013)

    Google Scholar 

  15. Kiselyov, O., Shan, C.: Lambda: the ultimate syntax-semantics interface (2010)

    Google Scholar 

  16. Klop, J.W., Van Oostrom, V., Van Raamsdonk, F.: Combinatory reduction systems: introduction and survey. Theor. Comput. Sci. 121(1–2), 279–308 (1993)

    Article  MathSciNet  MATH  Google Scholar 

  17. Klop, J.W., et al.: Term rewriting systems. Handb. Logic Comput. Sci. 2, 1–116 (1992)

    Article  MathSciNet  Google Scholar 

  18. Lebedeva, E.: Expression de la dynamique du discours à l’aide de continuations. Ph.D. thesis, Université de Lorraine (2012)

    Google Scholar 

  19. Maršík, J., Amblard, M.: Algebraic effects and handlers in natural language interpretation. In: Natural Language and Computer Science, July 2014

    Google Scholar 

  20. Meijer, E., Fokkinga, M., Paterson, R.: Functional programming with bananas, lenses, envelopes and barbed wire. In: Functional Programming Languages and Computer Architecture (1991)

    Google Scholar 

  21. Moggi, E.: Notions of computation and monads. Inf. Comput. 93(1), 55–92 (1991)

    Article  MathSciNet  MATH  Google Scholar 

  22. Plotkin, G., Pretnar, M.: Handlers of algebraic effects. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 80–94. Springer, Heidelberg (2009)

    Chapter  Google Scholar 

  23. Potts, C.: The Logic of Conventional Implicatures. Oxford University Press, Oxford (2005)

    Google Scholar 

  24. Pretnar, M.: Logic and handling of algebraic effects. Ph.D. thesis, The University of Edinburgh (2010)

    Google Scholar 

  25. Qian, S., Amblard, M.: Event in compositional dynamic semantics. In: Pogodalla, S., Prost, J.-P. (eds.) Logical Aspects of Computational Linguistics. LNCS, vol. 6736, pp. 219–234. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  26. Shan, C.: Monads for natural language semantics. arXiv:cs/0205026v1 (2002)

  27. Shan, C.: Linguistic side effects. Ph.D. thesis, Harvard University (2005)

    Google Scholar 

  28. Van Eijck, J., Unger, C.: Computational Semantics with Functional Programming. Cambridge University Press, Cambridge (2010)

    Book  MATH  Google Scholar 

  29. Wadler, P.: The essence of functional programming. In: Proceedings of the 19th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (1992)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jirka Maršík .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Maršík, J., Amblard, M. (2016). Introducing a Calculus of Effects and Handlers for Natural Language Semantics. In: Foret, A., Morrill, G., Muskens, R., Osswald, R., Pogodalla, S. (eds) Formal Grammar. FG FG 2015 2016. Lecture Notes in Computer Science(), vol 9804. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-53042-9_15

Download citation

  • DOI: https://doi.org/10.1007/978-3-662-53042-9_15

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-662-53041-2

  • Online ISBN: 978-3-662-53042-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics