[MyWordDocStyle]
title> A Guide to CLP(BNR)
centreblock>
**Constraint Logic Programming over Booleans, Integers and Reals**
**Version 0.11.5, January 2024**
The word "constraint" is used in a variety of contexts from everyday life to physics, mathematics, and other sciences with much the same intuitive meaning, even when the formalization is different. A bead on a wire, a weight on a string, a beaker open to the atmosphere, a space mission limited by onboard fuel, a desert ecology limited by the lack of water are all examples of constrained systems.
[Constraint logic programming] (CLP) refers to the combination of constraints and logic programming. A constraint is declaratively just a relation, usually a mathematical relation, but it differs operationally from other ways of treating relations. As relations, constraints fit very well into logic programming framework which is also based on relations. CLP(X) is a CLP language over a domain of discourse "X". Prolog itself is an instance of CLP over the domain of Herbrand terms with unification as a special case of constraint solving.
CLP(BNR) is an instance of CLP({`RR`}), i.e., CLP over the domain of real numbers. It differs from some other CLP({`RR`})'s in that:
* CLP(BNR) is complete in that any real number can be finitely represented even though the set of reals is infinite. It does this by sacrificing precision: a real number {`R`} is represented by an interval ({`L,U`} where {`L= AA x_j in X_j, 1= Aside: This document was authored using "MyWord", a web publishing application loosely described as a user extensible light weight markup language (think MarkDown). See [MyWord] for more information.
##### Acknowledgements
The original CLP(BNR) on BNR Prolog using interval arithmetic was developed by Bill Older, John Rummell, and Andre Vellino. Fredéric Benhamou extended it to finite domains during a sabbatical to BNR's Computing Research Lab in 1993. Many of the example applications in this guide were taken from a [Carleton University graduate level course] given by Bill Older in 1995. Additional capabilities from the larger CLP community have been incorporated and are referenced in the relevant sections of this User Guide.
This version of CLP(BNR) would not have been possible without an active SWI-Prolog development community led by Jan Wielemaker. In particular, the addition of IEEE compatible floating point arithmetic (non-numbers, rounding modes) and native support for rational numbers resulted in a greatly simplified and more efficient implementation.
TOC> {#id TableOfContents}` `**Contents**
@include
CLPBNR_Module.myw
CLPBNR_SynSem.myw
CLPBNR_PrgCons.myw
CLPBNR_UsingConstraints.myw
CLPBNR_Reference.myw
CLPBNR_DevTools.myw
CLPBNR_Appendices.myw
&
[Constraint logic programming] <- link https://dl.acm.org/doi/abs/10.1145/41625.41635
[Cleary (1986)] <- link https://prism.ucalgary.ca/handle/1880/45818
[BNR Prolog Papers] <- link https://ridgeworks.github.io/BNRProlog-Papers
[BNR Prolog source] <- link https://github.com/ridgeworks/BNRProlog-Source-Archive
[CLP(FD)] <- link https://www.metalevel.at/prolog/clpz
[CLIP] <- link https://scholar.lib.vt.edu/ejournals/JFLP/jflp-mirror/articles/2001/S01-02/JFLP-A01-07.pdf
[Newton] <- link https://www.sciencedirect.com/science/article/pii/S0167642397000087
[Numerica] <- link https://www.sciencedirect.com/science/article/pii/S0004370298000538
[Interval Arithmetic: from Principles to Implementation] <- link http://fab.cba.mit.edu/classes/S62.12/docs/Hickey_interval.pdf
[SWI-Prolog] <- link https://www.swi-prolog.org/
[MyWord] <- link https://github.com/ridgeworks/MyWord
[Introduction to INTERVAL ANALYSIS] <- link https://dl.acm.org/doi/10.5555/1508122
[Carleton University graduate level course] <- link https://www.softwarepreservation.org/projects/prolog/bnr/doc/Older-Introduction_to_CLP%28BNR%29-1995.pdf/view
@import MyWordDocStyle.mmk pkgs/demo.mmk pkgs/toc.mmk pkgs/asciimath.mmk pkgs/tsv.mmk
{` .. `} <- $asciimath\; .myw\; ..\; <-\; myword\; //\; Turn\; off\; fancy\; apostrophe\; so\; it\; can\; be\; used\; as\; single\; quote\; //\; ..\; <-$