(Solved) : Part Write Recursive Equations Count Shrink Scanc State Base Case S Clearly Part Ii Write Q27826388 . . .
![Question 3 Logic Programming We consider the following Prolog program in this question likes (john, soccer). male (john). male (peter). male (david) . female (mary) female (amy) . parent (john, peter). parent (john, david) parent (mary,peter). parent (mary,amy) . dad (X, Y) :- male (X), parent (X, Y) mum (X, Y)- sibling (X,Y) :- parent (Z, X), parent (Z,Y) . hasChild (X) :- parent (X,_) :- female (X), paren t (X, Y) 3(a) [10 marks] Explain the binding of variables in the rule sibling 3(b) [20 marks] Now the user issues the following goal (or query) to the Prolog interpreter: sibling peter, A ) . Draw the search tree used in the Prolog inference process for answering this goal Write all possible answers of A that are returned by the Prolog interpreter.](https://d2vlcm61l7u1fs.cloudfront.net/media%2F491%2F491d6bf5-28e9-4759-9248-a04f0182768b%2FphptVKzOA.png)
Part i:
Write recursiveequations for Count, Shrink, and ScanC. State the base case(s)clearly.
Part ii:
Write the abovefunctions in the Haskell language.
Logic Programming
We consider the following Prologprogram in this question.
likes(john,soccer). male(john). male(peter). male(david).female(mary). female(amy). parent(john,peter). parent(john,david).parent(mary,peter). parent(mary,amy).
dad(X,Y) :- male(X), parent(X,Y). mum(X,Y) :- female(X),parent(X,Y).
sibling(X,Y) :- parent(Z,X), parent(Z,Y). hasChild(X) :-parent(X,_).
3(a) [10 marks]
Explain the bindingof variables in the rule sibling.
3(b) [20 marks]
Now the user issues the followinggoal (or query) to the Prolog interpreter:
sibling ( peter, A ).
Draw the searchtree used in the Prolog inference process for answering thisgoal.
Write all possibleanswers of A that are returned by the Prolog interpreter.
Question 3 Logic Programming We consider the following Prolog program in this question likes (john, soccer). male (john). male (peter). male (david) . female (mary) female (amy) . parent (john, peter). parent (john, david) parent (mary,peter). parent (mary,amy) . dad (X, Y) :- male (X), parent (X, Y) mum (X, Y)- sibling (X,Y) :- parent (Z, X), parent (Z,Y) . hasChild (X) :- parent (X,_) :- female (X), paren t (X, Y) 3(a) [10 marks] Explain the binding of variables in the rule sibling 3(b) [20 marks] Now the user issues the following goal (or query) to the Prolog interpreter: sibling peter, A ) . Draw the search tree used in the Prolog inference process for answering this goal Write all possible answers of A that are returned by the Prolog interpreter. Show transcribed image text
Expert Answer
Answer to Part Write Recursive Equations Count Shrink Scanc State Base Case S Clearly Part Ii Write Q27826388 . . .
OR