• :00Days
• :00Hours
• :00Mins
• 00Seconds
A new era for learning is coming soon Suggested languages for you:

Europe

Answers without the blur. Sign up and see all textbooks for free! Q58E

Expert-verified Found in: Page 56 ### Discrete Mathematics and its Applications

Book edition 7th
Author(s) Kenneth H. Rosen
Pages 808 pages
ISBN 9780073383095 # Suppose that Prolog facts are used to define the predicates mother $\left(M,Y\right)$ and father $\left(F,X\right)$which represent that M is the mother of Y and F is the father of X, respectively. Give a Prolog rule to define the predicate grandfather ${\mathbf{\left(}}{\mathbit{X}}{\mathbf{,}}{\mathbit{Y}}{\mathbf{\right)}}$, which represents that X is the grandfather of Y. [Hint: You can write a disjunction in Prolog either by using a semicolon to separate predicates or by putting these predicates on separate lines.]

grandfather $\left(X,Y\right)$: - mother $\left(M,Y\right)$, father $\left(X,M\right)$; father $\left(F,Y\right)$, father $\left(X,F\right)$

See the step by step solution

## Step 1: Given information

Prolog facts are used to define the predicates mother $\left(M,Y\right)$and father $\left(F,X\right)$ which represent that M is a mother of Y and F is the father of X respectively.

## Step 2: Prolog rule to define the predicate sibling(X,Y)

grandfather $\left(X,Y\right)$: - mother $\left(M,Y\right)$, father $\left(X,M\right)$; father $\left(F,Y\right)$,father $\left(X,F\right)$$\left(X,F\right)$

Where, :- means define and , represents a conjunction and ; represent a disjunction. ### Want to see more solutions like these? 