allsubsets
All subsets of a set S are collectively called the power set of S, denoted P(S) or π«(S). A subset T satisfies T β S; the empty set β is a subset of every set, and S itself is also a subset of S. The power set contains every possible combination of elements of S and thus has 2^|S| elements for a finite S with |S| = n.
Example: if S = {1, 2, 3}, its subsets are β , {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, and {1,2,3}.
Generation and counting: For finite sets, all subsets can be enumerated by iterating binary masks from 0
Properties: The collection P(S), equipped with union, intersection, and complement (relative to a universal set), forms
Infinite case: If S is infinite, the power set π«(S) has cardinality 2^|S|. By Cantorβs theorem, 2^|S|
Applications: In probability theory, events are subsets of a sample space; in logic and computer science, subsets