HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Operator precedence in propositional logic

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
precedencelogicpropositionaloperator

Problem

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 ?

Solution

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

  • $\lnot$,



  • $\land$,



  • $\lor$,



  • $\implies$,



  • $\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.

Context

StackExchange Computer Science Q#43856, answer score: 8

Revisions (0)

No revisions yet.