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

1. ## 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.

2. 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)".

3. 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.

4. The precedence go like 'not>and>or'
In most, if not all, places that I've seen, yes.