1. Jonny is fat
2. The dog is brown
3. Suzie likes Bobby
1. fat
2. brown
3. likes
fat(jonny).
<- every expression or fact is ended with a dotbrown(dog).
likes(suzie, Bobby).
<- The number of arguments is called Arity
They extend the facts and their relationship. Infer facts from other facts. If we have the following setup:
likes(ryan, brittney).
likes(brittney, ryan).
likes(dan, josh).
We can ask do they date ? So we are going to create a rule.
:-
- if only if
dating(X, Y) :-
likes(X,Y),
likes(Y, X).
and | ,
---------
if | :-
---------
or | ;
---------
not | not
Are dan and sally dating ?
likes(dan, sally).
Are josh and brittney friends ?
friendship(josh, brittney).