[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Typol determinism



In article <1995Feb13.101025.10848@sophia.inria.fr>, prieur@smart.irit.fr (Pascal PRIEUR) writes:

|> 	Typol is deterministic, indeed if you have two rules writed 
|> for the same operator, if the first one succeeds during the evaluation,
|>  the second is never evaluated. 
|> 	
|> 	I would like to know if it's possible to ``ask'' to typol to 
|> evaluate the second, in order to realize backtracking on success as 
|> prolog is used to do. Is it possible to modify the way typol write 
|> his sp files ? Is there something to do ?

Typol has the same strategy as Prolog. The only difference is that
it gives you only the first solution and does not ask if you want some
more solutions.

A first way to see more solutions is, using the debugger, to refuse
the first solution given to you (saying "Fail" in the "Proved" state).

You can also use a top level rule with an explicit failure in it.
Something like   
....  & fail ()
---------------
....
where fail() is imported from prolog.
(Well, doing that, you rely on the fact that the order of
premisses is important during the prolog implementation).

There is also a trick to call the prolog predicate
"setof" if you need it.

-- 
Send contributions and compliments to centaur@sophia.inria.fr. Registration
and administrative matters should be sent to centaur-request@sophia.inria.fr.
+---------------------------------------------------------------------------+
|     Thierry Despeyroux      | email: Thierry.Despeyroux@sophia.inria.fr   |
| I.N.R.I.A. Sophia-Antipolis | phone: +33 93 65 77 07 fax: +33 93 65 77 66 |
+---------------------------------------------------------------------------+