# Prolog help

Page 1 of 1

## 3 Replies - 2207 Views - Last Post: 14 April 2009 - 08:50 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=98747&amp;s=f24a0e53e0a62a63e0ba8afab6986003&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 sniper079

Reputation: 0
• Posts: 2
• Joined: 12-April 09

# Prolog help

Posted 12 April 2009 - 10:11 AM

Hi,

Can somebody help me with this question please, since I can't figure it out how to work it.

```Assume that the following rules and facts have been given and that they have been given in this order:
1.	   Bigger(cat,apple).
2.	   Bigger(house,truck).
3.	   Bigger(cat,cat).
4.	   Bigger(lion,cat).
5.	   Bigger(house,lion).
6.	   Bigger(truck,car).
7.	   Bigger_than(A,B):-bigger(A,B).
8.	   Bigger_than(A,B):-bigger(A,C),bigger_than(C,B).

What is the result of executing the query bigger_than(truck,lion)?
```

This post has been edited by sniper079: 12 April 2009 - 02:19 PM

Is This A Good Question/Topic? 0

## Replies To: Prolog help

### #2 mostyfriedman

• The Algorithmi

Reputation: 729
• Posts: 4,473
• Joined: 24-October 08

## Re: Prolog help

Posted 12 April 2009 - 07:26 PM

this will give you an error, since all the predicates start with a capital letter, in prolog if a word starts with a capital letter then its interpreted as a variable and the name of a predicate cant be a variable.

### #3 sniper079

Reputation: 0
• Posts: 2
• Joined: 12-April 09

## Re: Prolog help

Posted 13 April 2009 - 09:39 AM

sniper079, on 12 Apr, 2009 - 09:11 AM, said:

Hi,

Can somebody help me with this question please, since I can't figure it out how to work it.

```Assume that the following rules and facts have been given and that they have been given in this order:
1.	   Bigger(cat,apple).
2.	   Bigger(house,truck).
3.	   Bigger(cat,cat).
4.	   Bigger(lion,cat).
5.	   Bigger(house,lion).
6.	   Bigger(truck,car).
7.	   Bigger_than(A,B):-bigger(A,B).
8.	   Bigger_than(A,B):-bigger(A,C),bigger_than(C,B).

What is the result of executing the query bigger_than(truck,lion)?
```

```but what happens the the query bigger_than(truck,lion)?
I've tried to work it with a prolog programm and this is the result that I'm having, and I'm not sure what I'm doing wrong.
?- bigger_than(truck,lion).
ERROR: toplevel: Undefined procedure: bigger_than/2 (DWIM could not correct goal)
```

### #4 mostyfriedman

• The Algorithmi

Reputation: 729
• Posts: 4,473
• Joined: 24-October 08

## Re: Prolog help

Posted 14 April 2009 - 08:50 AM

bigger_than is not defined in your knowledge base, you have to define the predicate first

This post has been edited by mostyfriedman: 14 April 2009 - 08:50 AM