Do we use the notation $p \vee q \wedge r$ without brackets?

93 Views Asked by At

Recently, one of my professors wrote $p \vee q\wedge r$.

I'm not sure if it can be interpreted to either $p \vee ( q \wedge r)$ or $( p \vee q ) \wedge r$ or it is ambiguous.

Please share your opinion. Anything is appreciated.

Thank you.

4

There are 4 best solutions below

0
On BEST ANSWER

I would consider it ambiguous; there are no commonly accepted rules for the binding of most logical operators. If you have no choice but to interpret it without further context, I would guess that it means $p \lor (q \land r)$, since that is slightly more common.

Of course, if your professor at some point explicitly announced that in the context of their class, $\land$ binds more strongly than $\lor$, or vice versa, that is enough to tell you how to interpret the formula.

1
On

You can write $p \lor q \land r$ , without explicitly using parentheses. Since the operator precedence rules are imposed, i.e $\land$ has higher priority than $\lor$ , this can be interpreted only as $p \lor (q \land r)$.

0
On

There's a good rule of thumb for questions like this: if you have to ask whether you need parentheses, the answer is yes.

The point is that if you aren't sure, then it is pretty likely that your readers won't be sure either. Since the point of writing is generally to communicate to the reader (even if that reader is yourself!), leaving out the parentheses obscures your meaning.

So you should write parentheses unless you have a pretty good reason to leave them out.


If you want to know what your professor meant, I believe that doing $\wedge$ before $\vee$ is most common; $p \vee (q \wedge r)$ was probably meant. But keep in mind this is a guess; you really should find where your professor has explicitly stated meaning, or pay careful attention to see if you can study the context to figure out what was intended.

0
On

Since an order of precedence of $\wedge$ and $\vee$ isn't universally accepted like for $\cdot$ and $+$, and your professor hasn't explicitly specified a precedence, then the expression is ambiguous.

If a precedence is used, then it's probably that $p \vee q \wedge r$ should be interpreted as $p \vee (q \wedge r)$. One reason for this is the Boolean algebra $\langle \{ 0, 1 \}, +, \cdot \rangle$ where as normal $\cdot$ (corresponding to conjunction i.e. $\wedge$) has a higher precedence than $+$ (corresponding to disjunction i.e. $\vee$). Thus, if conjunction has a higher precedence in one notation, then it's natural that it also has a higher precedence in another notation.