[mercury-users] backtracking?

Ralph Becket rafe at cs.mu.OZ.AU
Fri Jul 16 08:59:23 AEST 2004


hanberg at ruc.dk, Thursday, 15 July 2004:
> Hi
> 
> I'm having trouble running a somewhat heavy program. I implemented a theorem
> prover using mercury, but I have trouble with the following lines:
> 
> :- pred proveable1(list(expr(T)), list(int), list(int)).
> :- mode proveable1(in, in, out) is nondet.
> 
> proveable1([Head|Tail], OLDINTLIST, NEWINTLIST) :-
> 	proveable(Head, 4, INT),
>	proveable2(Tail, [INT|OLDINTLIST], NEWINTLIST).

Should `proveable2' be `proveable1' there?

> proveable1(_, OLDINTLIST, NEWINTLIST) :- NEWINTLIST=OLDINTLIST.

Should `_' be `[]'?  That would remove a major source of non-determinism
from this predicate if so.

> Mercury runtime: memory zone nondetstack#0 overflowed
> PC at signal: 134522191 (804a54f)
> This may have been caused by a stack overflow, due to unbounded recursion.
> 
> I don't really know how to either get the ints out without backtracking or
> extend the memory. Hope someone can help me.

You haven't given us enough detail about what you're trying to do for us
to be able to offer detailed help.  My guess is that your program is
more non-deterministic than it needs to be, but I'd need to know more
about what you're trying to achieve and what your code looks like to be
sure.  If it's just a matter of extending the nondetstack size, you can
do this by setting the MERCURY_OPTIONS="--nondetstack-size=1024"
environment variable when running your program (see
http://www.mercury.cs.mu.oz.au/information/doc-latest/mercury_user_guide/Running.html#Running)

-- Ralph
--------------------------------------------------------------------------
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