Usually WolframAlpha understands what logical expression I have entered but sometimes I can't find a way to do it especially when you are using equivalent sign.

For example if I have $$ p \land q \Leftrightarrow \lnot q$$ I type (p AND q) equivalent (NOT q) and it doesn't work, I have tried other various methods it didn't work either.

  • $\begingroup$ This is very strange, perhaps a bug, since "a equivalent b" is interpreted correctly. $\endgroup$ – magma Jan 24 '12 at 20:01

Use XNOR instead of equivalent.

  • $\begingroup$ yeah it's same and it works, thanks! $\endgroup$ – Templar Jan 23 '12 at 12:58

Many people (including mathematicians) often mistakenly use $ P \Leftrightarrow Q \Leftrightarrow R $ to indicate equivalence, that is $ (P \Leftrightarrow Q) \wedge (Q \Leftrightarrow R) $, which is a way of saying $ P $ is equivalent to $ Q $ which is also equivalent to $ R $. (See goblin's answer to the question “IFF” (if and only if) vs. “TFAE” (the following are equivalent).)

I think it is confusing to think of if-and-only-if as equivalence relationship, since being an associative operator(1), we are allowed to write expressions such as $ P \Leftrightarrow Q \Leftrightarrow R $, which are not ambiguous at all (compare with $ P \Rightarrow Q \Rightarrow R $, which is only equivalent to $ P \Rightarrow (Q \Rightarrow R) $).

lhf's solution works fine if you are trying to establish an equivalence relationship between only two sub-expressions, but XNOR is not an equivalent of iff operator! So, for instance, compare the following two expressions: ($ \bar\veebar $ is used for XNOR)

$$ \begin{array}{|c|c|c|c|c|} \hline P & Q & R & P \Leftrightarrow Q \Leftrightarrow R & P\ \bar\veebar\ Q\ \bar\veebar\ R \\ \hline \top & \top & \top & \top & \bot \\ \hline \top & \top & \bot & \bot & \top \\ \hline \top & \bot & \top & \bot & \top \\ \hline \top & \bot & \bot & \top & \bot \\ \hline \bot & \top & \top & \bot & \top \\ \hline \bot & \top & \bot & \top & \bot \\ \hline \bot & \bot & \top & \top & \bot \\ \hline \bot & \bot & \bot & \bot & \top \\ \hline \end{array} $$

As can be seen in the truth table, XNOR and iff operators are not equivalent; furthermore, you might have noticed that they are negation of each other!

I am going to omit the proof, simply because I don't have one, but a given

$$ P_1 \Leftrightarrow P_2 \Leftrightarrow \ldots \Leftrightarrow P_n $$

is equivalent to

$$ P_1\ \bar\veebar\ P_2\ \bar\veebar\ \ldots\ \bar\veebar\ P_n $$

if and only if $ n $ is an even number; else is equivalent to

$$ P_1 \veebar P_2 \veebar \ldots \veebar P_n $$

where $ \veebar $ is used for XOR.

Both XNOR() and XOR() operators are available on WolframAlpha.

(1): $ P \Leftrightarrow Q \Leftrightarrow R $ is same as $ (P \Leftrightarrow Q) \Leftrightarrow R $ which is also same as $ P \Leftrightarrow (Q \Leftrightarrow R) $.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.