Binary prefix operators
[Note: If you have comments please post them at the Prolog Community Discourse for this PIP]
In preparation. The current text is the initial
proposal for this PIP by François Fages, Inria Saclay,
Palaiseau, France; Francois.Fages@inria.fr
,
from the 2024 PIP
workshop.
Allowing binary prefix operators fxx in op/3 as implemented in Eclipse would make the parsing of MiniZinc easy
Constraint programming techniques are particularly successful at solving discrete optimization problems such as resource allocation, scheduling or transport problems which are ubiquitous in the industry. Although historically introduced in the mid 80’s with the generalization of Prolog to the class of Constraint Logic Programming languages, those techniques are mainly used today through constraint solving libraries in standard programming languages such as C++, Java, Python, and mainly taught with constraint-based modeling languages such as MiniZinc [3] or Essence.
A MiniZinc model is usually transformed in a FlatZinc model in which the high-level constructs have been eliminated and replaced by a flat constraint satisfaction problem that can be solved by a wide variety of constraint solvers parsing FlatZinc syntax. This is the way for instance SICStus-Prolog is interfaced with FlatZinc as a general purpose constraint solver [2] to solve problems modeled in MiniZinc and participate in MiniZinc competitions.
There is however interest for interpreting MiniZinc directly in Prolog in order to combine in a single programming environment pure constraint-based modeling aspects with programming aspects for search, visualization and interface to data for example. We have developed a SWI-Prolog pack named modeling to offer MiniZinc modeling features with set comprehension, subscripted variables and functional notations in Prolog.
Allowing fxx declarations for operators as in
op(1140, fxx, forall)
would provide an easy
way to parse whole MiniZinc expressions such as
forall (I, J in 1..N) something(I, J);
Binary prefix operators declared with option
fxx
in op/3
are implemented in
Eclipse system [1] but, to the best of our knowledge, not
in other Prolog systems yet.
Keywords:
op/3 · prefix operators · MiniZinc · modeling languages · constraint logic programming.
References
Apt, K., Wallace, M.: Constraint Logic Programming using Eclipse. Cambridge University Press (2006)
Mats Carlsson et al.: Sicstus 4.2.3 (2012), https://sicstus.sics.se/
The Zinc team: MiniZinc web page (2023), http://www.minizinc.org/