36

According to the precedence of logical connectives, operator $\rightarrow$ gets higher precedence than $\leftrightarrow$ operator. But what about associativity of $\rightarrow$ operator?

The implies operator ($\rightarrow$) does not have the associative property. That means that $(p \rightarrow q) \rightarrow r$ is not equivalent to $p \rightarrow (q \rightarrow r)$. Because of that, the question comes op how $p \rightarrow q \rightarrow r$ should be interpreted.

The proposition $p \rightarrow q \rightarrow r$ can be defined in multiple ways that make sense:

  • $(p \rightarrow q) \rightarrow r$ (left associativity)
  • $p \rightarrow (q \rightarrow r)$ (right associativity)
  • $(p \rightarrow q) \land (q \rightarrow r)$

Which one of these definitions is used?

I could not locate any book/webpage that mentions about associativity of logical operators in discrete mathematics.

Please also cite the reference (book/reliable webpage) that you use to answer my question (as I'm planning to add this to wikipedia page about 'logical connectives').

Thanks.

PS: I got this question when I saw this problem: Check if following compound proposition is tautology or not:

$$ \mathrm{p} \leftrightarrow (\mathrm{q} \wedge \mathrm{r}) \rightarrow \neg\mathrm{r} \rightarrow \neg\mathrm{p}$$

Paul
  • 2,795
  • The compound proposition in plaintext above in better typesetted form is here: http://mathbin.net/56026 – Amber Jain Nov 28 '10 at 17:12
  • 2
    I've edited the proposition so it looks exactly like the one you link at. Note the difference between \Rightarrow ($\Rightarrow$) and \rightarrow ($\rightarrow$). The latter is the usual connective, the former is "logical implication"; as I understand it, people who work in Mathematical Logic make a clear distinction between the two (and get endlessly annoyed by those who don't...) – Arturo Magidin Nov 28 '10 at 23:52
  • 3
    @Arturo: we certainly care about the difference between the two, but the notation varies greatly from one author to another, so that $\Rightarrow$ is often used as a connective. In the most common setting of first-order logic, Goedel's completeness theorem implies that it's pretty safe to ignore the difference. – Carl Mummert Nov 29 '10 at 01:43
  • @Arturo: The book that I'm currently reading (Kenneth Rosen's 'Discrete mathematics and it's applications' (6e) uses $\rightarrow$ to represent logical implication. – Amber Jain Nov 29 '10 at 13:39
  • @CarlMummert I never realized the two symbols are not the same, what is the difference in their meaning? – Ovi Mar 16 '17 at 04:13
  • @Ovi: some authors use $\rightarrow$ for the logical connective (which could appear in a formula) and $\Rightarrow$ for logical implication at the meta level. Of course, in first-order logic, for sentences $\phi$ and $\psi$, we have $\phi \models \psi$ if and only if $\phi \vdash \psi$ if and only if $\vdash \phi \to \psi$, so in that notation $\phi \Rightarrow \psi$ is equivalent to $\phi \to \psi$ being logically valid. – Carl Mummert Mar 16 '17 at 17:35
  • Implies is associative. →(→) should not be read as "p implies that q implies p, but "p implies q which implies r"

    The reason why the bracket (→)→ is not equal to →(→) is because of notational peculiarities. Associativity is not about brackets, associativity is about successive applications of an operator, which is different. And the successive applications of the implies operator yield same result independent of the order in which the operations are performed.

    Read about https://en.wikipedia.org/wiki/Light%27s_associativity_test

    – Jencel Mar 31 '21 at 17:48

8 Answers8

17

When you enter $p \Rightarrow q \Rightarrow r$ in Mathematica (with p \[Implies] q \[Implies] r), it displays $p \Rightarrow (q \Rightarrow r)$.

That makes it plausible that the $\rightarrow$ operator is generally accepted as right-associative.

