[mercury-users] infinite recursion
Michael Day
mcda at students.cs.mu.oz.au
Thu Sep 7 13:04:14 AEDT 2000
> No. Logically, the meaning of that problem according to the semantics
> described in the "Semantics" chapter of the Mercury language reference
> manual is just "a <=> a". Since all that you have specified is
> `a<=>a', which is a tautology, the compiler can't soundly infer `not
> a' from that. Nor can it soundly infer `a' from that either.
> The only valid actions that an implementation can take for such code
> are to loop forever or to throw an exception.
Oh I see. I had a quite mistaken idea of the semantics (if you can't prove
it's true, then it's false). Would it make these things easier to debug if
it did throw an exception rather than looping, or is the compiler
warning/error good enough?
> If you use a minimal model semantics, rather than Mercury's usual
> completion semantics, then a/0 will be false. The Melbourne Mercury
> compiler includes as an extension to standard Mercury a `:- pragma
> minimal_model' declaration which gives the named predicate minimal
> model semantics rather than completion semantics. This is implemented
> using tabling. So if you add `:- pragma minimal_model(a/0).' to that
> code, then a/0 will indeed fail.
So... minimal model assumes innocent until proven guilty, rather than
indeterminate until proven innocent or guilty? So to speak? :)
Would minimal model semantics permit the writing of left recursive DCG
parsers? Is the execution model (using tabling or whatever) more
complicated or less efficient than the execution model for completion
semantics?
Michael
--------------------------------------------------------------------------
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