CoCalc Public Filesprolog.ipynbOpen with one click!
Author: Harald Schilly
Views : 64
Description: Jupyter notebook prolog.ipynb
Compute Environment: Ubuntu 18.04 (Deprecated)
In [6]:
child(stephanie). child(thad). mother_child(trude, sally). father_child(tom, sally). father_child(tom, erica). father_child(mike, tom). sibling(X, Y) :- parent_child(Z, X), parent_child(Z, Y). parent_child(X, Y) :- father_child(X, Y). parent_child(X, Y) :- mother_child(X, Y).
Rule added to database. Rule added to database. Rule added to database. Rule added to database. Rule added to database. Rule added to database. Rule added to database. Rule added to database. Rule added to database.
In [7]:
father_child(tom, sally)?
Use '%continue' for more results.
True
In [9]:
has(jack,apples). has(ann,plums). has(dan,money). fruit(apples). fruit(plums).
Rule added to database. Rule added to database. Rule added to database. Rule added to database. Rule added to database.
In [14]:
has(jack,_)? has(dan, money)?
Use '%continue' for more results. Use '%continue' for more results.
True
In [15]:
%continue
Use '%continue' for more results.
True
In [12]:
has(ann, money)?
No more results.
In [ ]: