# Translating “neither…nor” into a mathematical logical expression

Having some difficulty doing translations for complicated neither...nor sentences.

With these characters:

~: Negation; $\vee$: Disjunction; &: Conjunction.

I'm trying to translate and understand, for example:

"Neither John nor Mary are standing in front of either Jim or Cary"

I have been told that a successful translation of "Neither e nor a is to the right of c" is translated as follows: ~(RightOf(e, c) $\vee$ RightOf(e, c))

What about just doing a translation on: "I like neither chocolate nor vanilla"

~(Like(chocolate) $\vee$ Like(Vanilla))

What confuses me the most is the sentence: "I like neither chocolate nor vanilla" is translated to ~((Like(chocolate) $\vee$ Like(vanilla)) and the sentence: "Neither e nor a is to the right of c and to the left of b" is translated to ~(RightOf(e, c) & LeftOf(e, b)) & ~(RightOf(a, c) & LeftOf(a, b)). Both sentences use neither...nor, however in the second sentence I see no disjunction, but in the first it exists.

Any food for thought and help would be appreciated!

-
I haven't heard of any actor called John Mary! – Aryabhata Mar 5 '11 at 2:03
@Billare: No, it's supposed to be the OR operation, \vee or $\vee$. – Arturo Magidin Mar 5 '11 at 2:17
@Arturo Magidin Typo, thanks. – Uticensis Mar 5 '11 at 2:19
@Arturo: Using \vee for disjunction makes it harder to read the LaTeX source. I'd use \lor ($\lor$) instead along with \land ($\land$) for conjunction. Negation ($\neg$) can be written with either \neg or \lnot - depending on what flows best in one's source – kahen Mar 5 '11 at 5:04
@kahen: I was not aware of those LaTeX synonyms. I've known \vee and \wedge for a while, so to me they come naturally... – Arturo Magidin Mar 5 '11 at 20:24

Mathematically, there are two ways of "translating" "I like neither chocolate nor vanilla" (the two ways are logically equivalent, an instance of de Morgan's laws). You can write either: $$\neg\bigl(\mathrm{like}(\mathrm{chocolate})\bigr)\ \&\ \neg\bigl(\mathrm{like}(\mathrm{vanilla})\bigr)$$ (that is, "I don't like chocolate and I don't like vanilla") or as $$\neg\bigl(\mathrm{like}(\mathrm{chocolate})\ \vee\ \mathrm{like}(\mathrm{vanilla})\bigr).$$ The two are equivalent, because $\neg(P\vee Q) \equiv (\neg P)\&(\neg Q)$ (this is one of De Morgan's Laws: for "P or Q" to be false, you need both P to be false and Q to be false).

The second sentence is similar: "Neither e nor a is to the right of c and to the left of b".

You mention you are confused about it; I think it's just a confusion of parsing (it is a bit awkwardly constructed). What is says is "Neither e nor a satisfy xxxx". That is: "e does not satisfy xxxx, and a does not satisfy xxxx". What is this xxxx? It is the condition "is to the right of c and to the left of b".

So the sentence is the same as "neither e is to the right of c and to the left of b, nor a is to the right of c and to the left of b." (I added the grey spaces as parsing aides).

(Note that "e is not to the right of c and to the left of b" means that either e is not to the right of c, or e is not to the left of b, or both; same with a).

If you wanted to translate it in the same manner as the first translation above, with conjunction, you would have: $$\Bigl(\neg\bigl(\mathrm{RightOf}(e,c)\&\mathrm{LeftOf}(e,b)\bigr) \Bigr) \& \Bigl(\neg\bigl(\mathrm{RightOf}(a,c)\&\mathrm{LeftOf}(e,b)\bigr)\Bigr).$$ But you can equally as well use the model of the second translation above, to get the equivalent statement: $$\neg\Biggl( \bigl(\mathrm{RightOf}(e,c)\&\mathrm{LeftOf}(e,b)\bigr) \vee \bigl(\mathrm{Rightof}(a,c)\&\mathrm{LeftOf}(a,b)\bigr)\Biggr).$$ So now you see the disjunction in the second.

The reason why the first "translation" of this phrase might be better than the second is that the mix of conjunctions and disjunctions ( "(a and b) or (x and y)" ) is usually a little harder to parse than a sequence of conjunctions, even with negations ( "not(a and b) and not(x and y)"). So the latter form is slightly prefered for parsing reasons, but mathematically they are equivalent. The parsing problem does not show up in the vanilla/chocolate example, because there are no conjunctions hiding inside the clauses and complicating the parsing.

-
Thanks for clearing this up, great explanation! – KerxPhilo Mar 5 '11 at 2:17