Sujet : Try this online Prolog (Was: --- OLCOTT BANNED ---)
De : janburse (at) *nospam* fastmail.fm (Mild Shock)
Groupes : sci.logicDate : 10. Jul 2024, 05:21:47
Autres entêtes
Message-ID : <v6l28r$ddn3$2@solani.org>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.18.2
Hi,
> - Its not performed in the goal to head unification
> - Its not performed in (=)/2 buit-in
> - It is performed in unify_with_occurs_check/2 built-in
An example of goal to head unification would be:
equal(X, X) :- write('You hit me!'), nl.
?- equal(foo(Y), Y).
You can try the same here with this online Prolog:
Example 02: Website Sandbox
https://www.xlog.ch/runtab/doclet/docs/04_tutor/reference/example02/package.htmlIt will give you:
You hit me!
Y = <cyclic term> .
Bye
Mild Shock schrieb:
You wrote:
> Yet C&M say that this test is only performed when run
> thus almost never performed because it is too expensive.
But for soundness you have to perform it sometimes!
So what is the solution? The solution is simple:
- Its not performed in the goal to head unification
- Its not performed in (=)/2 buit-in
- It is performed in unify_with_occurs_check/2 built-in
The ISO core standard requires both (=)/2 and
unify_with_occurs_check/2. You need unify_with_occurs_check/2
when you want an occurs check, which is need
for example in rewriting or type inference
to get correct results.