[mercury-users] Solver types and \=

Peter Moulder Peter.Moulder at infotech.monash.edu.au
Sun Aug 14 17:18:19 AEST 2005


On Fri, Aug 12, 2005 at 02:09:01PM +1000, Peter Stuckey wrote:

> \= should be considered a separate predicate from = and have a default
> implemetation for ground times of not(=). This would mean that code 
> would always be correct.

One thing to keep in mind if any change does come out of this
conversation (whether \= should be a shortcut for not(... = ...) is the
behaviour of `@' and semidet functions (and perhaps other language
features).

In the below, `f' represents a call to a semidet function or an `@'
expression.

`f \= 5' is short for `not(f = 5)', which in turn is short for
`not(New_var = f, New_var = 5)'.  If f results in failure, then

  f = 5  is false,
  f < 5  is false,
  f > 5  is false,
  f = f  is false (!), and
  p(f)  is false for all pred p (including `:- mode p(in) is det.  p(_).')
but
  f \= 5  is true.

[The above is just from memory, sorry I haven't checked that my memory
 is correct.]

I don't claim that the above is desirable behaviour, I merely note that
there may exist Mercury code that assumes this behaviour; so if any of
that behaviour does change as a result of changes to `\=' then at the
least the release notes should mention the issue, and ideally the
compiler might generate a warning for code whose behaviour depends on
this treatment.  (Such a warning would be useful even before such a
change.)

pjrm.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list