From 890ad2bcee172ab2a4cbb319145f5b42ba38619a Mon Sep 17 00:00:00 2001 From: Julian T Date: Thu, 25 Nov 2021 08:47:19 +0100 Subject: Add notes and assignment solution --- sem7/pp/prolog/lec1.dl | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 sem7/pp/prolog/lec1.dl (limited to 'sem7/pp/prolog/lec1.dl') 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). -- cgit v1.2.3