Functional and Constraint Logic Programming

Total Page:16

File Type:pdf, Size:1020Kb

Functional and Constraint Logic Programming Lecture Notes in Computer Science 6816 Commenced Publication in 1973 Founding and Former Series Editors: Gerhard Goos, Juris Hartmanis, and Jan van Leeuwen Editorial Board David Hutchison Lancaster University, UK Takeo Kanade Carnegie Mellon University, Pittsburgh, PA, USA Josef Kittler University of Surrey, Guildford, UK Jon M. Kleinberg Cornell University, Ithaca, NY, USA Alfred Kobsa University of California, Irvine, CA, USA Friedemann Mattern ETH Zurich, Switzerland John C. Mitchell Stanford University, CA, USA Moni Naor Weizmann Institute of Science, Rehovot, Israel Oscar Nierstrasz University of Bern, Switzerland C. Pandu Rangan Indian Institute of Technology, Madras, India Bernhard Steffen TU Dortmund University, Germany Madhu Sudan Microsoft Research, Cambridge, MA, USA Demetri Terzopoulos University of California, Los Angeles, CA, USA Doug Tygar University of California, Berkeley, CA, USA Gerhard Weikum Max Planck Institute for Informatics, Saarbruecken, Germany Herbert Kuchen (Ed.) Functional and Constraint Logic Programming 20th International Workshop, WFLP 2011 Odense, Denmark, July 19, 2011 Proceedings 13 Volume Editor Herbert Kuchen Westfälische Wilhelms-Universität Münster Institut für Wirtschaftsinformatik Leonardo-Campus 3, 48149 Münster, Germany E-mail: [email protected] ISSN 0302-9743 e-ISSN 1611-3349 ISBN 978-3-642-22530-7 e-ISBN 978-3-642-22531-4 DOI 10.1007/978-3-642-22531-4 Springer Heidelberg Dordrecht London New York Library of Congress Control Number: 2011931683 CR Subject Classification (1998): F.4, F.3.2, D.3, I.2.2-5, I.1 LNCS Sublibrary: SL 1 – Theoretical Computer Science and General Issues © Springer-Verlag Berlin Heidelberg 2011 This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting, reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer. Violations are liable to prosecution under the German Copyright Law. The use of general descriptive names, registered names, trademarks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. Typesetting: Camera-ready by author, data conversion by Scientific Publishing Services, Chennai, India Printed on acid-free paper Springer is part of Springer Science+Business Media (www.springer.com) Preface This volume contains the proceedings of the 20th International Workshop on Functional and (Constraint) Logic Programming (WFLP 2011), held in Odense, Denmark, July 19, 2011 at the University of Southern Denmark. WFLP aims at bringing together researchers interested in functional programming, (constraint) logic programming, as well as the integration of the two paradigms. It promotes the cross-fertilizing exchange of ideas and experiences among researchers and students from the different communities interested in the foundations, appli- cations and combinations of high-level, declarative programming languages and related areas. The previous editions of this workshop were: WFLP 2010 (Madrid, Spain), WFLP 2009 (Brasilia, Brazil), WFLP 2008 (Siena, Italy), WFLP 2007 (Paris, France), WFLP 2006 (Madrid, Spain), WCFLP 2005 (Tallinn, Estonia), WFLP 2004 (Aachen, Germany), WFLP 2003 (Valencia, Spain), WFLP 2002 (Grado, Italy), WFLP 2001 (Kiel, Germany), WFLP 2000 (Benicassim, Spain), WFLP 1999 (Grenoble, France), WFLP 1998 (Bad Honnef, Germany), WFLP 1997 (Schwarzenberg, Germany), WFLP 1996 (Marburg, Germany), WFLP 1995 (Schwarzenberg, Germany), WFLP 1994 (Schwarzenberg, Germany), WFLP 1993 (Rattenberg, Germany), and WFLP 1992 (Karlsruhe, Germany). Since its 2009 edition, the WFLP proceedings have been published by Springer in its Lec- ture Notes in Computer Science series, as volumes 5979 and 6559, respectively. Each submission of WFLP 2011 was peer-reviewed by at least three Program Committee members with the help of some external experts. The Program Com- mittee meeting was conducted electronically in May 2011 with the help of the conference management system EasyChair. After careful discussions, the Pro- gram Committee selected ten submissions for presentation at the workshop. Nine of them were considered mature enough to be published in these proceedings. On behalf of the Program Committee, I would like to thank all researchers, who gave talks at the workshop, contributed to the proceedings, and submitted papers to WFLP 2011. As Program Chair, I would also like to thank all mem- bers of the Program Committee and the external reviewers for their careful work. Moreover, I am pleased to acknowledge the valuable assistance of the conference management system EasyChair and to thank its developer Andrei Voronkov for providing it. Finally, all the participants of WFLP 2011 and I are deeply indebted to Peter Schneider-Kamp and his team, who organized the Odense Summer on Logic and Programming, which besides WFLP comprised the 21st International Symposium on Logic-Based Program Synthesis and Transformation (LOPSTR 2011), the 13th International ACM SIGPLAN Symposium on Principles and Practice of Declarative Programming (PPDP 2011), and the 4th International Workshop on Approaches and Applications of Inductive Programming (AAIP 2011). All the local organizers did a wonderful job and provided invaluable sup- port in the preparation and organization of the overall event. May 2011 Herbert Kuchen Organization Program Chair Herbert Kuchen University of M¨unster, Germany Program Committee Mar´ıa Alpuente Universidad Polit´ecnica de Valencia, Spain Sergio Antoy Portland State University, USA Rafael Caballero-Rold´an Universidad Complutense, Madrid, Spain Olaf Chitil University of Kent, UK Rachid Echahed Institut IMAG, Laboratoire Leibniz, France Santiago Escobar Universidad Polit´ecnica de Valencia, Spain Moreno Falaschi University of Siena, Italy Sebastian Fischer National Institute of Informatics, Tokyo, Japan Michael Hanus Christian-Albrechts-Universit¨at Kiel, Germany Julio Mari˜no y Carballo Universidad Polit´ecnica de Madrid, Spain Janis Voigtl¨ander Universit¨at Bonn, Germany Additional Reviewers Demis Ballis Ra´ul Gutierrez Pablo Nogueira Local Organization Chair Peter Schneider-Kamp University of Southern Denmark, Odense, Denmark Table of Contents Functional Logic Programming KiCS2: A New Compiler from Curry to Haskell ...................... 1 Bernd Braßel, Michael Hanus, Bj¨orn Peem¨oller, and Fabian Reck New Functional Logic Design Patterns .............................. 19 Sergio Antoy and Michael Hanus XQuery in the Functional-Logic Language Toy ....................... 35 Jesus M. Almendros-Jim´enez, Rafael Caballero, Yolanda Garc´ıa-Ruiz, and Fernando S´aenz-P´erez Functional Programming Size Invariant and Ranking Function Synthesis in a Functional Language ....................................................... 52 Ricardo Pe˜na and Agustin D. Delgado-Mu˜noz Memoizing a Monadic Mixin DSL .................................. 68 Pieter Wuille, Tom Schrijvers, Horst Samulowitz, Guido Tack, and Peter Stuckey A Functional Approach to Worst-Case Execution Time Analysis ....... 86 V´ıtor Rodrigues, M´ario Florido, and Sim˜ao Melo de Sousa Building a Faceted Browser in CouchDB Using Views on Views and Erlang Metaprogramming ......................................... 104 Claus Zinn Integration of Constraint Logic and Object-Oriented Programming Logic Java: Combining Object-Oriented and Logic Programming ....... 122 Tim A. Majchrzak and Herbert Kuchen Term Rewriting On Proving Termination of Constrained Term Rewrite Systems by Eliminating Edges from Dependency Graphs ........................ 138 Tsubasa Sakata, Naoki Nishida, and Toshiki Sakabe Author Index .................................................. 157 KiCS2: A New Compiler from Curry to Haskell Bernd Braßel, Michael Hanus, Bj¨orn Peem¨oller, and Fabian Reck Institut f¨ur Informatik, CAU Kiel, D-24098 Kiel, Germany {bbr,mh,bjp,fre}@informatik.uni-kiel.de Abstract. In this paper we present our first steps towards a new system to com- pile functional logic programs of the source language Curry into purely func- tional Haskell programs. Our implementation is based on the idea to represent non-deterministic results as values of the data types corresponding to the results. This enables the application of various search strategies to extract values from the search space. We show by several benchmarks that our implementation can compete with or outperform other existing implementations of Curry. 1 Introduction Functional logic languages integrate the most important features of functional and logic languages (see [8,24] for recent surveys). In particular, they combine higher-order func- tions and demand-driven evaluation from functional programming with logic program- ming features like non-deterministic search and computing with partial information (logic variables). The combination of these features has led to new design patterns [6] and better abstractions for application programming, e.g., as shown for programming with databases [14,18], GUI programming [21], web programming [22,23,26], or string parsing [17]. The implementation of functional logic languages is challenging since a reasonable
Recommended publications
  • An Improved Reductant Calculus Using Fuzzy Partial Evaluation Techniques
    An Improved Reductant Calculus using Fuzzy Partial Evaluation Techniques Pascual Juli´an a Gin´es Moreno b Jaime Penabad c aDept. of Information Technologies bDept. of Computing Systems and Systems cDept. of Mathematics ESI, Univ. of Castilla–La Mancha EPSA, Univ. of Castilla–La Mancha Paseo de la Universidad, 4; Campus Universitario, s/n; 13071 Ciudad Real, Spain 02071 Albacete, Spain Abstract Partial evaluation (PE) is an automatic program transformation technique aiming to obtain, among other advantages, the optimization of a program with respect to parts of its input: hence, it is also known as program specialization. This paper introduces the subject of PE into the field of fuzzy logic programming. We define the concept of PE for multi-adjoint logic programs and goals, and apart from discussing the benefits achieved by this technique, we also introduce in the fuzzy setting a completely novel application of PE which allows us the computation of reductants guaranteeing completeness properties without harming the computational efficiency. Reductants are a special kind of fuzzy rules which constitute an essential theoretical tool for proving correctness properties. As observed in the specialized literature, a multi-adjoint logic program, when interpreted on a partially ordered lattice, has to include all its reductants in order to preserve the (approximate) completeness property. This introduces severe penalties in the implementation of efficient multi- adjoint logic programming systems: not only the size of programs increases but also their execution time. In this paper we define a refinement to the notion of reductant based on PE techniques, that we call P E-reductant.
    [Show full text]
  • Lecture Notes in Computer Science 5321 Commenced Publication in 1973 Founding and Former Series Editors: Gerhard Goos, Juris Hartmanis, and Jan Van Leeuwen
    Lecture Notes in Computer Science 5321 Commenced Publication in 1973 Founding and Former Series Editors: Gerhard Goos, Juris Hartmanis, and Jan van Leeuwen Editorial Board David Hutchison Lancaster University, UK Takeo Kanade Carnegie Mellon University, Pittsburgh, PA, USA Josef Kittler University of Surrey, Guildford, UK Jon M. Kleinberg Cornell University, Ithaca, NY, USA Alfred Kobsa University of California, Irvine, CA, USA Friedemann Mattern ETH Zurich, Switzerland John C. Mitchell Stanford University, CA, USA Moni Naor Weizmann Institute of Science, Rehovot, Israel Oscar Nierstrasz University of Bern, Switzerland C. Pandu Rangan Indian Institute of Technology, Madras, India Bernhard Steffen University of Dortmund, Germany Madhu Sudan Massachusetts Institute of Technology, MA, USA Demetri Terzopoulos University of California, Los Angeles, CA, USA Doug Tygar University of California, Berkeley, CA, USA Gerhard Weikum Max-Planck Institute of Computer Science, Saarbruecken, Germany Nick Bassiliades Guido Governatori Adrian Paschke (Eds.) Rule Representation, Interchange and Reasoning on the Web International Symposium, RuleML 2008 Orlando, FL, USA, October 30-31, 2008 Proceedings 13 Volume Editors Nick Bassiliades Aristotle University of Thessaloniki Department of Informatics Thessaloniki, Greece E-mail: [email protected] Guido Governatori National ICT Australia Queensland Research Laboratory St Lucia, Queensland, Australia E-mail: [email protected] Adrian Paschke Free University Berlin Chair for Corporate Semantic Web Berlin, Germany E-mail: [email protected] Library of Congress Control Number: Applied for CR Subject Classification (1998): D.3.1, F.3.2, H.5.3 LNCS Sublibrary: SL 2 – Programming and Software Engineering ISSN 0302-9743 ISBN-10 3-540-88807-1 Springer Berlin Heidelberg New York ISBN-13 978-3-540-88807-9 Springer Berlin Heidelberg New York This work is subject to copyright.
    [Show full text]
  • Approximate Reasoning by Similarity-Based SLD Resolution
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by Elsevier - Publisher Connector Theoretical Computer Science 275 (2002) 389–426 www.elsevier.com/locate/tcs Approximate reasoning by similarity-based SLD resolution Maria I. Sessa Dip. Matematica e Informatica, Universitaà di Salerno, via S. Allende, I-84081 Baronissi (SA), Italy Received February 2000; revised February 2001; accepted March 2001 Communicated by G. Levi Abstract In (Gerla and Sessa, Fuzzy Logic and Soft Computing, Kluwer, Norwell, 1999, pp. 19–31) a methodology that allows to manage uncertain and imprecise information in the frame of the declarative paradigm of Logic Programming has been proposed. With this aim, a Similarity rela- tion R between function and predicate symbols in the language of a logic program is considered. Approximate inferences are then possible since similarity relation allows us to manage alterna- tive instances of entities that can be considered “equal” with a given degree. The declarative semantics of the proposed transformation technique of logic programs is analyzed. The notion of fuzzy least Herbrand model is also introduced. In this paper the corresponding operational semantics is provided by introducing a modiÿed version of SLD resolution. This top-down refu- tation procedure overcomes failure situations in the uniÿcation process by using the similarity relation. A generalized notion of most general uniÿer provides a numeric value which gives a measure of the exploited approximation. In this way, the SLD resolution is enhanced since it is possible both to handle uncertain or imprecise information, and to compute approximate answer substitutions, with an associated approximation-degree, when failures of the exact inference pro- cess occur.
    [Show full text]