CoCalc Public Filesprolog.htmlOpen with one click!
Authors: Harald Schilly, ℏal Snyder, William A. Stein
Views : 62
Description: Jupyter html version of prolog.ipynb
Compute Environment: Ubuntu 18.04 (Deprecated)
prolog
In [1]:
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.
Out[7]:
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.
Out[14]:
True
In [15]:
%continue
Use '%continue' for more results.
Out[15]:
True
In [12]:
has(ann, money)?
No more results.
In [ ]: