Translating a sentence into predicate logic

272 Views Asked by At

"A dragon is happy only if it has a green child".

Have I translated this statement correctly into logic (below)?

$\forall X \cdot dragon(X) \wedge happy(X) \Rightarrow \exists Y \cdot childOf(Y,X) \wedge green(Y)$

$childOf(Y,X)$ is true when $Y$ is a child of $X$.

2

There are 2 best solutions below

0
On

This is correct, if you make sure that $\forall X$ quantifies the whole statement, i.e. if you write: $$\forall X\big(dragon(X)\land happy(X)\to \exists Y\left( childOf(Y,X)\land green(Y)\right)\big)$$

0
On

I think it is necessary to be more careful. Here we are dealing with 'only if' and not 'if'. The correct translation is the following.

Dx: x is a dragon

Cxy: x is a child of y

Gx: x is green

Hx: x is happy

$$ \forall x ((Dx \wedge \exists y (Cyx \wedge Gy)) \to Hx) $$