Comparison of Priority Rules in Pattern Matching and Term Rewriting

Programming languages such as ML provide function calls with pattern matching. For each function, there is a given set of patterns for arguments with the corresponding definition of the function. Cases corresponding to different patterns of a given function may not be exclusive, and often a priority rule (typically the order of the program text) is followed to disambiguate overlapping cases. In this paper, term rewriting systems are taken as models for function calls with pattern matching. It is shown that, in the useful set of constructors based linear systems, all priority rules are essentially equivalent. Moreover the translation from one rule to another one may be mechanically done. These results hold both for lazy and eager evaluations.

[1]  Pierre-Louis Curien Categorical Combinators, Sequential Algorithms, and Functional Programming , 1993, Progress in Theoretical Computer Science.

[2]  Alain Laville Lazy pattern matching in the ML language , 1987, FSTTCS.

[3]  Lennart Augustsson,et al.  A compiler for lazy ML , 1984, LFP '84.

[4]  Gordon D. Plotkin,et al.  Call-by-Name, Call-by-Value and the lambda-Calculus , 1975, Theor. Comput. Sci..

[5]  Gerard Huet,et al.  Conflunt reductions: Abstract properties and applications to term rewriting systems , 1977, 18th Annual Symposium on Foundations of Computer Science (sfcs 1977).

[6]  D. A. Turner,et al.  Miranda: A Non-Strict Functional language with Polymorphic Types , 1985, FPCA.

[7]  Ascánder Suárez,et al.  Implementing functional languages in the Categorical Abstract Machine , 1986, LFP '86.

[8]  Michel Mauny Compilation des Langages Fonctionnels dans les Combinateurs Catégoriques -- Application au langage ML , 1985 .

[9]  Patrick Borras,et al.  Centaur: the system , 1988, Software Development Environments.

[10]  Rod M. Burstall,et al.  HOPE: An experimental applicative language , 1980, LISP Conference.

[11]  Luca Cardelli,et al.  Compiling a functional language , 1984, LFP '84.

[12]  Jean-Pierre Jouannaud,et al.  Functional Programming Languages and Computer Architecture , 1985, Lecture Notes in Computer Science.

[13]  Gérard P. Huet,et al.  Confluent Reductions: Abstract Properties and Applications to Term Rewriting Systems , 1980, J. ACM.

[14]  Pierre Weis,et al.  The CAML reference manual , 1990 .

[15]  Robin Milner,et al.  A proposal for standard ML , 1984, LFP '84.