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.