General
Material
Lecture 1
Lecture 2
Lecture 3
Lecture 4
Lecture 5

Solutions

wizard(harry).
scare(hagrid,dudley).
magical(X) :- wizard(X).
hate(uncle_vernon,X) :- magical(X).
hate(aunt_petunia,X) :- magical(X).
hate(aunt_petunia,X) :- scare(X,dudley).
      
This is, of course, not the only solution. What your knowledge base looks like depends on the atoms that you choose to stand for certain individuals and properties. The first fact could, for example, also be encoded as
wizard('Harry').
    
or as
is_wizard(harry).
    

Back to the exercise.