61. De Morgan's Laws

Medium

De Morgan's laws let you turn a complement of a union into an intersection of complements, and vice versa:

(A∪B)c=Ac∩Bc(A∩B)c=Ac∪Bc(A \cup B)^c = A^c \cap B^c \qquad (A \cap B)^c = A^c \cup B^c

Return a dict with both complements:

keyvalue
"not_a_or_b"(A∪B)c(A \cup B)^c
"not_a_and_b"(A∩B)c(A \cap B)^c

Compute each one using the right-hand side of the matching law (complement each event first, then combine) and confirm for yourself that it agrees with the direct route.

Input

a = {2, 4, 6}
b = {4, 5, 6}
sample_space = {1, 2, 3, 4, 5, 6}

Output

{'not_a_or_b': {1, 3}, 'not_a_and_b': {1, 2, 3, 5}}
Implement solve(...)