Operator precedence in propositional logic

Problem Detail: there is some kind of priorities for the elements in propositional logic ? for example : p ∧¬q → r , given this ,we there may be two options (p ∧¬q) → r OR p ∧ (¬q → r) , which one is the correct ?

Asked By : Roberto Fernandez

Answered By : Raphael

If you look at formal definitions of the syntax of propositional logic, you will find that $qquad p land lnot q to r$ is not a proper sentence; parentheses are needed to avoid exactly the ambiguity you mention. Operator precedences can be used for implicit parenthesisation. You seem to be asking if there are agreed-upon operator precedences in logic. I don’t think formal logics contains this concept; formal grammars just do not lend themselves to model precedences (or any ambiguity) very well. In practice (by which I mean both blackboard writing and implemented logic parsers), we do use precedences; usual conventions include

  1. $lnot$,
  2. $land$,
  3. $lor$,
  4. $implies$,
  5. $iff$

in decreasing order of precedence. Using these, your example is equivalent to $qquad (p land (lnot q)) to r$. David’s warning is apt, though: if you want to be clear, don’t rely on implicit precedences. Typesetting can help — you can e.g. group terms with spacings — but in case of doubt, just put the parentheses. In a larger body of work, you can also state your convention once and safe symbols afterwards, provided you stick to your own rules.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/43856