I was reading Learn Prolog Now! and I'm confused about their use of logic and I was hoping someone can clarify the ambiguity of arguments in rules.
For example, on Chapter 1, knowledge base 4 they reference the following rule:
loves(vincent,mia).
They then provide a query:
loves(marsellus,X), woman(X).
and then the make the English statement:
"Now, remember that , means "and", so this query says: is there any individual X such that Marsellus loves X and X is a woman ?"
The key word being, Marsellus loves X.
This is worded in a way that makes me think there is some "logic" tied to the arrangement of arguments, such as to say,
Is it true that loves(vincent,mia). "logically" means:
- vincent loves mia?
BUT is it false that
- mia loves vincent?
That's what I originally thought but then on Chapter 3, example 2: Descendant they have the following example of:
child(bridget,caroline).
Then the English statement: "That is, Caroline is a child of Bridget"
But if #1 above is true (vincent loves mia), then shouldn't this be read as Bridget is a child of Caroline?
Or does the order of arguments not matter and it's your additional programming that will determine the logic of the arguments?
r(a,b)means that (a,b) is in the relation r:A->B. Nothing more is implied. So everything depends on how you define the relation r. - 2bigpigs