Basic Pattern Matching Calculi: Syntax, Reduction, Confluence, and Normalisation

The pattern matching calculus is a refinement of λ-calculus that integrates mechanisms appropriate for fine-grained modelling of non-strict pattern matching. In comparison with the functional rewriting strategy that is usually employed to define the operational semantics of pattern-matching in non-strict functional programming languages like Haskell or Clean, the pattern matching calculus allows simpler and more local definitions to achieve the same effects. The main device of the calculus is to further emphasise the clear distinction between matching failure and undefinedness already discussed in the literature by embedding into expressions the separate syntactic category of matchings. This separation is also important to properly restrain the possible effects of the non-monotonicity that a näıve treatment of matching alternatives would exhibit. The language arising from that distinction turns out to naturally encompass the pattern guards of Peyton Jones and Erwig and conventional Boolean guards as special cases of the intermediate stages of matching reduction. By allowing a confluent reduction system and a normalising strategy, the pattern matching calculus provides a new basis for operational semantics of non-strict programming languages and also for implementations.

[1]  Mark Tullsen,et al.  First Class Patterns , 2000, PADL.

[2]  Marko C. J. D. van Eekelen,et al.  Functional Programming and Parallel Graph Rewriting , 1993 .

[3]  Delia Kesner,et al.  Pattern matching as cut elimination , 2004, Theor. Comput. Sci..

[4]  Delia Kesner,et al.  Reasoning about Layered, Wildcard and Product Patterns , 1994, ALP.

[5]  Jan Willem Klop,et al.  Combinatory reduction systems , 1980 .

[6]  Philip Wadler,et al.  Views: a way for pattern matching to cohabit with data abstraction , 1987, POPL '87.

[7]  Simon L. Peyton Jones,et al.  The Implementation of Functional Programming Languages , 1987 .

[8]  Claude Kirchner,et al.  Combining Higher-Order and First-Order Computation Using Rho Calculus: Towards a Semantics of ELAN , 1998 .

[9]  James Brotherston,et al.  A Formalised First-Order Con uence Proof for the λ-Calculus Using One-Sorted Variable Names (Barendregt Was Right after all ... almost) , 2001 .

[10]  Val Tannen,et al.  A typed pattern calculus , 1993, [1993] Proceedings Eighth Annual IEEE Symposium on Logic in Computer Science.

[11]  Claude Kirchner,et al.  Exceptions in the Rewriting Calculus , 2002, RTA.

[12]  Luc Maranget,et al.  Optimizing pattern matching , 2001, ICFP '01.

[13]  Luc Maranget,et al.  Two Techniques for Compiling Lazy Pattern Matching , 1994 .

[14]  William L. Harrison,et al.  Fine Control of Demand in Haskell , 2002, MPC.

[15]  Julien Forest,et al.  A Weak Calculus with Explicit Operators for Pattern Matching and Substitution , 2002, RTA.

[16]  Simon L. Peyton Jones,et al.  Pattern Guards and Transformational Patterns , 2000, Electron. Notes Theor. Comput. Sci..

[17]  Femke van Raamsdonk,et al.  Higher-Order Rewriting , 1999, RTA.

[18]  Tobias Nipkow,et al.  A Proof Assistant for Higher-Order Logic , 2002 .

[19]  Claude Kirchner,et al.  Pure patterns type systems , 2003, POPL '03.

[20]  James Brotherston,et al.  A formalised first-order confluence proof for the -calculus using one-sorted variable names , 2003, Inf. Comput..

[21]  Marinus J. Plasmeijer,et al.  Theorem Proving for functional Programmers - Sparkle: A Functional Theorem Prover , 2001 .

[22]  Claude Kirchner,et al.  The rewriting calculus - Part II , 2001, Log. J. IGPL.

[23]  Vincent van Oostrom,et al.  Comparing Combinatory Reduction Systems and Higher-order Rewrite Systems , 1993, HOA.

[24]  Delia Kesner,et al.  Expression Reduction Systems with Patterns , 2003, RTA.