[m-dev.] from [mercury-users] Re: Question regarding determinism

Zoltan Somogyi zs at cs.mu.OZ.AU
Sun Aug 30 12:30:50 AEST 1998


> > moddat__add_assumption(Obj, Model, [a(Obj)|Model]) :-
> > 	list__member(o(Obj, _), Model).
> 
> Conjunctions get flattened before mode analysis, so that mode analysis
> can do reordering properly.
> 
> A possible solution would be to make determinism analysis check not just for
> goals (e.g. whole conjunctions) with no outputs but also for
> subsequences of conjunctions with no outputs.

The real problem with the above code is that the conversion to
superhomogeneous form converts

 	list__member(o(Obj, _), Model)

to

	A = o(Obj, _B),
 	list__member(A, Model)

Given that A is not fully ground, mode analysis then transforms this to

	A = o(Obj, _B),
 	( list__member(C, Model), A = C )

The determinism problem arises because the nested conjunction has an output;
it grounds A.

Mode analysis is careful to preserve the scope over which we may want to
commit, but the conversion to superhomogeneous form already threw away
the scope we wanted. I think the proper fix is for this conversion to
preserve the scope, introducing a conjunction for every atom it flattens.
I believe this shouldn't be too expensive. What do you think, Fergus?

Zoltan.



More information about the developers mailing list