Your definitions - and how you interpret them:
man(socrates).
Socrates is a man.
mortal(X) :- man(X).
Everyone is mortal.
immortal(X) :- immortal(X).
Every immortal is immortal.
Your definitions - and how Prolog interprets them:
man(socrates).
If you ask about the masculinity of Socrates, I know that this is true.
mortal(X) :- man(X).
If you ask me about someone's mortality, I will check his masculinity (and if so, then mortality).
immortal(X) :- immortal(X).
If you ask me about the immortality of someone, I will check his immortality. (Are you still wondering how this leads to an endless loop?)
If you want to claim that someone is immortal, if he cannot be proved mortal, you can use:
immortal(X) :- not( mortal(X) ).
ypercubeแตแดน
source share