Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!math.ohio-state.edu!caen!night.primate.wisc.edu!hpg30a.csc.cuhk.hk!news.ust.hk!kean
From: kean@cs.ust.hk (Alex Kean)
Subject: Re: Nondeterminism
Message-ID: <1994Dec16.015758.20737@uxmail.ust.hk>
Sender: usenet@uxmail.ust.hk (usenet account)
Nntp-Posting-Host: cssu49.cs.ust.hk
Organization: Computer Science, HKUST
References: <9434021.28025@mulga.cs.mu.OZ.AU> <D0Jt09.KBy@ecrc.de> <9434911.21320@mulga.cs.mu.OZ.AU>
Date: Fri, 16 Dec 1994 01:57:58 GMT
Lines: 50

In article <9434911.21320@mulga.cs.mu.OZ.AU> fjh@munta.cs.mu.OZ.AU (Fergus Henderson) writes:
>thom@ecrc.de (Thom Fruehwirth) writes:
>
>
>>>From conway@munta.cs.mu.OZ.AU (Thomas Charles CONWAY)
>>>Subject: Re: In defense of Prolog's dynamic typing
>>>Date: Tue, 6 Dec 1994 10:56:12 GMT
>>>
>>>Number of modes:                  2209
>>>        - det:                    1858 ( 84.11%)
>>>        - semidet:                 344 ( 15.57%)
>>>        - nondet:                   38 (  1.72%)
>>
>>Nondeterminism seems to be rare in logic programs. 

I recall long ago (around 1983) during a conversation with Philip Cox,
the idea of by default prolog program does not backtrack
came up. For example, by the deafult

     member(X,[X|_]).
     member(X,[_|Y]) :- member(X,Y).

does not backtrack just as if we have a cut ("!") in there.
When we need backtrackting, we define

     member(X,[X|_]) :- @.
     member(X,[_|Y]) :- member(X,Y).

I am using the symbol "@" for illustration only. This idea
was appealing to me (without scientific justification) was
that I find myself "imposing determinism" using cut in many
of my algorithms and programs. It is a feeling of mine that
backtracking is only needed in some small subset of algorithms
(feeling is not scientific facts). I guess a good example
would be in writing code for graphics or user interface.

I understand this would alter the semantics of a "pure"
prolog program in which it can become incomplete. Well,
the question is whether such mode is of any value in 
practice, in terms of efficiency and easy of coding,
compare to a bit messier semantics?

Just a thought.
Alex Kean
-------------------------------------------------------------------------
Department of Computer Science                       Email:kean@cs.ust.hk
The Hong Kong University of Science & Technology     Tel: (852) 2358-6992
Clear Water Bay, Kowloon, HONG KONG                  Fax: (852) 2358-1477
-------------------------------------------------------------------------

