TY - GEN
T1 - The Negligible and yet subtle cost of pattern matching
AU - Accattoli, Beniamino
AU - Barras, Bruno
N1 - Publisher Copyright:
© Springer International Publishing AG 2017.
PY - 2017/1/1
Y1 - 2017/1/1
N2 - The model behind functional programming languages is the closed λ -calculus, that is, the fragment of the λ -calculus where evaluation is weak (i.e. out of abstractions) and terms are closed. It is well-known that the number of β (i.e. evaluation) steps is a reasonable cost model in this setting, for all natural evaluation strategies (call-by-name/value/need). In this paper we try to close the gap between the closed λ -calculus and actual languages, by considering an extension of the λ -calculus with pattern matching. It is straightforward to prove that β plus matching steps provide a reasonable cost model. What we do then is finer: we show that β steps only, without matching steps, provide a reasonable cost model also in this extended setting—morally, pattern matching comes for free, complexity-wise. The result is proven for all evaluation strategies (name/value/need), and, while the proof itself is simple, the problem is shown to be subtle. In particular we show that qualitatively equivalent definitions of call-by-need may behave very differently.
AB - The model behind functional programming languages is the closed λ -calculus, that is, the fragment of the λ -calculus where evaluation is weak (i.e. out of abstractions) and terms are closed. It is well-known that the number of β (i.e. evaluation) steps is a reasonable cost model in this setting, for all natural evaluation strategies (call-by-name/value/need). In this paper we try to close the gap between the closed λ -calculus and actual languages, by considering an extension of the λ -calculus with pattern matching. It is straightforward to prove that β plus matching steps provide a reasonable cost model. What we do then is finer: we show that β steps only, without matching steps, provide a reasonable cost model also in this extended setting—morally, pattern matching comes for free, complexity-wise. The result is proven for all evaluation strategies (name/value/need), and, while the proof itself is simple, the problem is shown to be subtle. In particular we show that qualitatively equivalent definitions of call-by-need may behave very differently.
U2 - 10.1007/978-3-319-71237-6_21
DO - 10.1007/978-3-319-71237-6_21
M3 - Conference contribution
AN - SCOPUS:85035068560
SN - 9783319712369
T3 - Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
SP - 426
EP - 447
BT - Programming Languages and Systems - 15th Asian Symposium, APLAS 2017, Proceedings
A2 - Chang, Bor-Yuh Evan
PB - Springer Verlag
T2 - 15th Asian Symposium on Programming Languages and Systems, APLAS 2017
Y2 - 27 November 2017 through 29 November 2017
ER -