Subsets and Power Sets
We will often want to compare sets. One kind of comparison is: everything in one set is in the other (set) too. This situation is sufficiently important for us to introduce some new notation.
If every element of a set is also an element of , then we say that is a subset of , and we write . If but , we write , and say that is a proper subset of .
The notation is used because they are similar to equality operators and . You may also see in other literature.
The corresponding latex symbols are \subset
, \subseteq
, and \subsetneq
.
Every set is a subset of itself, and is a subset of every set. The set of even numbers is a subset of the set of natural numbers. Also . But is not a subset of .
Applying subsets is useful for checking validity of something e.g. ensuring that a customer have chosen appropriate combination of items. The chefs check that they have chosen ingredients from available sets before planning the servings. The managers compare software features against the requirements.
Let all pizza toppings be a . Choosing any subset of toppings would result in a pizza that have name e.g. ham or cheese pizza. A kebab pizza would be a proper subset so .
In Python the example would be written as
pizza_toppings: set[str] = { "ham", "kebab", "mozzarella", "tomato" }
kebab_pizza: set[str] = { "kebab", "mozzarella" }
print(kebab_pizza.issubset(pizza_toppings))
# True
iff both and .
The set consisting of all subsets of a set is called power set of , written :
The symbol \wp
in TeX (perhaps short for Weierstrass p-function).
You may also encounter different power set notations that uses different styles of "p" such as .
Soups can have any combination of ingredients and still taste good. The chef wants a list of all soups he can make from a set of ingredients . That power set that describes all combinations is
List all subsets of .
Show that if has elements, then has elements.