# Converting English into Logic

I'm learning about Logic; I've devised a few sentences to convert into logic to test myself and see if i've grasped the topic. It would be of great help if you could tell me if i'm doing it right!

• Every student who likes chocolate is smart:

(Every student) (who likes chocolate) (is smart)

∀x ∈D, [Like (Student (x), chocolate) → Smart(x)]

• There exists a barber that shaves all men who do not shave themselves.

(There exists a barber) (that shaves all men) (if and only if they do not shave themselves)

∃x ∈D, [Shaves (x, ∀y) → Shave (y, y)]

Thank you

These are both wrong, as they don't obey the syntactic rules of first-order logic. The rules are:

• if $P$ is an $n$-ary predicate and $x_1, \dots, x_n$ are variables, then $P(x_1, \dots, x_n)$ is a formula;
• if $\varphi$ and $\psi$ are formulas, then $\neg \varphi$, $\varphi\wedge\psi$ and $\varphi\vee\psi$ are formulas;
• if $\varphi$ is a formula and $x$ is a variable, then $\exists x\,\varphi$ and $\forall x\,\varphi$ are formulas;
• nothing else is a formula.

(If you like, you can say that $\varphi\rightarrow\psi$ and $\varphi \leftrightarrow \psi$ are formulas, or you can say that they're just abbreviations for $\neg\varphi\vee\psi$ and $(\neg\varphi\vee\psi)\wedge(\varphi\vee\neg\psi)$, respectively.)

There's often more than one way of translating any English-language statement into a first-order sentence. Decide what your domain is going to be and the rest will follow.

Every student who likes chocolate is smart. Here, you have several choices of domain, such as the following.

• Domain is the set of all students: $\forall x\,\big(\mathrm{LikesChoc}(x)\rightarrow\mathrm{Smart}(x)\big)$. Since everything in the domain is a student, the variable $x$ can only be a student so you don't need a predicate to say that.

• Domain is, say, the set of all people: $\forall x\,\big(\big(\mathrm{Student}(x) \wedge \mathrm{LikesChoc}(x)\big)\rightarrow \mathrm{Smart}(x)\big)$. The domain now includes things that aren't students, so we need to enforce that with a predicate. A professor who likes chocolate isn't necessarily smart.

• Domain is, say, the set of all people and all foods. $$\forall x\,\big(\big(\mathrm{Student}(x) \wedge \exists y\,\big(\mathrm{Chocolate}(y) \wedge \mathrm{Likes}(x,y)\big)\big)\rightarrow \mathrm{Smart}(x)\big).$$ That is, for every entity $x$, if $x$ is a student and there is a thing $y$ that is chocolate and is liked by the student $x$, then $x$ is smart. I've assumed that "likes chocolate" means "likes at least one thing that is chocolate"; you could interpret it to mean "likes all things that are chocolate", and you can probably figure out how to change the formula to reflect that.

There exists a barber who shaves all men if, and only if, they do not shave themselves. I'll let you have another go at this. Try taking the domain to be the set of men, with a unary predicate that says who's a barber and a binary predicate (as you have), that says who shaves whom.

• Thank you very much! This is what i got for the second one: ∃x (Barber(x) ∧ ∀y (Man(y) ∧ ¬Shave(y,y) → Shave(x,y))) Dec 6, 2013 at 9:48
• @RSmithy Looks good to me! You should probably put brackets round $\mathrm{Man}(y)\wedge\neg\mathrm{Shave}(y,y)$, just to make it clear that you don't mean $\mathrm{Man}(y) \wedge (\neg\mathrm{Shave}(y,y)\rightarrow \mathrm{Shave}(x,y))$. You might have been taught that there are precedence rules, like in programming langauges and arithmetic. This is true but it's much clearer to disambiguate with brackets (I, for one, can never remember what the alleged rules are and I have a PhD in the subject). Dec 6, 2013 at 10:03