Unnesting of copatterns
Paper in proceeding, 2014

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. © 2014 Springer International Publishing Switzerland.

codata

copattern matching

abstract reduction system

weak normalisation

Pattern matching

coalgebras

strong normalisation

conservative extension

algebraic data types

ARS

Author

A. Setzer

Swansea University

Andreas Abel

University of Gothenburg

B. Pientka

McGill University

D. Thibodeau

McGill University

Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)

03029743 (ISSN) 16113349 (eISSN)

Vol. 8560 LNCS 31-45

25th International Conference on Rewriting Techniques and Applications, RTA 2014 and 12th International Conference on Typed Lambda Calculus and Applications, TLCA 2014
Vienna, Austria,

Subject Categories

Computer and Information Science

DOI

10.1007/978-3-319-08918-8_3

More information

Latest update

8/8/2023 2