The Negligible and Yet Subtle Cost of Pattern Matching

Beniamino Accattoli 1 Bruno Barras 2
1 PARSIFAL - Proof search and reasoning with logic specifications
LIX - Laboratoire d'informatique de l'École polytechnique [Palaiseau], Inria Saclay - Ile de France
Abstract : 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. This work is part of a wider research effort, the COCA HOLA project [3].
Document type :
Conference papers
Complete list of metadatas

Cited literature [38 references]  Display  Hide  Download
Contributor : Beniamino Accattoli <>
Submitted on : Thursday, January 4, 2018 - 1:58:31 PM
Last modification on : Wednesday, March 27, 2019 - 4:41:29 PM
Long-term archiving on: Wednesday, May 2, 2018 - 9:26:36 PM


Accattoli, Barras - The Neglig...
Files produced by the author(s)


  • HAL Id : hal-01675369, version 1


Beniamino Accattoli, Bruno Barras. The Negligible and Yet Subtle Cost of Pattern Matching. Programming Languages and Systems - 15th Asian Symposium, Nov 2017, Suzhou, China. ⟨hal-01675369⟩



Record views


Files downloads