summaryrefslogtreecommitdiff
path: root/knowledge_base.pl
diff options
context:
space:
mode:
Diffstat (limited to 'knowledge_base.pl')
-rw-r--r--knowledge_base.pl32
1 files changed, 32 insertions, 0 deletions
diff --git a/knowledge_base.pl b/knowledge_base.pl
new file mode 100644
index 0000000..542ca70
--- /dev/null
+++ b/knowledge_base.pl
@@ -0,0 +1,32 @@
+human(jack).
+income(jack, 480).
+
+human(jones).
+income(jones, 20).
+
+human(joe).
+income(joe, 1000).
+
+human(jeremy).
+product(jeremy).
+
+product(grapes).
+cost(grapes, 5).
+
+product(pasta).
+cost(pasta, 1).
+
+product(car).
+cost(car, 400).
+likes(jack, pasta).
+likes(jones, car).
+likes(joe, car).
+can_afford(X, Y) :-
+ income(X, Income),
+ cost(Y, Cost),
+ Income > Cost.
+will_buy(X, Y) :-
+ human(X),
+ product(Y),
+ likes(X, Y),
+ can_afford(X, Y).