aboutsummaryrefslogtreecommitdiff
path: root/sem7/pp/prolog/lec1.dl
diff options
context:
space:
mode:
Diffstat (limited to 'sem7/pp/prolog/lec1.dl')
-rw-r--r--sem7/pp/prolog/lec1.dl33
1 files changed, 33 insertions, 0 deletions
diff --git a/sem7/pp/prolog/lec1.dl b/sem7/pp/prolog/lec1.dl
new file mode 100644
index 0000000..84154c2
--- /dev/null
+++ b/sem7/pp/prolog/lec1.dl
@@ -0,0 +1,33 @@
+#lang datalog
+
+% It finds whether a parent is a father or a mother depending on the gender of the parent.
+
+
+
+% Opgave 2
+
+% In the first program, a person is only happy if he/she is both rich and famous.
+% In the second program, a person is happy if he/she is either rich or famous.
+
+
+% Opgave 3
+
+% There is one program containing 3 clauses.
+% The first two clauses are called facts each only containing a single atom.
+% The first two facts each contain a atom with the single term beyonce which is a constant
+
+% Last line is a clause with a head and a body containing two atoms.
+% The body uses the predicates created in the last two lines, while the clause introduces the new predicate happy.
+% The clause uses the variable Person, which is used once in all 3 atoms.
+
+
+% Opgave 4
+
+destinct(red, green).
+destinct(green, blue).
+destinct(red, blue).
+
+% It is symmetric
+destinct(X, Y) :- destinct(Y, X).
+
+colouring(X, Y, XC, YC) :- neighbour(X, Y), destinct(XC, YC).