Using basic operators, derive the additional operator intersection.
R ∩ S = ?
I thought it might be: (R ∪ S) - ((R -S) ∪ (S -R)) but I also think there might be an easier way of doing it?
A intersected with B is equal to A - (A - B) or equivalenty B - (B - A)
R ∩ S is also equal to ~( (~R) ∪ (~S) )
where ~A is the complement of A
Related
Let's say I have a table, which has four columns (a, b, oper and c) and some primary key column. oper means arithmetic operation (+ - * /) here.
a b oper c
-------------
2 3 + 5
4 2 / 3
6 1 * 9
8 5 - 3
As, we can see in some cases, a <oper> b != c. So, my question is how to filter out such cases?
I've heard of execute, which is used for executing statements, but I don't know how to use it inside where clause.
Also, I'm not generalizing the oper to any arithmetic operation, but it would be nice to know, if any function exists.
SELECT *
FROM table
WHERE с != CASE oper WHEN '+' THEN a+b
WHEN '-' THEN a-b
WHEN '*' THEN a*b
WHEN '/' THEN a/b
ELSE NULL END
fiddle
I have a doubt regarding how to implement this statement with constraints:
Only if A or B or both, then C or D or both.
I want to implement it with constraints that take binary values.
This is an example:
If A then B, means that A=B;
A or B or both, means that A+B>=1.
Thank you so much.
Let me try.
First A => B is not the same as A=B. It is however the same as B >= A. If we want: A <=> B then indeed A=B.
The real question seems to be: A+B>=1 <=> C+D>=1 or
A+B>=1 => C+D>=1
A+B=0 => C+D=0
We can write this as a system of inequalities:
C+D >= A
C+D >= B
C+D <= 2(A+B)
All variables are assumed to be binary.
I have been Googling around and haven't been able to find a solution. If anyone can link me or explain this, I'd appreciate it.
I have this expression:
¬aΛb | aΛ¬b. Λ is AND, ¬ is NOT.
The truth table is:
A B Expression
--------------
T T F
T F T
F T F
F F T
I am confused as to why they aren't all FALSE. For example, if I were to consider a and b as false: ¬a and ¬b gets precedence, so they become true. But ¬a (TRUE) Λ b (FALSE) is FALSE. And since Λ gets precedence, a (FALSE) Λ ¬b (TRUE) is again FALSE. So FALSE | FALSE = FALSE, right?
Likewise, for a|b|c|d|e, where | is OR. Why is it that when only d is FALSE, and the other are true:
T T T F T
= FALSE
The calculator you're using uses | to mean NAND, not OR. You should use + for OR. Then the truth table comes out as expected. x NAND y is TRUE except when x AND y are true; and NAND has the same precedence as AND, so without parentheses the operators bind leftmost first. A fully parenthesized version of your formula is:
((((not a) and b) nand a) and (not b))
Generating a truth table based on this gives the observed result.
It is a functional dependency question.
I know that when x->yz then x->y and x->z.But is the above dependency possible?
If xy determines z can x determine z and y determine z?
Yes, if xy -> z then it's possible that also x -> z and y -> z.
Suppose z can only have one value; then a given x, y or xy only ever appears with that one value. Or suppose x -> z and y -> z and x must equal y. Or suppose both x and y are unique; then xy is unique. (A case of that is when both x & y are candidate keys.) In fact any time that x -> z and y -> z, xy -> z.
(To show something is possible it's always worth trying some cases, especially very simple ones, in case they are examples, so you don't have to prove the general case.)
So let's say you have n boolean inputs of x1, x2, x3, ..., xn. How do you determine that <= k of your boolean inputs are True using only And/Or/Not logic gates, and doing so in polynomial time?
I'm quite honestly befuddled.
There are many ways to do it. One is to (recursively) make two nets:
one (A) determining that <= k-1 of boolean inputs x1 ... x[n-1] are True.
another (B) determining that <= k of boolean inputs x1 ... x[n-1] are True.
Connect them as (B And Not x[n]) Or A