# Logical promblem with "or" and "Not" operator

• Dec 29th 2010, 04:55 AM
sgguhan
Logical promblem with "or" and "Not" operator
I have gotten into a problem in a application the search uses logical operators "or" and "not" now when i have the following search "1 'or' 1 'not' 1" the result always comes up with 1 but there are two ways to simplify the equation the first one is "1 'or' (1 'not' 1)" this would end up with 1 as the answer, the second one is "(1 'or' 1) 'not' 1" this gives me an answer 0. In reality when this logic is used the second one is more suitable than the first one. Please let me know if i am wrong or the applications precedence is wrong

PS: please let me know the precedence for logical operator.
• Dec 29th 2010, 06:33 AM
emakarov
The connective 'not' is unary, not binary, so "1 'or' (1 'not' 1)" does not look right. Perhaps what is meant is 'and not'.

Though this has to be always double-checked, usually 'and' (an analog of multiplication) binds tighter than 'or' (an analog of addition), and unary 'not' binds tighter than both of them. So "1 'or' 1 'and not' 1" would be interpreted as "1 'or' (1 'and not' 1)".
• Dec 29th 2010, 07:49 AM
sgguhan
Thanks for the quick reply so the 'not' has a higher precedence than 'and'/'or. The precedence go like 'not>and>or' please correct me if i'm wrong.
• Dec 29th 2010, 08:26 AM
emakarov
Quote:

The precedence go like 'not>and>or'
In most, if not all, places that I've seen, yes.
• Dec 29th 2010, 04:41 PM
sgguhan