Skip to main content

Unnesting of Copatterns

  • Conference paper
Book cover Rewriting and Typed Lambda Calculi (RTA 2014, TLCA 2014)

Abstract

Inductive data such as finite lists and trees can elegantly be defined by constructors which allow programmers to analyze and manipulate finite data via pattern matching. Dually, coinductive data such as streams can be defined by observations such as head and tail and programmers can synthesize infinite data via copattern matching. This leads to a symmetric language where finite and infinite data can be nested. In this paper, we compile nested pattern and copattern matching into a core language which only supports simple non-nested (co)pattern matching. This core language may serve as an intermediate language of a compiler. We show that this translation is conservative, i.e. the multi-step reduction relation in both languages coincides for terms of the original language. Furthermore, we show that the translation preserves strong and weak normalisation: a term of the original language is strongly/weakly normalising in one language if and only if it is so in the other. In the proof we develop more general criteria which guarantee that extensions of abstract reduction systems are conservative and preserve strong or weak normalisation.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Abel, A.: A Polymorphic Lambda-Calculus with Sized Higher-Order Types. PhD thesis, Ludwig-Maximilians-Universität München (2006)

    Google Scholar 

  2. Abel, A., Pientka, B., Thibodeau, D., Setzer, A.: Copatterns: Programming infinite structures by observations. In: Proc. of the 40th ACM Symp. on Principles of Programming Languages, POPL 2013, pp. 27–38. ACM Press (2013)

    Google Scholar 

  3. Augustsson, L.: Compiling pattern matching. In: Jouannaud, J.-P. (ed.) FPCA 1985. LNCS, vol. 201, pp. 368–381. Springer, Heidelberg (1985)

    Chapter  Google Scholar 

  4. Barthe, G., Frade, M.J., Giménez, E., Pinto, L., Uustalu, T.: Type-based termination of recursive definitions. Math. Struct. in Comput. Sci. 14(1), 97–141 (2004)

    Article  MATH  Google Scholar 

  5. Brady, E.: Idris, a general purpose dependently typed programming language: Design and implementation (2013), http://www.cs.st-andrews.ac.uk/~eb/drafts/impldtp.pdf

  6. Cockett, R., Fukushima, T.: About Charity. Technical report, Department of Computer Science, The University of Calgary, Yellow Series Report No. 92/480/18 (June 1992)

    Google Scholar 

  7. Hagino, T.: A typed lambda calculus with categorical type constructors. In: Pitt, D.H., Rydeheard, D.E., Poigné, A. (eds.) Category Theory and Computer Science. LNCS, vol. 283, pp. 140–157. Springer, Heidelberg (1987)

    Chapter  Google Scholar 

  8. Hagino, T.: Codatatypes in ML. J. Symb. Logic 8(6), 629–650 (1989)

    MATH  MathSciNet  Google Scholar 

  9. INRIA. The Coq Proof Assistant Reference Manual. INRIA, version 8.4 edition (2012)

    Google Scholar 

  10. Norell, U.: Towards a Practical Programming Language Based on Dependent Type Theory. PhD thesis, Dept. of Computer Science and Engineering, Chalmers, Göteborg, Sweden (2007)

    Google Scholar 

  11. Severi, P.G.: Normalisation in lambda calculus and its relation to type inference. PhD thesis, Technische Universiteit Eindhoven, Eindhoven, The Netherlands (1996)

    Google Scholar 

  12. Terese. Term Rewriting Systems. Cambridge University Press (2003)

    Google Scholar 

  13. van Raamsdonk, F.: Concluence and Normalisation for Higher-Order Rewriting. PhD thesis, Vrije Universiteit, Amsterdam, The Netherlands (1996)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer International Publishing Switzerland

About this paper

Cite this paper

Setzer, A., Abel, A., Pientka, B., Thibodeau, D. (2014). Unnesting of Copatterns. In: Dowek, G. (eds) Rewriting and Typed Lambda Calculi. RTA TLCA 2014 2014. Lecture Notes in Computer Science, vol 8560. Springer, Cham. https://doi.org/10.1007/978-3-319-08918-8_3

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-08918-8_3

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-08917-1

  • Online ISBN: 978-3-319-08918-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics