# Translating English to Predicate Logic

I need some help translating the following English sentences to predicate logic. I want to make sure I'm doing it correctly.

a) Any pet either loves itself or some other person.

What I got: $$\forall x\;\Big(\text{Pet}(x) \Longrightarrow \exists y\big(\text{Loves}(x,x) \lor \text{Loves} (x,y)\big)\Big)$$

b) Dogs will eat anything.

What I got: $$\forall x\;\forall y\;\big(\text{Dog(x)} \Longrightarrow \text{willEat}(x,y)\big)$$

c) Some sleepy student didn't answer any questions.

What I got: $$\exists x\;\big((\text{student}(x) \land \text{sleepy}(y)) \Longrightarrow \lnot \text{answeredQuestion}(x)\big)$$

Should this one be the following? $$\exists x\;\big((\text{student}(x) \land \text{sleepy}(y)) \land \lnot \text{answeredQuestion}(x)\big)$$

d) No dog except Fido barked.

What I got: $$\forall x\;\big(\text{dog}(x) \Longrightarrow (\text{Fido}(x) \Longleftrightarrow \text{barked}(x)\big)$$

Are any of these incorrect or do I seem to be doing it OK?

• Note that, in this case it would feel more natural to use $\to$ instead of $\implies$. See math.stackexchange.com/a/1616379/53301 for further information. – JnxF Jan 27 '16 at 22:57
• (Supplement to @JnxF 's comment) That's "\to". Similarly, the corresponding symbol for equivalence in first order formulas is $\leftrightarrow$, "\leftrightarrow". (What you probably wanted to use was not the two arrows side by side but rather $\Leftrightarrow$, which is "\Leftrightarrow", or $\Longleftrightarrow$, which is "\Longleftrightarrow".) – BrianO Jan 27 '16 at 23:00
• Whoops, noted. Thanks! – dibdub Jan 27 '16 at 23:14

## 1 Answer

a), b) and d) are correct (assuming d) implies that Fido did in fact bark.)

For c), the second form with the conjunction is closer to correct, but, owing to at least a typo [$sleepy(y)$ — what is $y$?], not quite. It should be:

$\exists x(student(x) \land sleepy(x) \land \forall y\,(isQuestion(y)\to \neg\, answered(x, y)).$

I decomposed $answeredQuestions(x)$ into simpler predicates $isQuestion(y)$ and $answered(x,y)$ in order to reveal more of the structure of the sentence.

• Awesome, that makes sense! Yeah, the y in part c was just a typo, that was supposed to be x. Thanks for the help! – dibdub Jan 27 '16 at 22:57
• No prob, you're welcome. – BrianO Jan 27 '16 at 23:04