Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prolog Query returning H128

In the query below, firstly I'm getting X = H128, where does that come from? Also why is it returning yes? Is it because the variable X is actually not defined and we are testing for that condition?

?- not(X==3).
X = H128 
yes
like image 636
General_9 Avatar asked Dec 22 '25 23:12

General_9


1 Answers

Your query is using an uninstantiated variable (X). When checking whether X is instantiated with the term 3 it (X==3) it fails because X is uninstantiated.

Therefore, not(X==3) will succeed as the prolog engine cannot prove X==3. Your prolog interpreter is thus returning 'yes' (due to the negation as failure approach of the interpreter), and X remains uninstantiated.

That is why the interpreter shows X = H128, where H128 is a dummy uninstantiated variable.

like image 198
gusbro Avatar answered Dec 28 '25 10:12

gusbro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!