# Sum of disjoint product of sets [closed]

If we have the following sets and we need to apply the Sum of disjoint product property to them, as in the following example:

Take: $$P_1=\{x_1 x_4\}$$ $$P_2=\{x_2 x_5\}$$ $$P_3=\{x_1 x_3 x_5\}$$

P1 = {x1 x4};
P2 = {x2 x5};
P3 = {x1 x3 x5};


Step1: $$T_1=P_1=x_1 x_4$$

T1=Times @@ P1


Step2: $$P_1-P_2=x_1 x_4$$

Complement[P1, P2]


$$T_2=(1-x_1)P_2+x_1(1-x_4)P_2$$

How to get $$T_2$$ programmatically?

Step3:

$$P_1-P_3=x3 x5$$ $$A_1=(1-x_3)P_3$$ $$A_2=x_3(1-x_5)P_3$$

How to get $$A_1 and A_2$$ programmatically?

$$A_3=P_2-A_1$$ $$A_4=P_2-A_2$$

How to get $$A_3 and A_4$$ programmatically?

$$T_3=A_3+A_4$$

Step4:

$$S=T_1+T_2+T_3$$ How can these steps be combined into an algorithm for any three sets?

• P3 = {x1 x3 x5}; do you not need commas between these letters? Feb 21 at 18:28
• @Nasser It is a multiplied elements Feb 21 at 18:32
• If P1 is meant to be P1={x1 * x2} and not P1={x1,x2} then why do you do T1 = Times @@ P1 ? Feb 21 at 18:39
• @Nasser I'm trying to apply my math aspect and both cases are correct for me. I have little experience in how to write code. Any hypothesis P1={x1 * x2} or P1={x1,x2} is correct Feb 21 at 18:43
• You will need to help us out a bit with your notation. For example, what does the operator + mean? What is $(1-x_1)P_2$? Is 1 the universal set? Is $x_1$ by itself really mean the singleton set $\{x_1\}$? Is "multiplication" here cartesian product, etc.
– chuy
Feb 21 at 21:08