*** 1 Consider the following program father(paul, john). father(john, mary). father(john, karen). mother(jane, john). mother(ann, karen). mother(karen, peter). parent(X,Y):- father(X,Y). parent(X,Y):- mother(X,Y). (meaning that Paul is John's father, etc.). Evaluate by hand and check by running the program, the possible answers that Prolog gives for the following queries: ?- parent(john, X). ?- parent(X, john). ?- parent(parent, X), parent(X, Y), parent(Y,Z). *** 2 Consider the Prolog implementation of logical circuits discussed before. not(0, 1). not(1, 0). and(0, 0, 0). and(0, 1, 0). and(1, 0, 0). and(1, 1, 1). or(0, 0, 0). or(0, 1, 1). or(1, 0, 1). or(1, 1, 1). eor(0, 0, 0). eor(0, 1, 1). eor(1, 0, 1). eor(1, 1, 0). halfadder(A, B, Carry, Sum):- and(A, B, Carry), eor(A, B, Sum). fulladder(A, B, Carryin, Sum, Carryout):- eor(A, B, X), and(A, B, Y), and(X, Carryin, Z), eor(Carryin, X, Sum), or(Y, Z, Carryout). 2.a Use the half adder and full adder predicates for putting together another predicate that adds two 3-bit numbers and produces a 4-bit number. 2.b Apply the predicate you have just constructed in order to define a new predicate that performs subtraction. *** 3 Extend the program of exercise 1 with a grandparent predicate, and write down the successful execution paths for the query ?- grandparent(X,karen) with indication, in each step, of the mgu. *** 4 Find the least Herbrand model of the program of exercise 2 using the immediate consequence operator.