130 48 35MB
English Pages 323 [337] Year 2000
Lecture Notes in Computer Science Edited by G. Goos, J. Hartmanis and J. van Leeuwen
1753
Berlin Heidelberg New York Barcelona Hong Kong London Milan Paris Singapore Tokyo
Enrico Pontelli V´ıtor Santos Costa (Eds.)
Practical Aspects of Declarative Languages Second International Workshop, PADL 2000 Boston, MA, USA, January 17-18, 2000 Proceedings
13
Series Editors Gerhard Goos, Karlsruhe University, Germany Juris Hartmanis, Cornell University, NY, USA Jan van Leeuwen, Utrecht University, The Netherlands Volume Editors Enrico Pontelli Department of Computer Science New Science Hall, Box 30001, MS CS New Mexico State University Stewart Street, Las Cruces, NM 88003, USA E-mail: [email protected] V´ıtor Santos Costa COPPE/Sistemas e Computa¸ca˜ o Centro de Tecnologia, Bloco H-319 Universidade Federal do Rio de Janeiro Cx. Postal 68511, Rio de Janeiro, Brazil, CEP:21945-970 E-mail: [email protected] Cataloging-in-Publication data applied for Die Deutsche Bibliothek - CIP-Einheitsaufnahme Practical aspects of declarative languages : second international workshop ; proceedings / PADL 2000, Boston, MA, USA, January 17-18, 2000. Enrico Pontelli ; V´ıtor Santos Costa (ed.). - Berlin ; Heidelberg ; New York ; Barcelona ; Hong Kong ; London ; Milan ; Paris ; Singapore ; Tokyo : Springer, 2000 (Lecture notes in computer science ; Vol. 1753) ISBN 3-540-66992-2
CR Subject Classication (1998): D.3, D.1, F.3, D.2, I.2.3 ISSN 0302-9743 ISBN 3-540-66992-2 Springer-Verlag Berlin Heidelberg New York This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting, reproduction on microlms 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-Verlag. Violations are liable for prosecution under the German Copyright Law. © Springer-Verlag Berlin Heidelberg 2000 Printed in Germany Typesetting: Camera-ready by author SPIN: 10719570 06/3142 – 5 4 3 2 1 0
Printed on acid-free paper
Constraint combination methods are essential for a exible constraint tors: negation, generalized reication, disjunction, and implication. Even though
be exible. Regardless of how many primitive constraints a system offers, combination of primitive constraints into more complex application-specic constraints remains a range of combinators, including negation, generalized reication, disjunction, and con straints, computation spaces allow to program new combinators: they provide exibility on the constraint and on the combinator level. The paper introduces and renes the very
Our experience shows that applications of constraint combinators in nite domain straint domains, like feature or nite set constraints. In particular, they have turned out a more efcient implementation can be attempted. This motivation is similar to the approaches offer a xed set of combinators. This paper’s focus is on the primitives and reied as metaconstraints). Reied constraints reect the validity of a constraint into a 0/1 straints. Computation spaces are not intended as a replacement for reied constraints. As is discussed in detail in Sect. 4, a reication combinator based on computation spaces can offer better propagation in cases where reied constructions propagate poorly. And, since the reication combinator is deep, it offers reication for all expressions, includ reied version. combinator. Sections 4 to 6 discuss a generic reication combinator, a disjunction com
are logic formulae interpreted in a xed rst-order structure. For the purpose of this paper we restrict ourselves to nite domain constraints. A basic nite domain constraint has the form is a nite sub : The propagator amplies the store by functional evaluator operating on the store. As programming language that denes the
’s parent. This justies why we sometimes refer to a solved space as
The concurrent negation combinator takes an expression (as a rst
4 A Generic Reication Combinator As it has been argued in the introduction, reication of constraints is a powerful and natural way to combine constraints. This section presents a generic reication combinator. The reication combinator is shown to sometimes provide stronger constraint propagation than constructions that use reied propagators alone. Reication. The reication of a constraint (a nite reication is to reect whether
Operationally, it is important that reication is bidirectional: that reect validity of constraints allows for powerful means to be reied and
in the rst place. ” of the reication combinator is encoded as follows: takes a nite domain variable, blocks until it becomes deter
The reication combinator is obtained from the implementation of tion that species the expression to reify as input and returns a 0/1-variable: Comparison with Propagator-based Reication. based reication with propagator-based reication. Suppose we are interested in reify are nite domain variables. Similar reied constraints Ideally, the reication mechanism should determine unsatisable. Posting the constraints without reication exhibits failure. Let us rst study reication with propagators alone. In order to obtain a reied Let us now study the behavior of the reication combinator developed in this sec . Indeed, the reication This shows that using spaces for reication can yield better constraint propagation than using per propagator reication. Per propagator reication encapsulates the prop constraint propagation in reied conjunctions. This is a major disadvantage, since reied conjunctions occur frequently as building block in other reied constructions as for example disjunction. On the other hand the generic reication combinator offers weak propagation in by other propagators are tested only. Whenever a reied propagator is available, it is So the reication combinator can be best understood as offering additional techniques but not as a replacement of reied propagators.
This operational semantics can be directly encoded by the reication operator as introduced in Sect. 4. The well-known encoding reies each alternative
However, it can be benecial to also take entailment of alterna
. Since the rst and second alternatives are mutually exclusive (so are the third and fourth), the rst and second reied propagator disappears. . This justies extending the operational semantics of efcient since computations that cannot contribute are discarded early. The computa
The implementation of the disjunctive combinator can be simplied by the following observation: it is sufcient to discard all failed alternatives but the last one. If a (again encoded as rst-class The concurrent controller guarantees the invariant that the rst space to which
argued, this simplied version of disjunction can be expressed by the reication com as introduced in Sect. 3. The reication of expression Programming reication from disjunction has the disadvantage that the expression executed twice. This points out a deciency in the designs of AKL and early versions of Oz, where neither spaces nor reication but disjunction was provided.
inefcient and thus unsatisfactory solution would be to execute the guard expression
does not require a modication of the In the context of a programming language with rst-class functions the sharing of -expression. Without rst-class func
The encoding is simplied in that it does not consider the straightforward handling of As discussed in Sect. 5 it is benecial to consider both failure and entailment of alternatives for the disjunctive combinator. Reduction by entailment is justied by the cation does apply to a clause only if its body is known to be logically equivalent to
A search engine takes a specication of the search problem (as function) and runs
is used to decide whether the rst input list is empty or not). For examples where the
constraint combinators. We have shown how to program negation, generalized reica