I'm studying logical operators for school and there's a weird question that keeps bugging me even though it seems pretty basic.
I was asked to evaluate the proposition : p -> q -> r with p, r are False and q is True.
I tried evaluating it from left to right like this: ( ( p -> q ) -> r ) and got wrong answer.
Then, I checked my result with an online tool at https://web.stanford.edu/class/cs103/tools/truth-table-tool/ and it evaluates the proposition from right to left like this: ( p -> ( q -> r ) ) ( you can see in this picture ). I tried calculating the result again with this order and it was accepted as right answer !
That's really odd because my lecturer said that if operators are at the same level then the proposition should be evaluated from left to right. Have I misunderstood something ?
-
1$\begingroup$ It is a convention: usually "operators of equal precedence associates to the right." $\endgroup$– Mauro ALLEGRANZAApr 14, 2020 at 8:13
-
$\begingroup$ Welcome to MSE. For some basic information about writing mathematics at this site see, e.g., basic help on mathjax notation, mathjax tutorial and quick reference, main meta site math tutorial and equation editing how-to. $\endgroup$– José Carlos SantosApr 14, 2020 at 8:20
-
$\begingroup$ @MauroALLEGRANZA Is interpreting p=>q=>r as (p=>q AND q=>r) also an accepted convention ? because I've seen it being used that way. $\endgroup$– PooriaJan 9 at 15:46
2 Answers
Well, the operations $\wedge,\vee,\Leftrightarrow$ are left-associative while the operation $\Rightarrow$ is right-associative. So
$[p\Rightarrow q\Rightarrow r ]\Longleftrightarrow [p\Rightarrow (q\Rightarrow r)].$
-
$\begingroup$ Thanks for your answer and Mauro ALLEGRANZA' s comment too. It turns out I've really misunderstood this question . $\endgroup$– CPS_001Apr 14, 2020 at 8:25
-
$\begingroup$ I do not agree with the statement that $\land$ and $\lor$ are left-associative. $\endgroup$ Apr 14, 2020 at 9:06
-
$\begingroup$ They are both left- and right-associative. $\endgroup$ Apr 14, 2020 at 9:36
-
$\begingroup$ So, I checked everything again using web.stanford.edu/class/cs103/tools/truth-table-tool and it showed that ↔ is right associative. It's different from your answer ! $\endgroup$– CPS_001Apr 14, 2020 at 10:38
-
1$\begingroup$ @CPS_001 - the issue is that the "symmetric" operators ($\land,\lor,\leftrightarrow$) are associative, both left- and right-. Thus, the simplest rule is: right-associativity for all binary connectives. $\endgroup$ Apr 14, 2020 at 13:04
The full convention is as follows: Outermost parentheses may be omitted, and in the absence of parentheses, the order of operations is
- $\lnot$
- $\land$
- $\lor$
- $\impliedby $ and $\implies$ have equal precedence
- $\iff$
$\impliedby$ is left associative, and as Wuestenfux stated, $\implies$ is right associative while $\iff$ is left associative.
An example using everthing would be: $a\lor b\impliedby ~a\iff a\land\lnot a\lor b$, which reads $(a\lor b\impliedby (~a\iff ((a\land\lnot a)\lor b)))$.