From: AAAI-86 Proceedings. Copyright ©1986, AAAI (www.aaai.org). All rights reserved.
DOhIAINS
European
Computer-industr)
Resrarrh
IN
LOGIC
(‘entrfs
(E. (‘.I] (’
prcjblerns
(CSP).
ABSTRACT.
When
the
confronted
“generate
with
b
Also.
control
guages
fall
short
generated
values
In
eliminating
together
in
use
modification
of the
semantics
of
new
evaluable
out
an>
This
extension
of
function
chanpe
a new
control
and
as soon
to
mechanism.
can
to
t casting
search
space
the
does
ahead
strategies,
be
combined
a strategy
which
procedural
>)
2.
of
a
Ul’ith-
more
its
vincing
mechanism.
active
of
search
efforts
to
solutions
of
state
constraints
applied
to
procedure
appear
develop
powerful
more
is
the
more
areas,
although
control
of
there
for
constraint
satisfaction
inadequacies
were
and
\uch
“a
an
thr,
approach
are
after
the
continual
attack
behaviour
1977)
is
the
a
for
remed)
real
overhead
the
a constraint.
pathological
(Mackworth.
a?
1 he
Thus,
w a\”
satisfl
the
a+
clasc
IS tested
posteriori
important
thl<
values
backtracking
not
I hf,>
of
a< Soon
for
constramt
do not
and
See
use
one
a
an
facts
does
introduces
is another
different
can
kinds
of
the
together
of
problems
be defined
use
reducing
as fol-
of
the
-4 s6ume
,.‘.,
finite
set
be
existence
A-f.
I.
1
called
seen
the
as
a
of J
,’ Y1. 1. ,.
J’ ,’
2 “’ M
constraint
possible
ose
supp
CSP
values
is related
labeling,
domain
of
relation
which
f
to
graph
man)
se1
A’,
the
on
anes
d e f’
a
to
satisfy
problems
isomorphisms.
J
takes
iis
.4
variable.
a
in
graph
variables
from
constraint
subhef
of
<u,.
in
variables
the
of
values
nor-empty
set
problem
of values
assignments
finite
a
variable
satisfaction
assignments
responding
of
each
tuples
to
that
like
colourmg
all
the
space
has
been
foruard
Elliot.
1380)
a
C
sa).
=
ficlent
th
cor-
class
that
a conto
cause
when
thtq
of
not
puzzles.
an
and
proposi-
new
of
fact.
actike
t ively.
a logic
the
nece+
This
and
of
of
will
not
creates
affairs
AI LANGUAGES
order
comw
can
languages
lack
from
efan
IPW
cfficlency
fact
AND ARCHITECTURES
to
a
for
define
more
that
of
Ah
primltlves
ct,nst raints
the
and
l’rolog.
dlfflcult
SCPI~IS
use
mow
requires
full
abc,\e
It
be
readat)le
the
as
implement*.
thii
level
to
cons-
be considered
which
lesh
allow
a
(tlarallcb
for
a constraint
general11
to
constraints.
in
facing
basis
1978)
backtrack
solver
However.
leads
programming
mechanisms
state
II
does
II
simylr
writren
programs.
appeared
is the
procedure:,)
(H hich
t)e
strategy.
because
treatment
control
can
the
When
program
in
removing
(F’reuder
problem
1978)
effort.
logic
a
an
cannot
19i7).
of
about
consists
b)
approach
ahead
Alire.
Prolog
programs
which
h
speak
which
manner
This
Iooklng
(Laurierr.
usual
approaches
values
refinements
in
programming
maintenable
matter
and
priori”
(Ilackuort
III
will
198.5)
19i8).
checking.
checking
the
“a
of
meta-interpreter)
imporlant
logical
used
problem.
of
a forward
these
an
(E’rrudcr
problrms
kind
m
tc~rhnique~
(i.e
(wr
((;allairr.
combinations
which
satisfaction
uM>
The
constraints.
Al
1
determine
such
search
search
a
constraints
to use
constraints
in a solution
binatorial
jx,,x,
way
the
consist enc!
and
of
of
same
hut
inconsistencies.
proposed
satisfaction
problem
of
substantial
the
mechanisms.
satisfactor)
case
,4 constraint
and
and,
entirely
IlOt
This
(CSP).
scene
h
can
their
an
-pace.
tr3ts
value\
Intelligent
affairs
problems
in
5carch
“apply
rrceived
backtracking.
example.
active
IS
are
problems.
The
15 very
uses
pasql\r
best-suited
thr
the
merhaniqms.
reduced
the
the
restrIcted
on
13 not
generated
draw back>
main
of (chronological)
nat uralI>
a dela!
bacbt rack
as possible.
Prolog
can
simple
bacctrack,rlgi
rrlechanism\
have
the
reduce
their
bawd
these
is only
that
redlscoberjing
intelligent
ib
which
variables
space
of
t hew
With
discovering
can
b&ause
which
its
as
The
Motivations
As
The
ottters.
chi-or,o~u~~caI
mechanisms
CSP
problems.
smn
There
1.
with
heuristic5
search
and
introducing
implemented
apphes
arnoug
Indeed.
possible“
a
of the
in
roroutining
the
<.
without
with
proving
frr.st senr~l~
control
short
conat ralnts.
in
efficientlj
and
pc>NerfuI
active
impede
not
be implemented
can
an
consists
5.
[del)th
fall
domain
for
languages.
theorem
search
81 \\ cst-(;ernlan>
con-
appear
the
allows
( p ,
of
cannot
introduce
procedure
look
when
for
redefinition
techniques
Moreover.
direct11
the
search
use
which
logic
tronal
Munich
lan-
restrlcted
This
predicates
and
the
consistency
in programs.
leads
built-in
is to
language.
unification,
some
choices
remedy
17 D-WJO
Prolog
passiveI>
which
Arahellast,
lnefficifnt
programming
pruning
values
reading
constraints.
their
used
of
One
logic
actively
programming
(logic)
of
are
for
is particular\
for
because
not
a solution.
declarative
this
CSP
combinations
in logic
of
defined
consrraints
and
sat isfaction
of Prolog
mechanisms
Indeed.
concept
strateg!
test“
strainta.
h
constraint
PROCNAMhfJNG
ac(first
/ 759
order)
Nom
bvld
t/luS
clauSes
prevenb
III~I Zlncr
lhe
case
HoNever,
variables
the
in
to restrict
the
range
to
techniques
in
logic
declarations
straints
actively
procedural
to
the
an
actlbe
The
For
is modified
and
Lion
of the
unification,
the
of some
built-in
predicates
with
function.
usual
heuristics
extension
refered
and
implementation
Domain
It
is
the
but
this
programming
for
cate
this
n
Herbrand
15 a
set
of
m
logic
the
for
a logic
the
-extended”
logic
defined
shown
built
how
from
our
The
1986)
variables
for
range
some
tunity
basic
stantially
reader
is
A domain
account.
of the
a
are
following
H.
means
these
Indeed,
D
are
for
predi-
although
quite
programming
of
program.
language
(Cohn.
In
facL.
The
the
It
that
1).
values
can
procedural
1X
of the
reduce
it.
way
use
both
to
directions
of
the
pas-
CO use
the
non-
logic
which
are
the
increases
for
solving
in
sub(‘SF’.
“a
an
in-
opppor-
set.
manner
for
instance.
of Prolog
space
reduce
semantics
For
its
15 the
from
with
possible
search
set
arguments
programming
posteriori”
used
“3”
thp
take>
~ this
combined
the
a d-
refer4
computation.
Jnit.iallJ
passive
when
as
are
a d-variable
remove
in the
”a
the
active
the
logic
prune
the
and
of
priori”
Prolog.
the
gap
the
built-in
between
predicates
the
programming
proposed
1985).
by
(ho~alski,
3.
Procedural
semantics.
invarlant
of all
are
proposed
extensions
a cardinality
has
1
finit 1% and
in
explicit
be considered
from
the
of Lhese
which
declarative
case
is well-known
must
CSP
the
In
set
defined.
defined
the
on this
greater
value
is that
than
can
t,he domain
1. If domains
directl!
be
of
of car-
assigned
to
the
domain.
domain
semantics
the
many-sorted
that
man)-sorted
of
modified
l
proposed
definitions
Ilnification.
1s clear
that
the
to
the
unification
The
variable\
handle
the
three
Lake
must
following
into
account
mu51
algorithm
unification
c&es
of
as a kind
one
It
is
If a h-cariable
h-variable
must
l
If a consrant
variable
is
of
domain
fails.
l
If
be considered
logic
of
3.1.
i
<atlsfactory.
The fact that we only considered
constanls
i> 11) no wa?
definitions
given
here cdn be extended
CO arblLrar1
gruund
generalization
is not considered
here for clarity
arld bre\it>
ENGINEERING
to
of
I$ one
to
is an
to
of
this
of
two
unification
/
onl>
Aloreover.
this
can
be used
constraints.
declarative
rr-trirtive
The
term*
LIUI the
and
a d-x ariable
must
be buu nd 10 the
of
fails.
must,
their
be
If D,=(v)
unified,
If
then
then
D,
let
I),
IS empr!.
v is bound
to
t*
The
domain
of a variable
ran
the
be unified.
the dif it is in the
the
uniflcat ion
unified.
domains.
be
d-variable.
and a d-variable
must
bound
to the
constant
the
variable.
Otherwise.
d-variables
inLersection
760
of
allows
instead
a d-variable
argument
A:,
full\
effect
is a particular
1983).
o\er
different
interpretations
use
efficiency
this
The
i of p ranges
rnran*
can
constraints
a constraint
is refered
n.
are
declarations
This
of
the
a variable
variables
in which
the
contrarily
such
tirne
be determmed.
This
following.
Other
can
variable.
handle
the
an)
determIne
logic
form.
argument
it
ranges
declarations
domain
<
that
Otherwise.
uhich
domain
class
in
this
i
the
the
to
a logic (II-
an unmrted
in
used
domain
I),.
of values
3” can
of generating
variables
1 5
but
#
be
definition
at
set
such
counterparts
In
is noted
using
finite
in
introduced
declaration
the
constraints
manner
clearly
declarations
of
stantiated.
more
over
be expressed
Domain
universe.
of meta-knowledge
in
the
H or Dm
to
the
The
reduce
is
compared
(i.e.
“X
only
can
finlt,e
domain
domain
set
no
can
1984 !) .
O’licefe,
and
i6 that
Lariable.”
Moreover,
set
equality
a new
and
its
a constraint
sible
senlan-
and
and
are discussed.
cannot
varlableh
following,
usual11
>)
>
-3
given
be
Dincbas,
is an expression
is fixed.
constants
to
that
into
ai is equal
the
the
case
ai is either
m
in a modiflca-
of each
explicit
definition
p:<a ,..... a 3,.
n
over
number
Lhr
dinalit!
domain
When
con-
use.
which
declarations
of a d-variable
and
information
fact
p of arity
where
using
here.
languages.
t,aking
it
can
issues
for
have
h-variable.
value)
declarations.
often
domain
Final]).
and
defined
<.
are
domain
procedural
the
5.
as
possible,
this
consist5
uf
f .
techniques
Hentenryck
features
thi,
op-
(hl\ crdt
MeA
domain
and
IllSi alIce
oj thir paper
domain
an
variable
consisLenc>
int.roduces
interest
examples
programs.
consist,ency
the
(
ion
The
tor
new point
IOUM procedural
with
lanthe
the main
definiLion
in generators
and
Buf
logic.
predicates
checking,
its
Of
domain
(SW
progra mm in g
in-
programming
supporting
redefinition
some
and
Lo (Van
on all
2.
Next.
Prolog
and
discussed
tics
generally
logic
sect
vari-
informatlon
of constraints
ne.xt
programming
is
the
this
monadic
forward
for
the
IS generalI>
but
more
use
pro,dlcate
CsllS,der
in CSP.
in10
natural)!
like
semantics
evaluable
or
concept
implement
and
and
restricted
of variables
directly
leads
portunity
which
permut.ation(X.J’)
domain
the
of
them.
pr~Igrarnmlng.
universe
more
like
us,na
Iuglc
In
applications
much
predicates
Introducing
guages
and
properties
I-Mm
Herbrand
in many
is finite
is hidden
sotnettmes
Interpreter
01 var~ablcs.
,)ver
ranpe
.obscure
tire
be determined
a~ cornpile
time
the
the
both
the
be
variables.
OtherwIse,
both
Z who*
variable
new
ble
varla
d OIllalll
IS
are
bownd
to
a
fhy,t
D 2’
three
cascts.
If 4
cae.
predicate
3.2.
Built-in
The
real
logic
in
t hi
can
of
of
the
I he
nr,w takr
Inlo
acr,ounl
declarallve
is
not
of this
lo
predicate
exrension
also
the
1s nor
only
thra procedural
in
predlcat
domain
es.
These
plere.
a generator
that.
in
of 1 ariables
predicate
However.
the
IS given
the
by
is n S
usual
following
#
Y holds
If
procedural
semant
KS
is
with
succeed
because
will
3.2.2.
where
use
=
not(G)
is
of such
gap
between
equality
the
the
plete.
Our
and
predicates
and
semantics
are
must
reduces
which
the
an
is a
A
selects
in
only
there
safe
the
Moreover,
provided
gap
the
semantics.
only
ground.
allows
Thus,
Moreover,
procedural
be
semantics
also
rule.
one.
defined
the)
J.
procedural
procedural
and
be
when
X
failure”
is a passive
*must
predicates
for
as
declarative
rule
values
“negation
non-
to
be
com-
active
use
of
these
the
declarative
between
=
and
J’ are
J”‘.
This
#
1. is defined
tween
the
of
D,\{Y}.
If
1’ is a constant,
DZ={v).
then
X
is
let
D,
unified
Y is a d-variable
and
t(o the previous
one.
If X and Y are constants,
and Y are distinct
constants
Its
effect
is undefined
X
f
and
Note
(hat
this
hanoui
and
dela?
In
the
this
definition
like
wait,
X 1s a con-
constraint
there
very
efjiricnt
way
sists
in
tht
using
a
Indeed.
two
siblc
when
of
only
procedural
no
to
handk
sensea.
a
variable.
one
,(Dincbas.
Second,
first
cases
an
it
ran
it
value
is equivalenr
way
he
is
to
in
cases
a
assign
left
the
as
a
for
laalue
this
declarative
order
to
d-
should
\
HIII
take.
usual
: “X
and
there
in the
than
If D,
{v}.
entails
1.0
only
a
be-
semantics.
The
cases
then
then
if X
or equal
as follows.
following
is empty,
=
if D,
seman-
is a discontinuity
procedural
be redefined
integers
<_ J’ succeeds
semantics
Also,
declarative
J’ are
procedural
X is less
procedural
the
uhose
X
[#hen let sui
D, = D, \
_< Y must.
X is bound
Y succeeds.
Otherwise,
5 Y succeeds
X
to
is bound
fail
If
v and
X
to
Z and
u
con-
and
one.
Y
is
Otherwisp.
this
predicate
n value5
a value
with
a
that
this
X
The
fail.
predicate
domain
It
for
others
is clear
handling
that
In
the
predicates
removes
and
it can
the
last
If D,
succeed.
inequalIty
which
of a variable
is suboptimal.
j’ should
5
active
an
a variable.
mechanism
X
to
is undefined.
the
implementation
{4..5.6).
1he same
is
from
to
delay
should
its effect
a d-
Note
{ 1,2.3}
same
can
0
can
combined
be
case.
=
which
also
and
D,
wa).
Y
5
be
defined
in
N
giving
to
waj.
possible.
active
from
to
in-
i< a
\
l
I,...or
is
to
which
ab
aa
and
for
f
If X and 1’ are Instantiated
to int,eger values,
<
J‘ succeeds
if X is less than
or equal
J’ Others ise, it fails.
assign
is fulfilled.
soon
value
delay
usill lead
this
cnmidered
remove
cm
1984)
and
a
(Colmerauer.
constraints
actite
c an
with
1985),
three
non-equality
in
predicate
Firsi,
consistent
semantics
of the
undefined
construfnt
combined
1983)
one
are
non-equality
dijjerent
bet
until
be
.‘\
j
.
Therefore.
(Naish,
Caneghem.
\-an
rase.
easily
integers
and
can
The
,The case where
X is an integer
variable
15 similar
to the previous
l
to
Y succeeds
if X
fails ot,herwise.
freeze,
Y”
Note
11
and
if X and
following
constraint.
declarative
5
X
otherwise.
can
geler,
i,e prnvlljPd.
If X is a d-variable,
Y is an integer
= {I’: V E D, and V > Y} and
l
or
mechanism
1.
the
v
and X # 1 succeeds.
Otherwise,
X is bound
Z (whose domain
is Dz) and X f- Y succeeds.
The case where
stant
is similar
X
“X
IO J‘”
the
again.
1’ succeeds
be
with
that
J”‘ holds
P~IIB~
to
scmamtlcs
5
5
is the
this
not,
and
or
time
use
b>
If X is d-variable
fulfilled,
Indf,rd
predicate
values
fuure
~rcl~,r 1~1 tie r.,)m-
(1.2.3)
the
predicates
“2;
instantiated
sup.
X
the
by
predicate
passive
and
=
then
is
In
1’ mu>{
d,
the
cages
suboptimal.
the
d non-equality
predicates.
than
this
X
three
X and
with
w hal*ver
Se&&
HoMe\Pr.
is
(4.5.6;.
here
X is less
procedural
a generator
order
d-variable
is given
11~s of
a constraint
computation
of
Y).
for
semantic>
ES IIT
semantics
only
be differenl.
semantics
not(X
f’rrg
of values
I),
consider
and
th(b
the
whrch
be sound
Inequality
We
clause
X#Y+
a
variable
they
ICS of the
Y”.
X
rule
will
this
fact.
stance.
between
III~C of
the
predicates
gap
semantics
sa>.
in
part.
predicate.
semant
equal
but
+OIIIP built-in
Non-equality
The
domain
language
r(Ldpfinll IOTI of
3.2.1.
X
interest
part
whrn
procedural
predicates.
The
csmputabolr
safe
the
a
variable
variable.
one
m
pob-
The
in
the
3.2.3.
Domain
The
extensions
the
duce
user
a
dorrlain(X)
an
primitives.
presented
access
new
to
so far
can
t,he possible
set
evaluable
returns
the
function
list
AI LANGUAGES
of
be improved
domain(X)
instances
by
We
of a variable.
of
(which
a term
uhlch
AND ARCHITECTURES
intro-
holds
if
satisfy
/ 761
dolltalns) whose procedural
the
domain(
\)
the
=
IS a ground
= [x-j If x
IS undefmrd
function
for
u<lng.
hold\
can
if S
u\eful
i> an
when
be used
to
generate
values
fnr
“rrlernt~erO;.d(,rrlalrlO;))”
elerrrrnt
the
term
ot herwlqe
be used
ins1 ante.
is
IIst of all t hc values
of N I\ a d-h ariablr
in D,
Thrh
semana~cs
“first
of the
fail”
a d-variable
where
list
J. *‘.
principle
and
This
b>
function
The
five-queens
is quite
arc-consistency
are
(see below).
Examples
the
In
nlechanlsms.
search
ue
The
first
procedure
logical
Inlrrpreler.
second
extension
a “data-driven
language
one
problem)
can
LO
need
one
is a logical
with
computation”
as.
for
Steele.
the
basic
how
a
which
in
also
can
the
a
meta-
specific
mechanism
instance,
in
shows
lead
to
constraint
satisfies
Control
provided
by
possible
and
Prolog
(Clark
MU-Prolog
N-queens
The
X
sLrateg>
worr>
chooses
\ alues
for
this
the
rhe
past”
value
other
assigncld
problem
to
“lookahead
in
heuristics).
This
and
this
present
variables.
(Haralich
This
and
the
is the
until
there
most
1980).
the
the
all
The
not
\ arlables
the
efficient
program
to
program
in
have
to test
values
of
heuristic
is the
the
the
b>
+
Nb
situation
X an
will
the
following
safe
for
values
for
Cabe,
say
Let
on
control
the
the
later
domain
of
I (0
value).
In
have
for
been
the
means
the
t,est,ed.
next
In
at
the
next,
step
be
Y
is
a
d-
X. X - Nb,
this
an assigned
step,
in-
and
that
time,
the
value
and
values.
a coroutining
The
the
possible
can
remove
Therefore.
represents
X2.
all
their
noattack(+,+,+)
is to
of
a value
noattack(X,Y,Nb)
n-F
Y.
steps
choose
from
I(‘-
1984).
first
immediately.
predicate
in figure
considered
will
as
(see
(Dincbas.
the
‘removed
case,
as soon
search
Metalog
asap-
informations
tests
consider
modes.
of the
if the
inefficient
the
of
1. Then
are
Indeed,
the
effect
inconsistent
a very
apply
1979).
However,
n 1 ariables
in testing
is
efficiency
following
In
would
the
predicate.
the
from
based
X2....,X5
the
be
This
to
10 the
then
“membw(X.domain(X))”
of
is given
not
MC
domain.
and
in assigning
be used
1985)).
The
noatt.ack(+.-.+).
variable
can
improve
and
with
al-
fol-
thus
its
by
consists
mechanisms.
values
used
S
inconsistent
is no need
against
checking
in order
that
removes
variable
Elliot.
future
so on
way,
a forward
means
a variable.
for
along
the
implements
program
Lariables
H> mo\lng
assigned
ready
on
the
a possible
a value.
value
\-cjuccns
(based
about
set”
problem.
folio% ing
expressed
constraints.
user,
(Naish,
consistent
4.1.
br
of [I, .., n ] and
the
the
program.
for
program
a permutation
proach.
our
1980).
Prolog
list
signment
a new
implemented
puzzle
a delay
of
shows
be
rewrite
the
and
examples
checking)
combined
of (Sussman
two
give
(h-queens
(foruard
The
our
will
without
w a!
that
usual
of the
follov.ing.
can
domain
five-queens.<{ 1.2.3.4.5}5>.
fi~e-queens({X;l.)i2.X5.X4.X5})
t
queens([Xl.X2,XY,X;4,)(53).
to
The
4.
program
clause
member(NII’)
1 and
program.
chooses
2
these
3 as value
X2.
lowing.
queens(u).
queens(lXjI7)
Cmembw(X.domain(X))
safe(X.Y.l)
1
queens(Y).
figure
safe( X,[J.Nb).
safe( X.[FjT].Nb)
r
noattack(X.F.?jb
Newnb
is Nb +
safe(.X.T.NeBnb)
Therefore.
because
1: 5-queens
this
their
predicates
after
instantiates
possible
will
‘The problem
1 and
2 choices
immediately
set
is reduced
reduce
CO one
is solved
with
X3
to
element
two
and
X4
I element)
the
choices
d:main
and
(to
5 and
and
of
their
X5
without
(i.e
any
2
safe
4).
back-
t.racking.
Kow,
first
it2
However.
the unification
will test
if each value
is in the domain
of
thr~ bariable.
Therefore.
a predicate
“indomain(
ran tw int.rodured
whose
rndomain(X)
holds
II mernber(S.durrlain(X))
holds”
derlaratibr
semantics
is P’
and
762
which
avoids
the
unification
/ ENGINEERING
inefficienr!.
consider,
backtrack
and
X5 will
the
logic
the
point
no
program
search
for
is X2
and
more
with
another
be compared
a control
the
solution.
values
with
Xl.
mechanism:
In our
assigned
It’s
not
each
to
the
time
case.
the
X2,X3.X4
case for
a value
IS assrgned
with
to
Xl
X$X3,X4
Thus
eight-queens
a
probi’er~~
12
J
lot
5
of
this
value
must.
redundancy.
be
campar~d
Conder
now
tlrka
pernr([ljo,Ke,n~c,Ra,Le,Kw~,
after
4
X5,
and
entatls
3 C~IOI~CY
6
7
Ho +
MC 7
8
Lr
pr
#
Hr
-f
vi.Hr
#
la.
2: 8-queens
after
3 choices
where
X6
in
has
alread>
11s domain.
safe
received
Therefore.
predicate
will
failure
is detected
of
failure
the
mechanism.
for
(from
1 to
exzst
powerful
lier
the
X5,
search
any
overhead
A
for
aooid
only
CSP
a
such
is
the
lot
a
the
procedure
to
not
cause
that
for
ear-
barktrark
point
second.
the
Six
couples
Howard.
name<
took
wives
\‘irginia.
Forth
Finally.
each
of
to
given
gra>
hair
state
lady
need
and
hair
married
JoMing
Prolog
and
Kress
colors
couple
program
single
played
against
know
to
of
ever
and
be
all
took
solves
which
able
six
lo
City.
were
There
find
wives.
part
the
city:
Kansas
Grace
Margaret.
and
in the
Grace
Dayton.
hair
the
that
same
color,
played
and
For
is the
=&
\i.
Ra
Blo.
Gr
7
f
<:r.
RIO
=+
la.
ma.
the
occurs
“Ho”
variables.
This
The
predicates
Ho”
time
and
first
tested
all
again;
can-
third
possible
1s quite
in
the
the
are
also.
permutation
the
this
value5
if they
Note
after
immediately
becomes
of the
assign
permutations.
generat,e
used
program
the
in the
I
will
be
is a permutation
are tested
in
generated
“Fo
can
Res
constraints
backtracking
constraints
list
permutation
pervalues
inefficient.
order
to
following.
remove
Let
I)
Ho.Fo
=+
Ra. W’i 1
MC. Le #
Mc,Fo
#
Ra.Mi
= Ilu.Ni
Ke. Ru #
Fo. Br 3
Ho.
Blo. Ra += Gr. Fo =
Ke.
731~.
labeling(~Bl,Br,Gr,Re,Au.Blo~).
Bo. Rc %
Da, Bl F
labeling([Fo,
Da, Gr
Bo, Bl
,i
#
Fo,
Da,
Rc F
%lt.
Wi,Mt,Bo,Da,Ka]).
labeling(u).
labeling( [X(q)
member(X,domain(X)).
out-of(X.Y).
labeling(1’).
in-
or the
one
names.
game”.
MC
are
Susan
is only
last
MC.
#
if the
constraint
the
Cr +
I310 +
name13
Information5
for
the
the
3
LP
the
backtracking
Fo 7
Wi f
Br +
first
different
blond.
against
Diana.
dl.
labeling(po,Ke,Me,Ra,Le.RuJ).
were
The
la.
gr.
domain tennis:<D’.D6,D6>.
tennis({Ho.Ke,~lc.Ra,Le,Ru},{Fo.Wi,Mt~.Bo.Da.Ka}
,{ Bl,Br,Gr.Re,Au,Blo})
e
Ho #
gr. Ho #
su, Ke =f gr, Ke #
su. hlc =# la.
Mc f
su.Ra #
la. Ra#
su. MC #
gr. Ha ;f
gr.
Le #
gr. Kr ;it la. Ke =& vi. Mc f
di. MC +
vi.
Mt #
ma.Mt =#di,
Da #
di. Mt f
vi.
Blo # la, Blo + di,Da
#
ma. Ka =# ma.
Br f
vi. Gr +
la, Blo =#- ma.
of
a
a different
auburn
names
Rust.
Laura.
from
Boston.
had
Their
and
Susan.
hailed
\ ernon.
red.
played
to
match.
Lewis
ladies
women
doubles
and
we ought
towns
the
tennis
Margaret.
the
Mt
gw.
Howard
a
MC #
Ra f
*II.
a
1978).
(Lauriere.
Randolph.
of
Wlchlta.
brown.
stance.
in
were
Each
North.
black,
part
McLean,
Kress.
of their
and
following
g:
f
(ma.su,la,di,gr.vi}
problem.
is the
holds
if a value
all
kc,
31~ +
31~ j.
#
Mc,F<, +
Rh.n~
=# Ho.\ji
+\lc.
-# ma,Mt
f dl, ])a + dl. Mt .=& \i.
i f
Ke.Ru +
Fo.Fo
# Ke.Gr F
Ho
f
Fo. Rr +
h1t. 1310 f
I)a.
+
Da. Ka 9
ma.
&ext,
inconsistencies.
declarative
without
satisfied.
satisfy
Br
di.
program.
t,he variables.
These
or
su.
vi.
U.i. Mt, Bo, Da.h’u~.~r~a.str.la.di.gr.tlil/.
In this
mutation.
there
Ho.
F
#
Ho.Fo
=# ma.Mt
f
Ra. W
# Da. Gr
# 1~0. Bl
perm(L.Res)
L.
not
values
failure
fully
for
the
This
jirst.
redundancy:
allou,
list
assigning
all
detert
left
control
when
right
oj
real
twofold:
which
X4.
with
consider
here
to
the
program
will
point
for
reviewed.
Moreover.
choose
implements
combinatorial
Th e problem
“no
The
and
be
detect.ed
suffirient
iS
will
a logic
backtracking
X6.
value
value
injormations.
4.2.
fact
be
mechanisms:
which
control
In
one
2 as
choice
possible.
procedures
ertenaion
programs
as
will
is only
choosing
is detected.
and
8) for
as there
this
as early
control
urthout
and
failure
X6
than
when
fail
(X4)
the
values
a value
I;f-
la. Ha #
la. Kie +
#
Blo
perm([Fo.
figure
kc,
H1.~r.C~r.Re.Au,Blo].~ma.su.la.d~.gr.~~~),
Blo
Fo
Da
\I i
He
HI
<u.
su.Ha #
gr. Kr T
perm(
/ma,su,la,di,gr,va]).
11~~ #
fact
Thp
other
home
that
our-of&[]).
out-of(M,IFIT])
x f F,
out-of(X,T).
fol-
problem.
The
labeling
dure
in order
set.
The
.
procedure
to
procedure
assign
is used
to
labeling(L)
AI LANGUAGES
instead
variables
of the
0111) \ slurs
c \ if all
h (I 11.
permutation
in
elements
AND ARCHITECTURES
their
of the
procepossible
list
/ 763
L
are
dIfferant
(which
list
L must
include
ter
case.
the
dornaln
programs
is that
constraints
and
constraint
Ho”.
prrcedure
constraints
reduce
choices
are
made
in
depend
on
them.
No
simple
strategy
for
will
first
will
test”
remains
as
all
the
only
5.
ran
IO variable.
The
us
to
the
for
the
non-equality
constraints
as possible
constraints
labeling
constraints
case
of
to
move
from
a
you
can
be
written
(i.e.
in this
the
above-mentionned
are
used
predicates
case
to
mechanism
is
the
Iwo
problem
However.
replaced
will
combined
with
holds
if all
be defined
alldifferen t ([I)
alldifferent
([M\Y])
out-of(X.)‘)
,
alldifferent
)
by
is
in an
((,‘olmcraucr.
equality
The
of
hsnoul
by
is ground
that
this
our
solve
our
lhe
the
the
basic
probletu
if
mechanism.
elements
following
of the
a
The
hst
L are
clauses
the
search
will
be
this
case,
possible
search
The
to
thus
avoids
rambined
can
be
the
with
fail
As
other
principle”
using
cm-
b>
so-called
fail”
heurib-
and
“to
heuristics.
Elliot.
be
succeed.
most
the
can
This
the
Consider
Nhich
and
procedures)
choosing
first.
be rewritten
primitives
(IIaralick
search
the
to
CSP
of
mechanisms
other
likely
in
whose
is the
a
list
tr>
heuristic>
constrained
labeling
procedure
as
is
“a
delay
I ENGINEERING
program
of
I,g
is the
can
he
obtained
but
map
(graph)
guidelmes
are
known.
In
is greatly
a simple
as soon
avoid
the
first,
active
manner
behaviour
allows
deep
analysis
ar-
effect
in
usual
in order
to
more
shows
how
t ervalb
of
This
prirnitlvey
problems.
and
In
as much
constrainls
space
backtracking.
data-driven
as
basic
are
tunity
and
is
rom-
in
to
not
define
restricted
used
his
own
to
which
is
shown
can
be
mechanisms
a
there
ran
exist
lot
to
strategy
specific
substantially
program
Henten-
of
the
first.
more
progratnming
user
the
Also,
ejoppor-
the
ustr
applying
mechanisms
.!he
in-
the
our
implement
for
reduce
and
on
with
twofold.
zf necessary
particular
the
(Van
reasoning
to
a
gilles
no
a similar
easil)
is
powerful
requires
get
all
implemented
This
of
requires
to
the
here
a
order
arc-consistency
like
point
permutarequires
the
In
how
the
inside
like
and
domains.
man!
litterals
extension,
rewriting
the
many
CSP,
and
difficult
without
which
language.
Second.
and
ver>
sufficiently
mechanisms
of the
dynamicall>
The
here.
for
predicates
our
for
where
statically
mechanisms.
are
logic
order
in
seems
it
1978))
presented
mechanisms
often
1986),
(Lauriere,
usual
the
explicitely
sophisticated
sophisticated
jort
It
if
efficient)
suited
programs
determined
languages
Dincbas,
logic
determined
logic
TrkeChanismS
cx-
Second.
be
problem.
holds
further
well
With
”-
goal
“choose-var(L,Var.Other)”
arguments
be
that
problems
problem.
manipulate
others
and
of
must
the
can
the
the
extension.
of
of
solves
search
a
analysis
order
eleand
length(L.Lg)
coloring
by
the
one
cardinalit)
a
particularly
usual
affected
order
instantiation
are
ryck
combinat,orial
the
oj
it
in
the
an
and
(NP-complete)
to
or
the
is
domain
by
is clear
in
is
Var
smallest
of L. The
It
building
if
the
procedure
L.
like
of values
it
list
heuristics
is
computed
the
problems
wa>
these
the
by
This
Such
non-
be
where
of
holds
variables
can
length
tion.
It entails
just
case
with
twofold:
mechaniswc,
one
generation
to reduce
priori”
as
,
,
cardinality
of other
length(domain(V).Lg)”
is
an
domain
variable
it
arguments
to variables.
a particular
in order
pathological
a
the
‘I’hcrr.
both
soon
values
interesting
important
an
as
as
but
passive
1935)
soon
without
reduced
for
here
in
assign
(1):
space
point
reduce
as
one
of in a purely
Canrghcm.
be solved
important
it is very
used
can
is indeed
space
very
the
plosion.
764
This
Colmerauer’s
i+ selected
and
can
inst>ead
\.an
ir
case.
the
<elected
choices
constraints.
as
ua)
and
problem
without
thus
same
IS
In
allowzng
a set
choose-var(L,Var,Other)
L
)‘efficiency”
the
prfadicate
ground
as
(and
instantiated
procedure
ment
c
active
guments
urrcaMes.
the
alldifferent
a clause
here
“first
most
It can
predicate
used
the
extensions.
labeling(u)
labeling([X(Y])
+choosr-car(lX:)oY],Var,Other)
member(\-ar,domain(Var))
out-of(\-ar,Ol
her),
labeling(Oc
her).
and
alldifjerent(fHo.h’e,Alc.Ra.Le.Ru]).
alldifferent
predicate
are
be
before.
in
first
when
passively
are
~~-i.,~lt.Bo,Da,h’aj)l
This
of
by
qophislicated
b>
implemented
variables
the
more
improved
where
seen
huild
checking
he
alldzfferent(lFo.
It can
sets
propagalcd
considered
is the
can
Other
equal.
16
of
be
example
first
of
not
jact
Forward
An
alldifferent(~Bl.Br.Gr.Re,.4u,BloJ),
predicate
can
substantial11
the
predicates.
but
(i.e.
predicateA
delay
thdh
features
used
be
1980)
‘.constraintd-search”
a
passable
aclected
extension
tars.
Other
in
be
Others
Zlr)reover.
a few
und
to
Our
first
of “E’o“.
(like
allows
towards
the
IOII~
the
of the
after
values
and
This
arise.
instantiated.
where
program
assign
behaviour
is used
as soon
are
of the
srt
recfwe
solving.
mechanism
be tested
space.
case
permutal
possible
domains
strategy
program.
variables
or
pathological
problem
If a delay
the
smaller
backtracking)
and
the
set
nlost
search
is solved
St ralr~ts
on
variable
straints
two
the
the
this
by the
the
solar\
(lonsider
three
reduce
this
all.
constraint
of after
it will
also
“generate
This
instead
encountered,
for
C
lat-
the
hpl w pen
immediateI>
once
In
as generator
Immedlatel~
reduces
putatK7ri
The
prcdtcare).
d-variables.
difference
nne
second
“out-or’
Or
I\ used
rnam
solved
#
the
terms
varlabl(,
the
The,
are
“Fo
labeling
of
thr
by
ground
therefore
constraints
when
Insured
predieare.
” mern her”
The
IS
only
these
which
search
are
space.
blned
pr/mrtrvcs
6.
once
the
domarn
extension
Implementation
The
used
stated
by
and
by
our
the
usual
the
possible
case
tive
integers
of constants
this
boolean
array
variable
At
straints
can
ari]
=
a set
of consecutive
t,p done
elements
modify
then
this
and
minimum
of
and
the
of a non-equality
ali!
is true,
be
ing,
put
the
only
inequality
to
thing
case
be
to
only
these
two
if
#
to
reset
be
In
efficiently
to
a!il
ajij.
the
In
If
variable
backtrackgeneral.
thus
the
could
need
values
are
reset
must
this
when
(especial11
and
of values
case,
the
resolution
minimum
modified
an!
pos-
When
true.
to
the
of values
and
if
between
The
i.
to
con-
of the
in accessing
as a list
a set
case,
If necessary,
is to
of a dthe
set
values
i” consists
a
int,eresting
In this
is true.
“false”.
must
be
a[ij
a pointer
However.
shown
been
the
modification
combined
if
can
with
a
be
5.
ACM
Freuder
E. C.
21 (November
which
increases
domain
their
redefinitions
evaluable
use
of
the
like
and
the
avoiding
reducing
to
first
main
logic
fail
need
the
the
for
for
extra
5,
>,
is
behaviour
in
an
“a
of
2 ,
#
and
bring
to
allow
The
look
and
effort
efficient!
of
improved
by
backt,racking
manner.
a
active
programming
substantialI>
priori”
on
the
techniques
informations.
CSP
is based
to
and
without
control
It
proposed
unification.
are
efficiently
solving
space
programming
of
consistency
pathological
search
<,
advantages
been
CSP.
heuristics,
be implemented
programs
solving
has
modification
predicates
Its
into
strategies.
languages
when
slight
built-in
function.
constraints
ahead
logic
a
of sorne
new
programming
efficiency
declarations.
such
com-
as soon as possible.
mechanisms
extenslonb
and
When
the
can
Expressiveness
DC. 1983.
can
It
be built
be Implemented
of Many
Sorted
J.P.
Metacontrol
of logic program
in
of FGCS’84..
Tokyo.
Japan,
November,
“Synthesizing
constraint
1978), 958-966.
H. LQgic programming:
6. Gallaire.
IEEE symposium
on logic programming,
88-99. Invited
paper.
7.
Haralick
R.M., Eliiot
for constraint
satisfaction
(80). 263-313.
expressions”.
9.
Lauriere
J.L.
“A language
solving
combinatorial
problems”.
and
Comrn
further
developments.
Boston.
july. 85, pp.
“Increasing
tree
G.L.
Artificial
problems.“.
a. Kowalski R. Directions
of logic
of the IEEE international
symposium
ton (USA),
85. invited
paper.
10.
search
efficiency
14
intelligence
Proceedings
programming.
on logic programming,
Bos-
a program
.4rtificial
for
stating
znteffigence
10
and
(1978),
Mackworth.
A.K.
“Consistency
in network
inlelligence
8. 1 (1977). 99-118
by
com-
of relations”.
Artificial
11.
Mycroft.
for Prolog”.
delay
Conclusion
of logic
Improving
1l‘ashlnrton
Dincbas,
M. . Lepape.
4.
METALOG.
Proceedings
84, pp. 361-370.
12.
extension
aophlqticated
that
to a “data8rrvgyt”
A., Kanoul.
H.. Van Caneghem.
M.
“Prolog.
T.S.I.
(techniques
et developpements
actuels.”
injormatiques)
2, 4 (83). 271-311.
sciences
Journal
An
and
lead
actively
when
be stored
mechanism).
7.
h<)w more
prlmlt~ves
this
constraints
3. Colmerauer,
bases theoriques
et
have
only
but
possible
can
the
with
is clear
computation.
all
maximum
d-variables.
implemented
that
complicated
values
occurs.
unify
do
However.
backtracking
we
trail
is more
reset.
stored.
be set
the
the
it
set
we
domain
the
indices.
by
it
that
Therefore.
the
i is in
is given
“X
Then.
of
However,
a finite
are true
time
that
a corrcspon-
and
domain.
any
predicate
has
A.G.
2. (:ohn.
Logic
AAAI-83.
of consecu-
between
integers.
represent
precisely
we consider
as a set
Indeed,
booleans
such
must
on
following.
to
maximun
mechanism,
1. Clark,
K.L.. .\lc CabBe, F
I’hc control
fat illlies
of I(‘I’rolog.
In Ezperl
c~yslrltr~6 zti thf rrrzrro-electrontc
age., ED
Mitchie
D. Edinburgh
urliverhlt\
press.. 1979
besides
(or more
of integers
maximum
a d-variable
required
environment.
thr
the
is not.
modifications
defined
the
At
means
it
the
it
them.
Otherwise,
set
all
a delay
which aapl~es
when
condition+
level
set
of
beginning.
store
must
for
overhead
two
restrictive.
‘*a” is necessar)
sible
minimun
are
wa>
no
domain
In
domains
no
the
to the
implementation
to
the
true
variable.
variables
at
also
access
are
In the
be provided.
the
i> in
and
can
a direct
mu\t
made
entails
efficiently.
What
a pointer
where
be
?
with
putation
from
extension
1983)
This
can
prr)r,tdrd
efficient]).
Implemented
mechanisms
set)
the
that
be
informatlon.
only
dance
of this
can
(Shapiro.
basic
been
issues.
implementation
not
has
Naish
of
A. , O’Keefr
R.A.
.4rtificial
intelligence
L.
“.4utomating
logic
programming
“A Polymorphic
type system
23, 3 (1984). 295-307.
control
for logic programs”.
.Z, 3 (October 1985). 167-184.
Shapiro
E.
Methodology
of logic programming.
13.
of logic programming
workshop.
Proceedings
of logic
ming workshop,
Praia da falencia,
Portugal,
26-june
pp. 84-93.
Proceeding
programI-july,
1983.
“CONSTRAINTS:
a language
14.
Sussman,
G.J. , Steele, G.L.
Artificial
intelfor expressing
almost-hierarchical
descriptions”.
ligence
14, 1 (1980), l-39.
Van Hentenryck.
P. .Dincbas
M.
Associating
domain
to
15.
lp-10.
variables
in order to solve C.S.P.
in logic programming.
E.C.R.C
(E uro p ean computer-industry
research
center),
February,
86.
16.
roller
tificial
Walther.
C.
A mechanical
Solution
of Shubert’s
qth National
by Many-sorted
resolution.
Intelligence
(A-4.41-84).
Austin.
1984.
AI LANGUAGES
Steam-
Conference
AND ARCHITECTURES
on Ar-
/ 765