Re: [eclipse-clp-users] timeout in bb_min/3

From: Marco Gavanelli <marco.gavanelli_at_unife.it>
Date: Thu, 18 Feb 2010 16:20:02 +0100
Amine Marref wrote:
> Thanks Marco,
> 
> I have substituted ";" with "or" and it works. I thought that they are equivalent like "," and "and" are equivalent (I hope they are).

they are logically equivalent, but they have a different operational 
semantics (they do different things).

> I always wondered what when to use ";", when to use "or", and when to use multiple definitions of a predicate e.g. "con(X):-X#>0. \n con(X):-X#<0."

The operator ';' is equivalent to multiple clauses, i.e.,

con(X):-X#>0.
con(X):-X#<0.

is the same as

con(X):- (X#>0 ; X#<0).

If you write, instead, 'X$>0 or X $< 0' ECLiPSe imposes two ternary 
constraints; the first is

	$>(X,0,Boolean1)

meaning that Boolean1 takes value 1 if and only if X$>0,
while it takes value 0 otherwise. In the same way, the second constraint 
becomes

	$<(X,0,Boolean2)

Now ECLiPSe imposes some constraint saying that at least one amongst 
Boolean1 and Boolean2 must be true (value 1); e.g.:

	Boolean1+Boolean2 $>= 1.

Cheers,
Marco

-- 
Marco Gavanelli, Ph.D. in Computer Science
Dept of Engineering
University of Ferrara
http://www.ing.unife.it/docenti/MarcoGavanelli/
Received on Thu Feb 18 2010 - 15:20:18 CET

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET