Integration of Finite Domain Constraints in KiCS2

A constraint programming system usually consists of two main components: a modelling language used to describe a constraint satisfaction problem and a constraint solver searching for solutions to the given problem by applying specific algorithms. As constraint programming and functional logic languages share some common features, like computing with logic variables or the use of backtracking for non-deterministic search, it is reasonable to embed a modelling language for finite domain constraints in a functional logic language like Curry. Due to the absence of side effects or global state over non-deterministic computations in Curry, the implementation of a stateful constraint solver is rather difficult. In this paper we consider KiCS2, a Curry compiler translating Curry programs into Haskell programs. In order to embed finite domain constraints in KiCS2, we propose a new implementation technique compatible with the purely functional nature of its back end. Our implementation collects finite domain constraints occurring during a program run and passes them to a constraint solver available in Haskell whenever solutions are requested.

[1]  Michael Hanus,et al.  Search strategies for functional logic programming , 2012, Software Engineering.

[2]  J. A. Robinson,et al.  A Machine-Oriented Logic Based on the Resolution Principle , 1965, JACM.

[3]  Michael Hanus,et al.  Implementing Equational Constraints in a Functional Language , 2011, PADL.

[4]  Michael Hanus,et al.  Declarative Programming with Function Patterns , 2005, LOPSTR.

[5]  Peter J. Stuckey,et al.  Programming with Constraints: An Introduction , 1998 .

[6]  Heinrich Hußmann,et al.  Nondeterministic Algebraic Specifications and Nonconfluent Term Rewriting , 1992, J. Log. Program..

[7]  Lennart Augustsson,et al.  Functional Pearl: On generating unique names , 1994, Journal of Functional Programming.

[8]  Ramin Sadre,et al.  Pakcs: The portland aachen kiel curry system , 2000 .

[9]  Uday S. Reddy,et al.  Narrowing as the Operational Semantics of Functional Languages , 1985, SLP.

[10]  Michael Hanus,et al.  Set functions for functional logic programming , 2009, PPDP '09.

[11]  Michael Hanus,et al.  Compiling Multi-Paradigm Declarative Programs into Prolog , 2000, FroCoS.

[12]  Michael Hanus,et al.  New Functional Logic Design Patterns , 2011, WFLP.

[13]  Fernando Sáenz-Pérez,et al.  Solving Combinatorial Problems with a Constraint Functional Logic Language , 2003, PADL.

[14]  M. Hanus,et al.  Curry: An Integrated Functional Logic Language , 2003 .

[15]  Michael Hanus,et al.  Functional Logic Programming: From Theory to Curry , 2013, Programming Logics.

[16]  Antonio J. Fern,et al.  Constraint functional logic programming over finite domains , 2006 .

[17]  Peter J. Stuckey,et al.  Monadic constraint programming , 2009, Journal of Functional Programming.

[18]  Francisco Javier López-Fraguas,et al.  TOY: A Multiparadigm Declarative System , 1999, RTA.

[19]  Peyton Jones,et al.  Haskell 98 language and libraries : the revised report , 2003 .

[20]  Manuel V. Hermenegildo,et al.  A Syntactic Approach to Combining Functional Notation, Lazy Evaluation, and Higher-Order in LP Systems , 2006, FLOPS.

[21]  J. C. Gonz Alez-Moreno,et al.  An Approach to Declarative Programming Based on a Rewriting Logic , 2022 .

[22]  Tom Schrijvers,et al.  Expressive models for Monadic Constraint Programming , 2010 .

[23]  Michael Hanus,et al.  Overlapping Rules and Logic Variables in Functional Logic Programs , 2006, ICLP.

[24]  Michael Hanus,et al.  Functional logic programming , 2010, CACM.

[25]  Michael Hanus,et al.  KiCS2: A New Compiler from Curry to Haskell , 2011, WFLP.

[26]  Joxan Jaffar,et al.  Constraint logic programming , 1987, POPL '87.

[27]  Michael Hanus,et al.  Curry: an integrated functional logic language (version 0 , 2003 .