diff options
author | Julian T <julian@jtle.dk> | 2021-11-25 08:47:19 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2021-11-25 08:47:19 +0100 |
commit | 890ad2bcee172ab2a4cbb319145f5b42ba38619a (patch) | |
tree | c7cc445410379cb5ee4b37b18f2d45a56e680b28 /sem7/pp/prolog/lec1.dl | |
parent | 7f57150038a90f634dd27b25bd9bba05c461c22a (diff) |
Add notes and assignment solution
Diffstat (limited to 'sem7/pp/prolog/lec1.dl')
-rw-r--r-- | sem7/pp/prolog/lec1.dl | 33 |
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). |