# Predicate logic example

While studying predicate logic, i see some example as exercise there.But can't figure it out.Can anyone help me?
(i)If a brick is on another brick, it is not on the table.
(ii)Every brick is on the table or on another brick.
(iii) No brick is on a brick which is also on a brick.

EDIT:
My answers are:
i) ∀x∃y brick_on(x,y) -> ¬brick_on(x,table)
ii) ∀x brick(x) -> onTable(x) ∨ (∃y on(x,y))
iii) ∀x∃y∃z brick_on(x,y) -> ¬brick_on(z,x)

Could anyone tell me these are right or wrong?

-
What are you supposed to do? –  Alfonso Fernandez Jul 20 '13 at 17:22
Represent that statements in predicate logic. –  ridoy Jul 20 '13 at 17:23
What does this have to do with artificial intelligence? –  Chris Eagle Jul 20 '13 at 18:39
predicate logic is one of the most important part of AI to define system grammar. –  ridoy Jul 20 '13 at 18:48

## 2 Answers

In your posted work, you've got a great start, in terms of the logic you used. However, we need to "clean up" parentheses, make a few corrections, define the notation you are using, and use this notation consistently

Let's start with defining notation, and then let's stick with it.

To simplify matters, we'll let the domain of our universe consist of bricks.

Let $T(x)$ denote "x is on the table".

Let $O(x, y)$ denote "x is on top of y".

Now to the translations: Pay particular attention to the parentheses, which are used to enclose everything which within the scope of a quantifier which precedes the parentheses.

First sentence: (i) If a brick is on another brick, it is not on the table.

$$(i)\quad \forall x \Big(\exists y (O(x, y)) \rightarrow \lnot T(x)\Big)$$

Then we have (ii) Every brick is on the table or on another brick:

$$(ii)\quad \forall x\,\Big(T(x) \lor \exists y\,(O(x, y))\Big)$$

So far, your work has been very close to the above. Now let's look at the final sentence:

(iii) No brick is on a brick which is also on a brick.

In loglish: "For all bricks x, if there exists a brick y such that O(x, y), then there does not exist any z such that O(z,x)." Now, the full translation:

$$(iii)\quad \forall x \Big(\exists y (O(x,y)) \rightarrow \lnot\exists z(O(z,x))\Big)$$

Or alternatively, we can say in loglish "For all bricks x, if there exists a brick y such that O(x, y), then for all bricks z, it is not the case that O(z,x)":

$$(iii)\quad \forall x \Big(\exists y\, (O(x,y)) \rightarrow \forall z(\lnot O(z,x))\Big)$$

-
Let me know if you have any questions about the statements. –  amWhy Jul 20 '13 at 18:49
Awesome,got it now.+1 for that and accepted :) –  ridoy Jul 20 '13 at 18:50
You're welcome. You did most of the work, just needed a little "tweaking". ;-) –  amWhy Jul 20 '13 at 18:52
@amWhy: I am going to bed. Bye Amy and + –  Babak S. Jul 20 '13 at 20:14
@amWhy: You do a wonderful job with these. Time for a movie! +1 –  Amzoti Jul 21 '13 at 0:37

Let $B$ be the set of bricks, and define $T(b)$ to be the predicate declaring $b$ is on a table, and $S(b,b')$ to be that declaring the brick $b$ is on top of the brick $b'$. Now rephrase the statements in terms of these new things, firstly in plain English in your head, then in logical notation.

-
I do it myself,but i want to see whether i do wrong or right from an expert's answer as those are exercises. –  ridoy Jul 20 '13 at 17:35
Post the answers you came up with then! It's far better for us to see what you've done wrong, if anything! Then we can help more specifically address any problems you have. –  Sharkos Jul 20 '13 at 17:37
see my answer above. –  ridoy Jul 20 '13 at 17:48