NOR-conjunction within OR-conjunctions - logic

Let's save I have the logical expression
a OR b NOR c OR d
Is this interpreted as (a OR b) NOR (c OR d) or as a OR (b NOR c) OR d ?
It is a specific programming problem I face, thus the question on stackoverflow.

As far as I know, it would be interpreted as:
A or b or (Not c) or d

Related

How to turn these expressions into Reverse Polish Notation?

I am working with Odoo 8 and I want to set a couple of domains. I thought I understood reverse Polish notation but domains are not working so I guess I am wrong.
The domains I want to achieve using reverse Polish notation are:
A and B and C and (D or (E and F)): I tried to implement it with the expression A B C or D E F, but it did not work.
A and B and (C or D or (E and F)): I tried to implement it with the expression A B or or C D E F, but it did work neither.
Note: I am not writing ANDs in domains (if you do not specify anything
in Odoo, it is supposed to use &).
My domains are wrong because I always get no record.
Can anyone help me, please?
I have the answer. Despite if you do not specify anything, Odoo takes an AND by default, you must write ANDs when there are expressions which must be executed before other and Odoo does not know which are because you have a complex and long expression.
In my cases, E and F must be executed before any other expression, so we cannot leave them without AND, so:
A and B and C and (D or (E and F)): The solution is A B C or D and E F.
A and B and (C or D or (E and F)): The solution is A B or or C D and E F.
In an XML domain in Odoo, these domains will be:
[A, B, C, '|', D, '&', E, F].
[A, B, '|', '|', C, D, '&', E, F].
Where each letter will be an expression like ('field', 'operator', 'value').
Note: ampersands must be escaped.
EDIT
I have answered a question here:
I don´t understand Normal Polish Notation (NPN or PN). How to build a complex domain in Odoo?
In which I explain with details a great method to resolve complex domains. I hope it helps to someone.

(LOGIC) Determine whether a statement is correct using truth-tables

I'm trying to study for my midterm and I need help figuring out what to do for this problem. It says:
Determine whether the following statement is correct, using any
legitimate truth-table technique.
~A ∨ (B → C), E → (B & A), C → E  |= C ↔ A
I make a truth table for each statement but I don't how the main connective correlates with the other connectives in the other statements.
I think I have to make a joint table but I really don't know where to begin. If anyone can help me understand it would be greatly appreciated!
A,B,C |= D means that if A,B,C are all true then D is true as well. But, this is exactly what the expression (A & B & C) -> D says. Thus A,B,C |= D is true if and only if (A & B & C) -> D is a tautology. In other words, the connective -> captures the meaning of |=. For your problem, you can make a truth table for the compound expression
[(~A ∨ (B → C)) & (E → (B & A)) & (C → E)] -> (C ↔ A)
and see if it is a tautology

Wolfram Alpha and Logic - NOR transformation

i have some difficulties interpret some WolframAlpha logic.
I have this logical expression: !(a || b || c)
WA says, that it's minimal NOR-Form ist a NOR b NOR c.
But if you type it in, the truth tables are different.
However if you search for this (!a nor b) nor c
you'll get the correct answer.
Is this an WolframAlpha bug or do I just misinterpret the result?
Here are the links:
!(a || b || c) http://www.wolframalpha.com/input/?i=!%28a+||+b+||+c%29
a NOR b NOR c http://www.wolframalpha.com/input/?i=a+nor+b+nor+c
Thanks!
If we consider NOR as a binary operator, then we need to treat an expression like a NOR b NOR c as either (a NOR b) NOR c or a NOR (b NOR c). Either way, it's not the same as !(a || b || c). This is in fact how WA treats the formula when you ask it about a NOR b NOR c.
However, suppose we consider NOR as a “variable” arity operator, that takes any number of arguments. Thus we treat a NOR b NOR c as NOR(a, b, c), where the NOR function returns true if and only if all of its arguments are false. Then a NOR b NOR c is the same as !(a || b || c). This seems to be what WA thinks when you ask it about !(a || b || c).
It does seem like a bug in Wolfram Alpha that it uses different definitions of a NOR b NOR c in these two cases.

If not (a and not b) and if (not a and b)

Can anyone explain why these two statements aren't equal?
if not(a and not b):
// do some stuff
if (not a and b):
// do some stuff
I tried to make my program more understandable by changing the first statement to the second but it doesn't work. I don't totally understand why.
You should look into De Morgan's Thereom, half of which is (a):
not(p and q) -> not(p) or not(q)
In terms of how that applies to your situation, just replace p with a and q with not(b):
not(a and not b) -> not(a) or not(not(b))
-> not(a) or b
(a) The other half is:
not(p or q) -> not(p) and not(q)
if not(a and not b) is the same as if (not a) or b, not what you wrote.
You also need to flip the 'and' to 'or' due to De Morgan's law
if not(a and not b)
becomes
if (not a or b)

complex logical operation

Given this logical operation :
(A AND B) OR (C AND D)
Is there a way to write a similar expression without using any parentheses and giving the same result ? Usage of logical operators AND, OR, NOT are allowed.
Yes:
A and B or C and D
In most programming languages, and is taken to have higher precedence than or (this stems from the equivalence of and and or to * and +, respectively).
Of course, if your original expression had been:
(A or B) and (C or D)
you couldn't simply remove the parentheses. In this instance, you'd have to "multiply out" the factors:
A and C or B and C or A and D or B and D
How about A AND B OR C AND D? It's the same because AND takes precedence over OR.
Just don't put any parentheses, it is the same...
It can be written in two ways
A & B | C & D
Type as it is mentioned in question just remove the parenthesis it will show the same result.
We can use & for AND to multiply and | for OR to divide. Also simply you can write them without any parenthesis

Resources