Paul
  • 2,795
  • 6
    This is the commonly accepted syntactic associativity rule: implication, like the function space constructor, associates to the right. (Under the Curry-Howard isomorphism, these are one and the same anyway - see @CarlMummert's remark to another answer below) – Arend Jul 25 '14 at 09:31
  • 4
    I hate these generally-accepted rules. Everybody should use brackets. Other examples: $6-3-2 = $ 1 or 5? $2^{2^3} = $ 64 or 256? – Ivan Kuckir Mar 13 '16 at 10:43
16

Some logical operators are associative: both $\wedge$ and $\vee$ are associative, as a simple check of truth tables verifies. Likewise, the biconditional $\leftrightarrow$ is associative.

However, the implication $\rightarrow$ is not associative. Compare $(p\rightarrow q)\rightarrow r$ and $p\rightarrow(q\rightarrow r)$. If all of $p$, $q$, and $r$ are false, then $p\rightarrow (q\rightarrow r)$ is true, because the antecedent is false; but $(p\rightarrow q\rightarrow r$ is false, because $r$ is false, but $p\rightarrow q$ is true. They also disagree with $p$ and $r$ are false but $q$ is true: then $p\rightarrow(q\rightarrow r)$ is true because the antecedent is false, but $(p\rightarrow q)$ is true, $r$ false, so $(p\rightarrow q)\rightarrow r$ is false.

Since they take different values at some truth assignments, the two propositions are not equivalent, so $\to$ is not associative.

Arturo Magidin
  • 398,050
  • 1
    Yes, that is right. But I'm interested in knowing the operator associativity of logical connectives. Does $\rightarrow$ associates to left or to right? – Amber Jain Nov 29 '10 at 13:54
  • 25
    The usual convention among authors who drop parentheses is that the binary connectives are right-associative, which means that $a \to b \to c$ means $a \to (b \to c)$. However, many textbooks will just use parentheses whenever there is a possibility of ambiguity. – Carl Mummert Nov 29 '10 at 14:47
  • 1
    @Carl: I'm new to stackexchange sites. In my opinion, your preceding comment answers my original question. How do I set your last comment as the accepted answer? Or, do I need to set the answer by Arturo Magidin above for this? – Amber Jain Dec 02 '10 at 16:22
  • 1
    @Amber Jain, @Carl Mummert: You cannot make a comment into the accepted answer... But Carl may post his comment as an answer and you can accept that, if he's willing. – Arturo Magidin Dec 02 '10 at 16:56
  • @ArturoMagidin I don't understand the 2nd paragraph. I bet you are right, but let me ask: You aim to prove that $\implies$ is not associative, but both ways to parenthesize gave true? Below there is an answer with $p$, $q$ and $r$ being false, false, false that to me seems to achieve what you wanted. What am I missing? – Santropedro Nov 28 '20 at 18:41
  • @Santropedro: First, $\implies$ is not the same as $\rightarrow$; the latter is a propositional connective, the former is a semantic notion. The point is that there are truth assignments where $(p\to q)\to r$ and $p\to(q\to r)$ give different values. It does look like I messed up. Take either all of them false, or take $q$ true and $p$ and $r$ false. I’ll fix it. – Arturo Magidin Nov 28 '20 at 19:00
  • @ArturoMagidin Thank you for responding! Yes, you are right, I messed up the arrow, I tried to edit it but it was too late, but now I have learned that they should not be interchanged. I agree with the rest of your answer, in fact it agrees with a truth table I did online about it, those you said are precisely the only two assignments that make the truth value different. You can delete these comments if they become obsolete. – Santropedro Nov 28 '20 at 19:08
8

The proposition $p \rightarrow q \rightarrow r$ can be defined in multiple ways that make sense:

  • $(p \rightarrow q) \rightarrow r$ (left associativity)
  • $p \rightarrow (q \rightarrow r)$ (right associativity)
  • $(p \rightarrow q) \land (q \rightarrow r)$

Which one of these definitions is used?

  1. A logician would read $$p \rightarrow q \rightarrow r$$ (in the absence of explicit parentheses) as $$p \rightarrow (q \rightarrow r);$$ however, in informal logic (including mathematics), $$p \Rightarrow q \Rightarrow r$$ is commonly read as $$(p \Rightarrow q) \;\text{ and }\; (q \Rightarrow r),$$ which isn't logically equivalent to $$p \Rightarrow (q \Rightarrow r).$$

  2. On the other hand, $$p \Leftrightarrow q \Leftrightarrow r$$ is commonly read as $$(p \Leftrightarrow q) \;\text{ and }\; (q \Leftrightarrow r),$$ whereas a logician would read $$p \leftrightarrow q \leftrightarrow r$$ as $$p \leftrightarrow (q \leftrightarrow r),$$ which isn't logically equivalent to $$(p \leftrightarrow q) \;\text{ and }\; (q \leftrightarrow r).$$

    To wit: $$(p \Leftrightarrow q) \;\text{ and }\; (q \Leftrightarrow r)$$ asserts that $p,q,r$ all have the same truth value, while the truth assignment $(p,q,r)=$ (false, false, true) is actually admitted by both $$p \Leftrightarrow ( q \Leftrightarrow r)$$ and $$(p \Leftrightarrow q) \Leftrightarrow r.$$

ryang
  • 38,879
  • 14
  • 81
  • 179
  • So (P=>Q=>R) , whether => indicates 'logical implication' or 'material conditional' can be interpreted as ( (P=>Q) AND (Q=>R) ) ? – Pooria Jan 03 '23 at 08:23
  • @Pooria Whatever 'logical implication' means to you, your inference isn't following from what I wrote. – ryang Mar 12 '24 at 05:12
4

Counter example: Suppose p, q, r are all false. Then (p=>q)=>r is false, and p=>(q=>r) is true.

2

I think $(p \rightarrow q) \land (q \rightarrow r)$ is the most useful interpretation of $p \rightarrow q \rightarrow r$. It corresponds to natural language when we say something like "A implies B, which implies C".

A related convention is $x \lt y \lt z$ meaning $x \lt y \land y \lt z$. The same three cases arise when $\lt$ is treated as a function yielding a boolean integer like in many programming languages.

Dan Brumleve
  • 17,796
  • 7
    The most common convention I have seen is that $p \to q \to r$ means $p \to (q \to r)$ which is equivalent to $(p \land q) \to r$. This convention is very common in type theory, because it works well with the Curry-Howard isomorphism. Under this interpretation, $a \to b$ is read as "we have a function from $a$ to $b$" and $p \to q \to r$ means "we have a function that, given $p$, constructs a function from $q$ to $r$.". – Carl Mummert Jul 25 '14 at 02:58
0

Presumably $p \Rightarrow q \Rightarrow r$ means $(p \Rightarrow q) \Rightarrow r$, since the other option $p \Rightarrow (q \Rightarrow r)$ is equivalent to $(p \land q) \Rightarrow r$. That's similar to the laws of powering $p^{q^r} = p^{\left(q^r\right)}$ since $\left(p^q\right)^r = p^{qr}$.

Best practice is just not to put the reader into a state of ambiguity. Some mathematical writers dislike punctuation, but that's not an excuse for the rest of us to take advantage of it.

Since $\land$ and $\lor$ are associative, there's no ambiguity there, and it makes sense not to put parentheses. Sometimes one even thinks of an expression like $p \land q \land r$ as a conjunction $\land(p,q,r)$.

The latter convention is the case in proof complexity when one is measuring the depth of a formula. If a first-order quantified formula is translated to propositional logic, then $\forall$ will correspond to a conjunction, and $\exists$ to a disjunction; it makes sense not to penalize the formula for the size of the underlying universe.

An even more daring "convention" is having infinite conjunctions/disjunctions - this wouldn't make sense at all for $\Rightarrow$. So your textbook authors are at fault (even though having the $\Leftrightarrow$ bind weakly is a reasonable convention if not overused).

Yuval Filmus
  • 57,157
  • 12
    Actually $p \to q \to r$ does mean $(p \land q) \to r$, not $(p \to q) \to r$. This is because the former is much more commonly encountered than the latter. In particular, this convention is useful in computability when studying the Curry-Howard isomorphism; see http://en.wikipedia.org/wiki/Currying – Carl Mummert Nov 29 '10 at 01:41
  • This question appeared in my discrete math exam. If this question appeared in a textbook, I guess the author would had clarified it. But all textbooks I had seen explicitly use parentheses. – Amber Jain Nov 29 '10 at 14:04
  • So, what is the last word on this? – Amber Jain Nov 29 '10 at 14:06
  • 2
    Presumably, if the problem was on an exam, either the instructor would tell you what was meant, or the instructor assumed you would already know. – Carl Mummert Nov 29 '10 at 14:48
0

What basic principle(s) do you have when doing logic from scratch without any formation rules? I'll propose one which I think unobjectionable.

  1. Try to keep things as simple as reasonable or make things as simple as reasonable.

When you work or play around with conditionals you probably will want to find the antecedent of the conditional so that you can detach something. p→(q→r) has a simpler antecedent than (p→q)→r, and consequently given a pseudo-formula it comes as simpler to find an antecedent of some form "p" in your axiom set than to find some form (p→q) in your axiom set to detach something from (p→q)→r. Consequently, p→(q→r) makes more sense than (p→q)→r.

-1

Note that since it's not a binary operator, but a binary relation, associativity does not always yield the same semantics, of reducing composition pairings to a queue. Suppose $p \implies q \implies r.$ But if $r$ is false, $p \implies q$ being true does not imply $r$ is true. Likewise, $p \implies q$ can be false while $p \implies (r \implies q)$ is true, so $(p \implies (q \implies r)) \implies (p \implies q), (q \implies r)$ is not necessarily true. Finally, if $(p \implies q) \implies r$, and $p \implies (q \implies r),$ and $p \equiv F,$ we have no reason to think $q \implies r$, and $p \implies q$ can still be true, which would mean $r$ is true regardless of whether $p \implies r$.

Loki Clock
  • 2,193