Does the natural compound contain a distribution by difference?

In other words, is it true that: r1 β‹ˆ (r2 - r3) = r1 β‹ˆ r2 - r1 β‹ˆ r3

where r1 r2 and r3 are relations

If this is not an example?

+4
source share
2 answers

Yes.

Take tuple t with all the JOIN attributes. Let t1 be its part of "R1". Let t2 be its β€œR2” part (and since R2-R3 is a valid expression, it is also the β€œR3” part of t).

A tuple t appears in R1 JOIN (R2 MINUS R3) if and only if:

t1 appears in R1, And t2 appears in R2, And t2 does not appear in R3.

In (R1 JOIN R2) MINUS (R1 JOIN R3), the symbol t appears if and only if:

t1 appears in R1, And t2 appears in R2, and (this is not so) (t1 appears in R1, And t2 appears in R3).

since t1 should appear in R1, it boils down to:

t1 appears in R1, And t2 appears in R2, and NOT (true AND t2 appears in R3).
t1 appears in R1, And t2 appears in R2, and NOT (t2 appears in R3).

Compare with the first case and make sure that the conditions are identical.

Another way of proving the property is to observe what (R2 MINUS R3) is equivalent to (R2 INTERSECT CMP (R3)), moreover, CMP (R3) denotes the complement of R3 (with respect to the universal relation of its type), and then using the JOIN OVER INTERSECTION distribution.
+3
source

I have no answer to the question asked, but even if this is true, I do not believe that equivalence is symmetrical. Consider

r1 = (a1, a2) r2 = (a1, a2, a3) r3 = (a2, a3) 

then r1 β‹ˆ r2 - r1 β‹ˆ r3 possible because each operand is compatible with the union, and r2 - r3 is not.

+1
source

All Articles