0
$\begingroup$

Suppose I have $l$ length of words denoted as $P$, I want to divide this set into four $P=QRST$ including empty set, i.e., $Q=R=S=\phi, T=P$.

For non-empty set decomposition, I can do

 p = Permutations[P];
 n = Length[P];
 pn = IntegerPartitions[n, {4}];
 pnn[i_] := Permutations[pn[[i]]];

 Tablen = Length[pn];
 in = Flatten[Table[pnn[i], {i, 1, Tablen}], 1];
 tn = Flatten[Outer[TakeList, p, in, 1], 1];
 newn = DeleteDuplicatesBy[tn, Sort /@ # &];

 Q = Map[#[[1]] &, tn];
 R = Map[#[[2]] &, tn];
 S = Map[#[[3]] &, tn];
 T = Map[#[[4]] &, tn];

Actually, I can do more general decomposition by replacing {4} -> {m}. But here the problem is in the process of making in and tn, the empty set was not included.

I want to make Q,R,S,T including an empty set. Any ideas?

[This post contains some answer in my previous post, but here I want to include empty set]


Example

$P=\{1,2,3,4\}$

then

$Q= \{ \{ \}, \{1\}, \{2\},\{3\},\{4\},\{1,2\}, ...\} $

$R=\{ \{\}, ....\}$

$S=\{ \{\}, .....\}$

$T=\{\{1,2,3,4\}, ...\}$

where $P=QRST$

$\endgroup$
3
  • $\begingroup$ $P=QRST$ and $T=P$ : Is this a recursive definition? $\endgroup$
    – Syed
    Dec 13, 2022 at 6:57
  • $\begingroup$ @Syed what I mean $P=QRST$ is dividing $P$ into $Q,R,S,T$. If $Q,R,S$ becomes an empty set then $P=T$. The example case above is the case $Q,R,S$ becomes empty and so $T$ becomes the whole set $P$ $\endgroup$
    – phy_math
    Dec 13, 2022 at 7:01
  • $\begingroup$ Please load a minimal example including a definition for P such that it evaluates. $\endgroup$
    – Syed
    Dec 13, 2022 at 7:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.